Skip to content

feat(autoscaling): kmsKey for EBS block devices - #38497

Open
vishwakt wants to merge 1 commit into
aws:mainfrom
vishwakt:feat/autoscaling-ebs-kms-key
Open

feat(autoscaling): kmsKey for EBS block devices#38497
vishwakt wants to merge 1 commit into
aws:mainfrom
vishwakt:feat/autoscaling-ebs-kms-key

Conversation

@vishwakt

@vishwakt vishwakt commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #38472.

Reason for this change

aws-autoscaling's EbsDeviceOptions has no kmsKey, so an ASG can only encrypt block devices with the default aws/ebs key. The aws-ec2 equivalent has supported a customer managed key for some time.

Description of changes

  • kmsKey?: IKey on the autoscaling EbsDeviceOptions. blockDevices are passed to the internal ec2.LaunchTemplate, whose ebs-util already renders KmsKeyId, so no new rendering code is needed.
  • EbsDeviceProps now extends EbsDeviceOptions as well as EbsDeviceSnapshotOptions, matching the aws-ec2 hierarchy. Previously encrypted reached the template at runtime without being on the type. Additive, yarn compat passes.
  • Launch configurations have no KmsKeyId on block devices, so setting kmsKey without the @aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig feature flag now throws instead of silently encrypting with the default key.
  • README section and an integ test with snapshot.

Describe any new or updated permissions being added

None. The key policy must allow the Auto Scaling service to use the key; this is noted in the README and the property docs.

Description of how you validated changes

Three unit tests: KmsKeyId renders on the launch template, KmsKeyId is absent when kmsKey is unset, and the launch-configuration path throws. All 203 autoscaling tests pass. New integ test integ.asg-block-device-kms-key with snapshot generated by integ-runner in dry-run mode. yarn build, yarn compat, eslint and Rosetta are clean.

Checklist


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

The autoscaling EbsDeviceOptions had no kmsKey property, so an Auto
Scaling group could only encrypt block devices with the default aws/ebs
key, while the equivalent ec2 interface has supported a customer managed
key for some time.

Adds kmsKey to the autoscaling EbsDeviceOptions. Block devices are passed
straight to the internal ec2.LaunchTemplate, which already renders
KmsKeyId, so no additional rendering is needed on the launch template
path. EbsDeviceProps now also extends EbsDeviceOptions, matching the ec2
struct hierarchy, so that encrypted and kmsKey are part of the type
rather than only present at runtime.

Launch configurations have no KmsKeyId property on block devices, so
setting kmsKey without the
@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig
feature flag now raises a validation error rather than silently
encrypting with the default key.

Closes aws#38472.
@github-actions github-actions Bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Aug 5, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team August 5, 2026 05:10
@github-actions github-actions Bot added feature-request A feature should be added or improved. p2 labels Aug 5, 2026
@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Aug 5, 2026
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Aug 5, 2026
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 feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-autoscaling: the ability to set an kmsKey for encryption of ebs volumes

2 participants