Skip to content
This repository was archived by the owner on Aug 9, 2023. It is now read-only.

Commit 988b270

Browse files
authored
Merge pull request #97 from aws-samples/master
release update
2 parents 6d0c42d + 67868b1 commit 988b270

File tree

3 files changed

+55
-50
lines changed

3 files changed

+55
-50
lines changed

docs/core-env/create-custom-compute-resources.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The longer these scripts / customizations take to complete, the longer it will
2323
be before your instance is ready for work.
2424

2525
Launch Templates are capable of pre-configuring a lot of EC2 instance options.
26-
Since this will be working with AWS Batch, which already does a lot of automatic
26+
Since this will be working with AWS Batch, which already does a lot of automatic
2727
instance configuration on its own, you only need to supply the `UserData`
2828
script below:
2929

@@ -37,23 +37,25 @@ Content-Type: text/cloud-config; charset="us-ascii"
3737
packages:
3838
- jq
3939
- btrfs-progs
40-
- python27-pip
4140
- sed
4241
- wget
42+
- unzip
4343
# add more package names here if you need them
4444
4545
runcmd:
46-
- pip install -U awscli boto3
46+
- curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
47+
- unzip -q /tmp/awscliv2.zip -d /tmp
48+
- /tmp/aws/install
4749
- cd /opt && wget https://aws-genomics-workflows.s3.amazonaws.com/artifacts/aws-ebs-autoscale.tgz && tar -xzf aws-ebs-autoscale.tgz
4850
- sh /opt/ebs-autoscale/bin/init-ebs-autoscale.sh /scratch /dev/sdc 2>&1 > /var/log/init-ebs-autoscale.log
4951
# you can add more commands here if you have additional provisioning steps
5052
5153
--==BOUNDARY==--
5254
```
5355

54-
The above will add an `ebs-autoscale` daemon to an instance. By default it will
55-
add a 20GB EBS volume to the logical volume mounted at `/scratch`.
56-
If you want this volume to be larger initially, you can specify a bigger one
56+
The above will add an `ebs-autoscale` daemon to an instance. By default it will
57+
add a 20GB EBS volume to the logical volume mounted at `/scratch`.
58+
If you want this volume to be larger initially, you can specify a bigger one
5759
mapped to `/dev/sdc` the Launch Template.
5860

5961
!!! note
@@ -153,11 +155,11 @@ You should get something like the following as a response:
153155
```json
154156
{
155157
"LaunchTemplate": {
156-
"LatestVersionNumber": 1,
157-
"LaunchTemplateId": "lt-0123456789abcdef0",
158-
"LaunchTemplateName": "genomics-workflow-template",
159-
"DefaultVersionNumber": 1,
160-
"CreatedBy": "arn:aws:iam::123456789012:user/alice",
158+
"LatestVersionNumber": 1,
159+
"LaunchTemplateId": "lt-0123456789abcdef0",
160+
"LaunchTemplateName": "genomics-workflow-template",
161+
"DefaultVersionNumber": 1,
162+
"CreatedBy": "arn:aws:iam::123456789012:user/alice",
161163
"CreateTime": "2019-01-01T00:00:00.000Z"
162164
}
163165
}
@@ -166,8 +168,8 @@ You should get something like the following as a response:
166168
## Custom AMIs
167169

168170
A slightly more involved method for customizing an instance is
169-
to create a new AMI based on the ECS Optimized AMI. This is good if you have
170-
a lot of customization to do - lots of software to install and/or need large
171+
to create a new AMI based on the ECS Optimized AMI. This is good if you have
172+
a lot of customization to do - lots of software to install and/or need large
171173
datasets preloaded that will be needed by all your jobs.
172174

173175
You can learn more about how to [create your own AMIs in the EC2 userguide](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html).

