-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
@aws-cdk/aws-autoscalingRelated to Amazon EC2 Auto ScalingRelated to Amazon EC2 Auto ScalingbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp2
Description
Describe the bug
Using the KeyName to specify a key pair will be deprecated on the launchTemplateProps construct.
When using KeyName
on autoScalingGroupProps, CDK gives the following warning on synth:
[WARNING] aws-cdk-lib.aws_ec2.LaunchTemplateProps#keyName is deprecated.
- Use `keyPair` instead - https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2-readme.html#using-an-existing-ec2-key-pair
This API will be removed in the next major release.
Presumably autoScalingGroupProps uses launchTemplateProps underneath. autoScalingGroupProps should have a KeyPair
property that is passed to the underlying launchTemplateProps.
Expected Behavior
autoScalingGroupProps should have a KeyPair
property that is passed to the underlying launchTemplateProps.
Current Behavior
[WARNING] aws-cdk-lib.aws_ec2.LaunchTemplateProps#keyName is deprecated.
- Use `keyPair` instead - https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2-readme.html#using-an-existing-ec2-key-pair
This API will be removed in the next major release.
Reproduction Steps
var asg = new AutoScalingGroup(this, "Asg", new AutoScalingGroupProps() {
Vpc = props.Vpc,
VpcSubnets = new SubnetSelection() {
AvailabilityZones = props.AvailabilityZone is not null
? new[] { props.AvailabilityZone }
: null,
},
InstanceType = InstanceType.Of(InstanceClass.T3A, InstanceSize.MEDIUM),
MachineImage = EcsOptimizedImage.AmazonLinux2023(),
SecurityGroup = instanceSg,
KeyName = props.Ec2KeyPair, // <-- This
});
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.129.0 (build d5ab0df)
Framework Version
No response
Node.js Version
v18.16.1
OS
MacOS
Language
.NET
Language Version
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-autoscalingRelated to Amazon EC2 Auto ScalingRelated to Amazon EC2 Auto ScalingbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp2