Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lambda-layer-awscli): s3-deployment, stepfunctions-tasks, eks constructs create multiple identical AwsCliLayers (#32907) #33085

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wimlewis-amazon
Copy link

@wimlewis-amazon wimlewis-amazon commented Jan 23, 2025

Fixes #32907

Reason for this change

Multiple identical and possibly unused AwsCliLayers in a single stack are wasteful, and can cause deployments to fail if Lambda throttles layer creation requests.

Description of changes

  1. Created a utility method AwsCliLayer.getOrCreate() for getting or creating the singleton layer construct
  2. Updated callers to use it
  • aws-s3-deployment (the motivating caller)
  • aws-eks and aws-eks-v2-alpha
  • aws-stepfunctions-tasks

As a result of this change, the single AwsCliLayer is now created at the root of the stack, instead of each one being created near the construct that uses it. This requires changes to the test expectations which depend on the logical ID of the AwsCliLayer resource.

Describe any new or updated permissions being added

None

Description of how you validated changes

Added unit tests to cover new cases in aws-s3-deployments. Updated unit tests in other cdk modules.

The snapshot tests also need to be updated. I've run yarn integ and verified that the changes are all expected, but I'm not sure what the proper way to update the snapshots in git is.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Jan 23, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team January 23, 2025 03:22
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

…structs create multiple identical AwsCliLayers (aws#32907)

Created a utility method AwsCliLayer.getOrCreate() for getting or creating
the singleton layer construct; updated callers to use it. As a result, all
built-in constructs needing this layer will share a single construct at the
root of the stack.

Fixes aws#32907
@wimlewis-amazon wimlewis-amazon changed the title fix(s3-deployment,stepfunctions-tasks,eks): cdk creates multiple identical, unused AwsCliLayers (#32907) fix(lambda-layer-awscli): s3-deployment, stepfunctions-tasks, eks constructs create multiple identical AwsCliLayers (#32907) Jan 24, 2025
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 637d499
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@wimlewis-amazon wimlewis-amazon marked this pull request as ready for review January 24, 2025 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BucketDeployment creates multiple identical, unused AwsCliLayers
2 participants