Skip to content

Commit e47ecaf

Browse files
authored
Merge pull request #79 from RLOpenCatalyst/topic-release
1.11.5 Release updates
2 parents 875d7f8 + e96390e commit e47ecaf

16 files changed

Lines changed: 610 additions & 42 deletions

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ It provides a pre-built catalog of products which are ready to use out of the bo
3535
3. 3 Private Subnets
3636
4. IGW
3737
5. NAT Instance / NAT Gateway
38-
6. Bastion Hosts
38+
6. Bastion Hosts (optional)
3939
7. Application Load Balancer
4040
8. Listener
4141
9. ACM or External Certificates for SSL
@@ -55,6 +55,10 @@ Deploying an Application Load Balancer as part of Research Gateway deployment he
5555
1. Isolates your portal from being directly exposed over the internet. The ALB allows only https(s) traffic through.
5656
2. Helps to serve the application on a secure port using SSL certificates stored in AWS ACM.
5757

58+
create an ALB security Group with the following inbound and outbound rules.
59+
- Inbound rules - HTTP 80 ,HTTPS 443,SSH 22 .
60+
- outbound Rules - All Traffic.
61+
5862
Use the AWS CLI to create an Application Load Balancer choosing all three public subnets created by the quickstart above.
5963

6064
aws elbv2 create-load-balancer --name research-gw-alb --subnets subnet-abcd1234 subnet-abcd5678 subnet-abcd9876 --security-groups sg-abcd1234 --region us-east-1
@@ -115,6 +119,8 @@ As a part of this deployment, you will create an AMI for the portal EC2 instance
115119
- AWS ImageBuilder
116120
- AWS EC2
117121
- AWS IAM
122+
- AWS service catalog
123+
- Elastic container Registery
118124

119125
## Installing the required 3rd party software
120126

@@ -142,6 +148,7 @@ You can create the AMI with pre-requisites yourself by following these steps:
142148
export AWS_DEFAULT_REGION="Your_Region"
143149

144150
- Clone this repo on a machine.
151+
- Target Account number must be added in Admin Account-ECR and give permission to access image builds
145152
- Create a Role and attach a policy which permits ECR and EC2 actions and Replace the "iam-instance_profile" :"<your_rolename>" in builders section which is in the packer-rg.json.
146153
- Run packer build packer-rg.json
147154

@@ -152,7 +159,15 @@ You can create the AMI with pre-requisites yourself by following these steps:
152159
### Installing Research Gateway
153160

154161
Clone this repo on a machine that has AWS CLI configured with Default output format as JSON.
155-
Run deploy.sh with the following parameters
162+
Run deploy.sh with the following parameters.
163+
164+
*Note* : Check aws configure before running script
165+
- $aws configure
166+
- AWS Access Key ID:"your_Access_Key"
167+
- AWS Secret Access Key :"your_Secret_Key"
168+
- Default region name:"Your_Region"
169+
- Default output format : json
170+
156171

157172
| Parameter# | Purpose |
158173
| ---------- | ------------------------------------------------------------------------------------------ |
@@ -177,6 +192,8 @@ runid.json is created in the rgdeploy folder when you first run deploy.sh with p
177192

178193
The deployment creates EC2 Image Builder pipelines for building the RStudio and Nextflow AMIs that are used within Research Gateway. By default, these pipelines are set up to be manually triggered. You can change that in the AWS console if you wish to trigger them on a schedule.
179194

195+
steps to run pipelines: AWS console - Ec2imagebuilder – select image pipelines (Rstudio, Nextflow)-click on Actions-Run pipeline
196+
180197
Once a build is completed, the AMIs are automatically distributed to the regions supported by Research Gateway in your account. The AMI Ids need to be updated into your database before creating any projects.
181198

182199
- Note down the names of the two pipelines created for RStudio and Nextflow_Advanced. They will be of the format:
@@ -186,6 +203,8 @@ The runid will be the random 4-character string generated for your instance duri
186203
- In the rgdeploy folder, cd to products folder. You will find an img-builder-config.json file there. Edit it and set the pipeline names according to the ones deployed in your account. Save the file.
187204
- Run the script make-amilist.sh. You may have to run chmod +x make-amilist.sh if execute permissions are not set on the file.
188205

206+
- Note: we need to wait untill ec2image builder pipeline distribution complete,without builds complete by running below command shows Error
207+
189208
./make-amilist.sh > new-ami-list.json
190209
- Next run the following command to update your DB.
191210

cft-templates/Rstudio.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ Parameters:
1919
the environment instance, including any bootstrap scripts
2020
InstanceType:
2121
Type: String
22-
Description: Instance type for RStudio. Default is t2.medium.
22+
Description: Instance type for RStudio. Default is t3.medium.
2323
AllowedValues:
2424
- t2.medium
2525
- t2.large
2626
- t3.medium
2727
- t3.large
2828

