feat(s3): BucketEncryption Mixin for S3 server-side encryption#37208
Draft
feat(s3): BucketEncryption Mixin for S3 server-side encryption#37208
BucketEncryption Mixin for S3 server-side encryption#37208Conversation
aws-cdk-automation
previously requested changes
Mar 9, 2026
ec73deb to
7c825c7
Compare
7c825c7 to
e6cf199
Compare
e6cf199 to
1e22110
Compare
BucketEncryption Mixin for S3 server-side encryption
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
1e22110 to
9fe051b
Compare
rix0rrr
approved these changes
Mar 16, 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.
Reason for this change
The mixin codegen for specialized type-based mixins was living in
mixins-preview, which is being phased out. This type of codegen needs to live inspec2cdkand generate output directly intoaws-cdk-libservice modules.The first mixin generated this way is
BucketEncryptionfor S3, which provides a type-safe way to configure server-side encryption with full KMS key relationship resolution.Description of changes
Introduces a new
type-mixinscodegen system inspec2cdkthat generates specialized mixins from CloudFormation type definitions. Unlike the existingcfn-prop-mixins(which generate a mixin per resource with all properties), type-mixins focus on a single complex type and generate a dedicated mixin class with nested types, enums, and relationship-resolving flatten functions.The codegen follows the same class-based pattern as
L1PropsMixinandResourceClass— aTypeMixinbase class extendsClassTypewith abuild()method.BucketEncryptionMixinis the first concrete implementation.The generated
BucketEncryptionmixin delegates property assignment to the internalCfnPropsMixinwith an override merge strategy, keeping the generated code thin while reusing existing infrastructure.An
isGeneratedMixinTypecheck was added to awslint'sCoreTypesto generically skipprops-default-docfor types in themixinsnamespace that come from.generated.tsfiles with@stability external. This avoids per-property exclusions inawslint.json.Describe any new or updated permissions being added
N/A
Description of how you validated changes
9 unit tests covering
BucketEncryptionmixin: supports/rejects constructs, AES256, KMS with string key, KMS withIKeyRef, bucket key enabled, L2.with(), enum values. All pass. Fullyarn buildof spec2cdk, awslint, and aws-cdk-lib passes with 0 errors.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license