-
Notifications
You must be signed in to change notification settings - Fork 4.3k
chore(s3-deployment): increase default memory limit from 128MB to 512MB #35501
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This review is outdated)
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Comments on closed issues and PRs are hard for our team to see. |
As discussed #35487 (comment) changing this default value would be a breaking change, I think we should introduce a feature flag for that. |
packages/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.ts
Outdated
Show resolved
Hide resolved
5dcc65b
to
4a99c01
Compare
- Update BucketDeployment default memory limit from 128MB to 512MB for better S3 sync performance - Add test to verify new default memory behavior - Update documentation to reflect new default - Maintain backward compatibility for explicit memory configurations Fixes aws#35487
- Add @aws-cdk/aws-s3-deployment:defaultMemoryLimit feature flag - When enabled: uses 512MB default memory (performance optimized) - When disabled: uses 128MB default memory (legacy behavior) - Maintains full backward compatibility - Users can still override with explicit memoryLimit values - Addresses PR feedback about breaking changes Closes aws#35487
…test - Add new feature flag to expected defaults in features.test.ts - Feature flag defaults to false (disabled) for backward compatibility - Fixes CI test failure for feature flag defaults validation
4a06ffc
to
9fdf3b5
Compare
a1c9598
to
53f0324
Compare
Issue # (if applicable)
Closes #35487.
Reason for this change
The BucketDeployment construct's Lambda custom resource uses a default memory limit of 128MB, which causes extremely poor S3 sync performance (10s of KB/s) and deployment timeouts. Users reported 15-minute timeouts when deploying typical static website assets, making the construct unreliable for production use without manual memory configuration.
Description of changes
Introduced a feature flag
@aws-cdk/aws-s3-deployment:use512MbMemory
to increase the default memory limit for BucketDeployment Lambda custom resource from 128MB to 512MB, providing dramatically improved S3 sync performance out of the box while maintaining backward compatibility.Key Changes:
@aws-cdk/aws-s3-deployment:use512MbMemory
(enabled by default in recommended-feature-flags.json)no explicit memory limit when feature flag is disabled
- verifies no MemorySize property is setdefault memory limit is 512MB when feature flag is enabled
- verifies MemorySize: 512Describe any new or updated permissions being added
N/A - No IAM permissions or resource access changes. This is purely a Lambda memory configuration adjustment controlled by a feature flag.
Description of how you validated changes
Unit tests:
Integration tests:
Feature flag testing:
Build verification:
Performance validation:
Implementation Details
The implementation follows the feature flag pattern where:
memoryLimit
is explicitly provided, use that valueundefined
(Lambda default 128MB)This ensures backward compatibility while providing better defaults for new deployments.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license