29-
ConstraintDescription: Valid instance type in the t2 families
30-
Default: t2.medium
29+
ConstraintDescription: Valid instance type in the t3 families
30+
Default: t3.medium
3131
InitialUser:
3232
Type: String
3333
Description: User Name for RStudio. Do not use 'root' and 'ec2-user'

cft-templates/cromwell-advanced.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ Parameters:
8282
InstanceType:
8383
Description: Head Node EC2 instance type
8484
Type: String
85-
Default: t2.small
86-
AllowedValues: [t2.nano, t2.micro, t2.small, t2.medium]
85+
Default: t3.small
86+
AllowedValues: [t3.nano, t3.micro, t3.small, t3.medium]
8787
ConstraintDescription: Must be a valid EC2 instance type.
8888
WorkerNodeInstanceType:
8989
Description: Specify the instance types to be used to carry out the computation. You can specify one or more family or instance type. The option 'optimal' chooses the best fit of M4, C4, and R4 instance types available in the region.
@@ -932,4 +932,6 @@ Outputs:
932932
EC2 Launch Template ID to use when creating AWS Batch compute environments
933933
Value: !Ref EC2LaunchTemplate
934934
WorkDataLocation:
935-
Value: !Sub ${S3Bucket}
935+
Value: !Sub ${S3Bucket}
936+
BatchComputeEnvironment:
937+
Value: !Ref SpotComputeEnv