src/templates/aws-genomics-launch-template.template.yaml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
AWSTemplateFormatVersion: "2010-09-09"
22
Description: >-
3-
(WWPS-GLS-WF-LT) Creates an EC2 Launch Template for AWS Batch based
3+
(WWPS-GLS-WF-LT) Creates an EC2 Launch Template for AWS Batch based
44
genomics workflows
55
66
Mappings:
7-
ScratchMountPointMap:
7+
ScratchMountPointMap:
88
step-functions:
99
mountpoint: "/var/lib/docker"
1010
cromwell:
@@ -33,7 +33,7 @@ Mappings:
3333
- sed -i 's+OPTIONS=.*+OPTIONS="--storage-driver btrfs"+g' /etc/sysconfig/docker-storage
3434
- cp -au /var/lib/docker.bk/* /var/lib/docker
3535
- cd /opt && wget $artifactRootUrl/aws-ecs-additions.tgz && tar -xzf aws-ecs-additions.tgz
36-
- sh /opt/ecs-additions/ecs-additions-step-functions.sh
36+
- sh /opt/ecs-additions/ecs-additions-step-functions.sh
3737
- service docker start
3838
- start ecs
3939
@@ -57,10 +57,10 @@ Mappings:
5757
- sed -i 's+OPTIONS=.*+OPTIONS="--storage-driver btrfs"+g' /etc/sysconfig/docker-storage
5858
- cp -au /var/lib/docker.bk/* /var/lib/docker
5959
- cd /opt && wget $artifactRootUrl/aws-ecs-additions.tgz && tar -xzf aws-ecs-additions.tgz
60-
- sh /opt/ecs-additions/ecs-additions-nextflow.sh
60+
- sh /opt/ecs-additions/ecs-additions-nextflow.sh
6161
- service docker start
6262
- start ecs
63-
63+
6464
Parameters:
6565
LaunchTemplateNamePrefix:
6666
Type: String
@@ -119,19 +119,19 @@ Resources:
119119
- Ebs:
120120
DeleteOnTermination: True
121121
VolumeSize: 50
122-
VolumeType: gp2
122+
VolumeType: gp2
123123
DeviceName: /dev/xvda
124124
- Ebs:
125125
Encrypted: True
126126
DeleteOnTermination: True
127127
VolumeSize: !Ref DockerImageAndMetadataVolumeSize
128-
VolumeType: gp2
128+
VolumeType: gp2
129129
DeviceName: /dev/xvdcz
130130
- Ebs:
131131
Encrypted: True
132132
DeleteOnTermination: True
133133
VolumeSize: !Ref ScratchVolumeSize
134-
VolumeType: gp2
134+
VolumeType: gp2
135135
DeviceName: /dev/sdc
136136
UserData:
137137
Fn::Base64: !Sub
@@ -145,14 +145,16 @@ Resources:
145145
packages:
146146
- jq
147147
- btrfs-progs
148-
- python27-pip
149148
- sed
150149
- wget
151150
- git
152151
- amazon-ssm-agent
152+
- unzip
153153
154154
runcmd:
155-
- pip install -U awscli boto3
155+
- curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
156+
- unzip -q /tmp/awscliv2.zip -d /tmp
157+
- /tmp/aws/install
156158
- export scratchPath="${ScratchMountPoint}"
157159
- export artifactRootUrl="${ArtifactRootUrl}"
158160
- start amazon-ssm-agent
@@ -161,7 +163,7 @@ Resources:
161163
162164
--==BOUNDARY==--
163165
- ECSAdditions:
164-
Fn::FindInMap:
166+
Fn::FindInMap:
165167
- ECSAdditionsMap
166168
- !Ref WorkflowOrchestrator
167169
- additions

src/templates/nextflow/nextflow-resources.template.yaml

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ Parameters:
4141
Description: >-
4242
S3 Bucket used to store input and output data for the workflow.
4343
This should bucket should already exist.
44-
44+
4545
S3NextflowBucketName:
4646
Type: String
4747
Description: >-
4848
S3 Bucket used to store Nextflow metadata (session cache, logs, and intermediate results)
49-
49+
5050
ExistingBucket:
5151
Type: String
5252
Description: >-
@@ -55,7 +55,7 @@ Parameters:
5555
- Yes
5656
- No
5757
Default: No
58-
58+
5959
S3NextflowPrefix:
6060
Type: String
6161
Description: >-
@@ -69,32 +69,32 @@ Parameters:
6969
(Optional) Folder in the Nextflow metadata bucket (under the {Nextflow Prefix} if needed)
7070
for session cache and logs.
7171
Default: logs
72-
72+
7373
S3WorkDirPrefix:
7474
Type: String
7575
Description: >-
7676
(Optional) Folder in the Nextflow metadata bucket (under the {Nextflow Prefix} if needed)
7777
that contains workflow intermediate results
7878
Default: runs
79-
79+
8080
NextflowContainerImage:
8181
Type: String
8282
Description: >-
8383
(Optional) Container image for nextflow with custom entrypoint for config and workflow
84-
script staging. (Example, "<dockerhub-user>/nextflow:latest").
85-
Provide this if you have a specific version of nextflow you want to use, otherwise a
86-
container will be built using the latest version.
84+
script staging. (Example, "<dockerhub-user>/nextflow:latest").
85+
Provide this if you have a specific version of nextflow you want to use, otherwise a
86+
container will be built using the latest version.
8787
8888
BatchDefaultJobQueue:
8989
Type: String
9090
Description: >-
9191
ARN of the Batch Job Queue to use by default for workflow tasks.
92-
92+
9393
BatchHighPriorityJobQueue:
9494
Type: String
9595
Description: >-
9696
ARN of the Batch Job Queue to use for high priority workflow tasks.
97-
97+
9898
TemplateRootUrl:
9999
Type: String
100100
Description: >-
@@ -109,7 +109,7 @@ Conditions:
109109
Fn::Equals:
110110
- !Ref S3NextflowBucketName
111111
- !Ref S3DataBucketName
112-
112+
113113
BuildNextflowContainer:
114114
Fn::Equals:
115115
- !Ref NextflowContainerImage
@@ -134,7 +134,7 @@ Resources:
134134
- ServerSideEncryptionByDefault:
135135
SSEAlgorithm: AES256
136136
Tags: !FindInMap ["TagMap", "default", "tags"]
137-
137+
138138
ContainerBuildNextflow:
139139
Type: AWS::CloudFormation::Stack
140140
Condition: BuildNextflowContainer
@@ -148,7 +148,7 @@ Resources:
148148
ProjectBuildSpecFile: ./src/containers/buildspec-nextflow.yml
149149
CreateBatchJobDefinition: "No"
150150
Tags: !FindInMap ["TagMap", "default", "tags"]
151-
151+
152152
IAMNextflowJobRole:
153153
Type: AWS::IAM::Role
154154
Properties:
@@ -164,9 +164,9 @@ Resources:
164164
Action:
165165
- "batch:List*"
166166
- "batch:Describe*"
167-
167+
168168
# only permit access (job submission) to the queues and compute environments
169-
# configured to run nextflow
169+
# configured to run nextflow
170170
- Sid: "BatchWriteAccessAllowJobSubmission"
171171
Effect: Allow
172172
Resource:
@@ -175,12 +175,13 @@ Resources:
175175
- arn:aws:batch:*:*:job-definition/nf-*:*
176176
Action:
177177
- "batch:*Job"
178-
178+
179179
# nextflow needs to be able to create job definitions
180180
# these are prefixed with "nf-"
181181
- Sid: "BatchWriteAccessAllowJobDefinition"
182182
Effect: Allow
183183
Resource:
184+
- arn:aws:batch:*:*:job-definition/nf-*
184185
- arn:aws:batch:*:*:job-definition/nf-*:*
185186
Action:
186187
- "batch:*JobDefinition"
@@ -219,7 +220,7 @@ Resources:
219220
Type: AWS::Batch::JobDefinition
220221
Properties:
221222
Type: container
222-
ContainerProperties:
223+
ContainerProperties:
223224
Memory: 1024
224225
JobRoleArn: !GetAtt IAMNextflowJobRole.Arn
225226
Vcpus: 2
@@ -232,24 +233,24 @@ Resources:
232233
- Name: "NF_JOB_QUEUE"
233234
Value: !Ref BatchDefaultJobQueue
234235
- Name: "NF_LOGSDIR"
235-
Value:
236-
Fn::Join:
236+
Value:
237+
Fn::Join:
237238
- "/"
238239
- - Fn::If:
239240
- DataBucketIsNextflowBucket
240241
- !Join ["/", [!Sub "s3://${S3NextflowBucketName}", !Ref S3NextflowPrefix]]
241242
- !Sub "s3://${S3NextflowBucketName}"
242243
- !Ref S3LogsDirPrefix
243244
- Name: "NF_WORKDIR"
244-
Value:
245-
Fn::Join:
245+
Value:
246+
Fn::Join:
246247
- "/"
247248
- - Fn::If:
248249
- DataBucketIsNextflowBucket
249250
- !Join ["/", [!Sub "s3://${S3NextflowBucketName}", !Ref S3NextflowPrefix]]
250251
- !Sub "s3://${S3NextflowBucketName}"
251252
- !Ref S3WorkDirPrefix
252-
253+
253254
JobDefinitionName: nextflow
254255

255256

@@ -262,7 +263,7 @@ Outputs:
262263
- NextflowBucketDoesNotExist
263264
- !Ref S3NextflowBucket
264265
- !Ref S3NextflowBucketName
265-
266+
266267
LogsDir:
267268
Description: >-
268269
S3 URI where nextflow session cache and logs are stored.
@@ -279,7 +280,7 @@ Outputs:
279280
Description: >-
280281
S3 URI where workflow intermediate results are stored.
281282
Value:
282-
Fn::Join:
283+
Fn::Join:
283284
- "/"
284285
- - Fn::If:
285286
- DataBucketIsNextflowBucket
@@ -300,9 +301,9 @@ Outputs:
300301
Description: >-
301302
Batch Job Definition that creates a nextflow head node for running workflows
302303
Value: !Ref BatchNextflowJobDefinition
303-
304+
304305
NextflowJobRole:
305306
Description: >-
306307
IAM Role that allows the nextflow head node job access to S3 and Batch
307308
Value: !GetAtt IAMNextflowJobRole.Arn
308-
...
309+
...

0 commit comments

Comments
 (0)