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

Commit 27b7b62

Browse files
committed
Fix IAM permissions and clean up user-data
1 parent 78d85ab commit 27b7b62

File tree

3 files changed

+29
-28
lines changed

3 files changed

+29
-28
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ packages:
4545
runcmd:
4646
- curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
4747
- unzip -q /tmp/awscliv2.zip -d /tmp
48-
- sudo /tmp/aws/install
48+
- /tmp/aws/install
4949
- cd /opt && wget https://aws-genomics-workflows.s3.amazonaws.com/artifacts/aws-ebs-autoscale.tgz && tar -xzf aws-ebs-autoscale.tgz
5050
- sh /opt/ebs-autoscale/bin/init-ebs-autoscale.sh /scratch /dev/sdc 2>&1 > /var/log/init-ebs-autoscale.log
5151
# you can add more commands here if you have additional provisioning steps

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Resources:
154154
runcmd:
155155
- curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
156156
- unzip -q /tmp/awscliv2.zip -d /tmp
157-
- sudo /tmp/aws/install
157+
- /tmp/aws/install
158158
- export scratchPath="${ScratchMountPoint}"
159159
- export artifactRootUrl="${ArtifactRootUrl}"
160160
- start amazon-ssm-agent

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)