Skip to content

Commit d2699ea

Browse files
author
ravigurram8
committed
resloved conflicts of nextflow and cromwell cfts
2 parents 7209738 + 34fd7b7 commit d2699ea

9 files changed

Lines changed: 221 additions & 11 deletions

File tree

cft-templates/cromwell-advanced.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,4 +934,4 @@ Outputs:
934934
WorkDataLocation:
935935
Value: !Sub ${S3Bucket}
936936
BatchComputeEnvironment:
937-
Value: !Ref SpotComputeEnv
937+
Value: !Ref SpotComputeEnv
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. t2.small
25+
Type: String
26+
Default: t2.small
27+
AllowedValues: [t2.nano, t2.micro, t2.small, t2.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]

cft-templates/nextflow-advanced.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,4 +716,4 @@ Outputs:
716716
BatchQueue:
717717
Value: !Sub ${DefaultQueue}
718718
BatchComputeEnvironment:
719-
Value: !Ref SpotComputeEnv
719+
Value: !Ref SpotComputeEnv

cft-templates/users.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
email,first_name,last_name,role,userTags
2+
john.doe@example.com,Student,1,0,"tag1,tag2,tag3"

config/access-policy.json

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"Sid": "Stmt1609262373000",
66
"Effect": "Allow",
77
"Action": [
8-
"acm:*",
8+
"acm:*",
99
"config:*",
1010
"ce:DescribeCostCategoryDefinition",
1111
"ce:GetRightsizingRecommendation",
@@ -27,7 +27,7 @@
2727
"sns:*",
2828
"iam:GetUser",
2929
"iam:GetRole",
30-
"iam:GetPolicyVersion",
30+
"iam:GetPolicyVersion",
3131
"iam:DeleteRole",
3232
"iam:CreateRole",
3333
"iam:AttachRolePolicy",
@@ -44,6 +44,8 @@
4444
"iam:DeleteInstanceProfile",
4545
"iam:CreatePolicy",
4646
"iam:GetRolePolicy",
47+
"iam:GetPolicy",
48+
"iam:ListPolicyVersions",
4749
"batch:*",
4850
"sts:AssumeRole",
4951
"sts:GetFederationToken",
@@ -72,7 +74,39 @@
7274
"dynamodb:*",
7375
"lambda:*",
7476
"sagemaker:*",
75-
"elasticmapreduce:*"
77+
"elasticmapreduce:*",
78+
"ecr:*",
79+
"apigateway:DELETE",
80+
"apigateway:GET",
81+
"apigateway:PATCH",
82+
"apigateway:POST",
83+
"apigateway:UpdateRestApiPolicy",
84+
"cognito-idp:AdminAddUserToGroup",
85+
"cognito-idp:AdminCreateUser",
86+
"cognito-idp:AdminDeleteUser",
87+
"cognito-idp:AdminRemoveUserFromGroup",
88+
"cognito-idp:CreateGroup",
89+
"cognito-idp:CreateUserPool",
90+
"cognito-idp:CreateUserPoolClient",
91+
"cognito-idp:CreateUserPoolDomain",
92+
"cognito-idp:DeleteGroup",
93+
"cognito-idp:DeleteUserPoolClient",
94+
"cognito-idp:DeleteUserPoolDomain",
95+
"imagebuilder:CreateContainerRecipe",
96+
"imagebuilder:CreateImage",
97+
"imagebuilder:CreateImagePipeline",
98+
"imagebuilder:CreateInfrastructureConfiguration",
99+
"imagebuilder:DeleteContainerRecipe",
100+
"imagebuilder:DeleteImage",
101+
"imagebuilder:DeleteImagePipeline",
102+
"imagebuilder:DeleteInfrastructureConfiguration",
103+
"imagebuilder:GetComponent",
104+
"imagebuilder:GetImage",
105+
"imagebuilder:GetImagePipeline",
106+
"imagebuilder:GetInfrastructureConfiguration",
107+
"imagebuilder:TagResource",
108+
"imagebuilder:UntagResource",
109+
"cognito-idp:DeleteUserPool"
76110
],
77111
"Resource": [
78112
"*"

config/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,6 @@
201201
},
202202
"cronJobForEodSync" : "*/60 * * * *",
203203
"sampleCSVForUser": "users.csv",
204-
"sampleCSVBucketRegion": "us-west-2",
204+
"sampleCSVBucketRegion": "REPLACE_WITH_REGION",
205205
"sessionMaxAge" : 900000
206206
}

dump/standardcatalogitems.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@
659659
"checks_after_assigning_product": [],
660660
"permission_required": {},
661661
"cost_resource": true,
662-
"aws_batch" : true
662+
"aws_batch": true
663663
}
664664
}
665665
]

makeconfigs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ jq -r ".baseURL=\"$baseurl\"" "$mytemp/config.json" |
9191
jq -r ".route53.domainName=\"${r53_domain_name}\"" |
9292
jq -r ".route53.hostedZoneId=\"${r53_hosted_zone}\"" |
9393
jq -r ".AWSCognito.region=\"$region\"" |
94+
jq -r ".sampleCSVBucketRegion=\"$region\"" |
9495
jq -r ".enableB2CMode=false" >"${RG_HOME}/config/config.json"
9596
echo "Modifying snsConfig.json"
9697
if [ -z "$snsprotocol" ]; then

products/Nextflow-Advanced/machine-images/config/infra/files/nextflow/set-token

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/usr/bin/env bash
22
# Generate auth token
33
AUTH_TOKEN=$(uuidgen)
4+
# Copy update user sql script to a temp file
5+
sudo cp /usr/local/bin/update-user.sql /usr/local/bin/update-user-temp.sql
46
# Replace the generated token in the sql file
5-
sudo sed -i "s/<<AUTH_TOKEN>>/${AUTH_TOKEN}/g" /usr/local/bin/update-user.sql
7+
sudo sed -i "s/<<AUTH_TOKEN>>/${AUTH_TOKEN}/g" /usr/local/bin/update-user-temp.sql
68
echo "Update auth token to user table"
7-
sudo java -cp /usr/local/bin/h2/bin/h2-*.jar org.h2.tools.RunScript -url "jdbc:h2:file:/usr/local/bin/nf-tower/.db/h2/tower" -driver "org.h2.Driver" -user "sa" -password "testpass" -script /usr/local/bin/update-user.sql -showResults
8-
# Replace <<AUTH_TOKEN>> back for it to work on next boot
9-
sudo sed -i "s/${AUTH_TOKEN}/<<AUTH_TOKEN>>/g" /usr/local/bin/update-user.sql
9+
sudo java -cp /usr/local/bin/h2/bin/h2-*.jar org.h2.tools.RunScript -url "jdbc:h2:file:/usr/local/bin/nf-tower/.db/h2/tower" -driver "org.h2.Driver" -user "sa" -password "testpass" -script /usr/local/bin/update-user-temp.sql -showResults
10+
# Remove the temp update user sql script
11+
sudo rm /usr/local/bin/update-user-temp.sql
1012
echo "Auth token updated in db"
1113

1214
#Update SSM parameter with the auth token

0 commit comments

Comments
 (0)