cft-templates/ec2-EIP.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ Parameters:
2121
An S3 URI (starting with "s3://") that specifies the location of files to be copied to
2222
the environment instance, including any bootstrap scripts
2323
InstanceType:
24-
Description: Choose the instance type for this instance. e.g. t2.small
24+
Description: Choose the instance type for this instance. e.g. t3.small
2525
Type: String
26-
Default: t2.small
27-
AllowedValues: [t2.nano, t2.micro, t2.small, t2.medium]
26+
Default: t3.small
27+
AllowedValues: [t3.nano, t3.micro, t3.small, t3.medium]
2828
ConstraintDescription: must be a valid EC2 instance type.
2929
KeyPair:
3030
Description: Name of an existing EC2 KeyPair to enable SSH access to the instance. If no key pairs exist, please create one from the button next to the dropdown. Please contact your Administrator if you are unable to create one.
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
Metadata:
2+
License: Apache-2.0
3+
AWSTemplateFormatVersion: '2010-09-09'
4+
Description: 'AWS CloudFormation Template to create an EC2 instance
5+
**WARNING** This template creates an Amazon EC2 instance and an Elastic IP Address.
6+
You will be billed for the AWS resources used if you create a stack from this template.'
7+
8+
Parameters:
9+
Namespace:
10+
Type: String
11+
Description: An environment name that will be prefixed to resource names
12+
S3Mounts:
13+
Type: String
14+
Description: A JSON array of objects with name, bucket, and prefix properties used to mount data
15+
IamPolicyDocument:
16+
Type: String
17+
Description: The IAM policy to be associated with the launched workstation
18+
EnvironmentInstanceFiles:
19+
Type: String
20+
Description: >-
21+
An S3 URI (starting with "s3://") that specifies the location of files to be copied to
22+
the environment instance, including any bootstrap scripts
23+
InstanceType:
24+
Description: Choose the instance type for this instance. e.g. t3.small
25+
Type: String
26+
Default: t3.small
27+
AllowedValues: [t3.nano, t3.micro, t3.small, t3.medium]
28+
ConstraintDescription: must be a valid EC2 instance type.
29+
KeyPair:
30+
Description: Name of an existing EC2 KeyPair to enable SSH access to the instance. If no key pairs exist, please create one from the button next to the dropdown. Please contact your Administrator if you are unable to create one.
31+
Type: AWS::EC2::KeyPair::KeyName
32+
ConstraintDescription: must be the name of an existing EC2 KeyPair.
33+
AllowedSSHLocation:
34+
Description: The IP address range that can be used to SSH to the EC2 instances
35+
Type: String
36+
MinLength: '9'
37+
MaxLength: '18'
38+
Default: 0.0.0.0/0
39+
AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})
40+
ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
41+
LatestAmiId:
42+
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
43+
Default: '/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id'
44+
MasterPassword:
45+
NoEcho: "true"
46+
Description : "The database master password"
47+
Type: "String"
48+
MinLength: "8"
49+
MaxLength: "100"
50+
AllowedPattern : "[a-zA-Z0-9]{8,100}"
51+
ConstraintDescription : "must contain only alphanumeric characters."
52+
ConnectFromPort:
53+
Type: Number
54+
Description: Required Port mappings
55+
ConnectToPort:
56+
Type: Number
57+
Description: Required Port mappings
58+
59+
Conditions:
60+
IamPolicyEmpty: !Equals [!Ref IamPolicyDocument, '{}']
61+
62+
Resources:
63+
IAMRole:
64+
Type: 'AWS::IAM::Role'
65+
Properties:
66+
RoleName: !Join ['-', [Ref: Namespace, 'ec2-role']]
67+
Path: '/'
68+
AssumeRolePolicyDocument:
69+
Version: '2012-10-17'
70+
Statement:
71+
- Effect: 'Allow'
72+
Principal:
73+
Service:
74+
- 'ec2.amazonaws.com'
75+
Action:
76+
- 'sts:AssumeRole'
77+
Policies:
78+
- !If
79+
- IamPolicyEmpty
80+
- !Ref 'AWS::NoValue'
81+
- PolicyName: !Join ['-', [Ref: Namespace, 's3-studydata-policy']]
82+
PolicyDocument: !Ref IamPolicyDocument
83+
84+
InstanceProfile:
85+
Type: 'AWS::IAM::InstanceProfile'
86+
Properties:
87+
InstanceProfileName: !Join ['-', [Ref: Namespace, 'ec2-profile']]
88+
Path: '/'
89+
Roles:
90+
- Ref: IAMRole
91+
92+
EC2Instance:
93+
Type: AWS::EC2::Instance
94+
CreationPolicy:
95+
ResourceSignal:
96+
Timeout: PT5M
97+
Properties:
98+
UserData:
99+
Fn::Base64: !Sub |
100+
#!/usr/bin/env bash
101+
# pull mysql version 8
102+
sudo yum install zip -y
103+
sudo yum install unzip -y
104+
# Install AWS CLI version2
105+
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
106+
unzip awscliv2.zip
107+
sudo ./aws/install
108+
# Install Mysql Shell
109+
sudo yum install mysql -y
110+
# Pull Mysql Image
111+
docker pull mysql:8
112+
mkdir docker
113+
mkdir docker/mysql
114+
mkdir docker/mysql/conf
115+
mkdir docker/mysql/data
116+
docker run -d -p 3306:3306 \
117+
-v /home/ec2-user/docker/mysql/conf/:/etc/mysql/conf.d \
118+
-v /home/ec2-user/docker/mysql/data/:/var/lib/mysql \
119+
-e MYSQL_ROOT_PASSWORD=${MasterPassword} \
120+
--restart always \
121+
--name docker_mysql mysql:8 \
122+
# Download and execute shell script
123+
cd /home/ec2-user
124+
aws s3 cp "${EnvironmentInstanceFiles}/alter_rootpassword.sh" "alter_rootpassword.sh"
125+
chmod +x alter_rootpassword.sh
126+
./alter_rootpassword.sh ${MasterPassword}
127+
# Install cfn
128+
yum install -y aws-cfn-bootstrap
129+
# Download and execute shell script
130+
aws s3 cp "${EnvironmentInstanceFiles}/get_bootstrap_mysql.sh" "/tmp"
131+
chmod 500 "/tmp/get_bootstrap_mysql.sh"
132+
/tmp/get_bootstrap_mysql.sh "${EnvironmentInstanceFiles}" '${S3Mounts}'
133+
# Signal result to CloudFormation
134+
/opt/aws/bin/cfn-signal --exit-code 0 --resource EC2Instance --region ${AWS::Region} --stack ${AWS::StackName}
135+
InstanceType: !Ref 'InstanceType'
136+
SecurityGroups: [!Ref 'InstanceSecurityGroup']
137+
KeyName: !Ref 'KeyPair'
138+
ImageId: !Ref 'LatestAmiId'
139+
IamInstanceProfile: !Ref InstanceProfile
140+
Tags:
141+
- Key: Name
142+
Value: !Join ['-', [Ref: Namespace, 'ec2-linux']]
143+
- Key: Description
144+
Value: EC2 workspace instance
145+
146+
InstanceSecurityGroup:
147+
Type: AWS::EC2::SecurityGroup
148+
Properties:
149+
GroupDescription: Enable SSH access
150+
SecurityGroupIngress:
151+
- IpProtocol: tcp
152+
FromPort: '22'
153+
ToPort: '22'
154+
CidrIp: !Ref 'AllowedSSHLocation'
155+
- IpProtocol: tcp
156+
FromPort: !Ref 'ConnectFromPort'
157+
ToPort: !Ref 'ConnectToPort'
158+
CidrIp: !Ref 'AllowedSSHLocation'
159+
Outputs:
160+
InstanceId:
161+
Description: InstanceId of the newly created EC2 instance
162+
Value: !Ref 'EC2Instance'
163+
InstanceIPAddress:
164+
Description: IP address of the newly created EC2 instance
165+
Value: !GetAtt [EC2Instance, PublicIp]
166+
InstanceDNSName:
167+
Description: DNS name of the newly created EC2 instance
168+
Value: !GetAtt [EC2Instance, PublicDnsName]
169+
InstancePrivateIPAddress:
170+
Description: Private IP address of the newly created EC2 instance
171+
Value: !GetAtt [EC2Instance, PrivateIp]

0 commit comments

Comments
 (0)