feat(lambda): add s3 object storage mode#38278
Open
antespajic wants to merge 4 commits into
Open
Conversation
antespajic
force-pushed
the
feat/lambda-s3-object-storage-mode
branch
from
July 9, 2026 19:57
a9ddd1c to
d6ae97d
Compare
aws-cdk-automation
temporarily deployed
to
automation
July 13, 2026 16:48 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 13, 2026 16:48 — with
GitHub Actions
Inactive
licjun
approved these changes
Jul 13, 2026
aws-cdk-automation
temporarily deployed
to
automation
July 13, 2026 22:48 — with
GitHub Actions
Inactive
licjun
reviewed
Jul 15, 2026
licjun
reviewed
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
Closes #38260.
Reason for this change
Lambda supports self-managed S3 code storage through
S3ObjectStorageMode, but the Lambda L2 constructs did not expose it. Customers had to use L1 escape hatches to configure functions and layers to reference code directly from their own S3 bucket.Description of changes
Add
S3ObjectStorageModeand exposes3ObjectStorageModeonCode.fromBucketV2()options. The setting is carried throughCodeConfigand rendered into bothCfnFunction.CodeProperty.s3ObjectStorageModeandCfnLayerVersion.ContentProperty.s3ObjectStorageMode.REFERENCErequires an S3 object version, soS3CodeV2now validates thatobjectVersionis set for that mode. This covers bothCode.fromBucketV2()and directnew S3CodeV2(...)usage.The generated L1 model already contains
s3ObjectStorageModefor Function and LayerVersion, so this does not useaddPropertyOverride.cloudformation-validatestill lags the generated L1 model for this property, so the validator plugin ignores only the two exact LambdaF3002diagnostics instead of adding a broad construct-level acknowledgement.Describe any new or updated permissions being added
No new permissions are automatically added by the L2 API. When using
S3ObjectStorageMode.REFERENCE, the source bucket policy must allow the Lambda service principal to read the referenced object/version; the README and integ test show this requirement.Description of how you validated changes
NX_DAEMON=false npx lerna run build --scope=aws-cdk-lib --streamnpx jest aws-lambda/test/code.test.ts aws-lambda/test/function.test.ts aws-lambda/test/layers.test.ts --coverage=falsenpx integ-runner --language javascript --directory test/aws-lambda/test integ.lambda-s3-object-storage-mode.js --dry-run --update-on-failed --force --strictgit diff --check HEAD^ HEADChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license