Skip to content

Commit 478113d

Browse files
authored
feat(bootstrap): Add ECR resource policy for emr-serverless containers (#112)
This PR modifies the default bootstrap template to support EMR Serverless containers. Without this policy, containers created using the `DockerImageAsset` construct cannot be used with EMR Serverless applications. There is precedence for this pattern to support Lambda function containers, so I don't think this should be too controversial of a change. Relevant documentation on using custom images in EMR Serverless: - https://docs.aws.amazon.com/emr/latest/EMR-Serverless-UserGuide/application-custom-image.html By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent a48d3db commit 478113d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/aws-cdk/lib/api/bootstrap/bootstrap-template.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,19 @@ Resources:
278278
Condition:
279279
StringLike:
280280
"aws:sourceArn": { "Fn::Sub": "arn:${AWS::Partition}:lambda:${AWS::Region}:${AWS::AccountId}:function:*" }
281+
# Necessary for EMR Serverless container images
282+
# https://docs.aws.amazon.com/emr/latest/EMR-Serverless-UserGuide/application-custom-image.html#access-repo
283+
- Sid: EmrServerlessImageRetrievalPolicy
284+
Effect: Allow
285+
Principal:
286+
Service: emr-serverless.amazonaws.com
287+
Action:
288+
- ecr:BatchGetImage
289+
- ecr:GetDownloadUrlForLayer
290+
- ecr:DescribeImages
291+
Condition:
292+
StringLike:
293+
"aws:sourceArn": { "Fn::Sub": "arn:${AWS::Partition}:emr-serverless:${AWS::Region}:${AWS::AccountId}:/applications/*" }
281294
FilePublishingRole:
282295
Type: AWS::IAM::Role
283296
Properties:
@@ -659,7 +672,7 @@ Resources:
659672
Type: String
660673
Name:
661674
Fn::Sub: '/cdk-bootstrap/${Qualifier}/version'
662-
Value: '26'
675+
Value: '27'
663676
Outputs:
664677
BucketName:
665678
Description: The name of the S3 bucket owned by the CDK toolkit stack

0 commit comments

Comments
 (0)