Describe the bug
With keyName property being deprecated (#28138), creating aws_ec2.KeyPair and passing it to aws_ec2.Instance does nothing.
Expected Behavior
Make sure the keypair is associated with the instance when passed through keyPair property.
Current Behavior
keypair does not get associated with the instance.
Reproduction Steps
const keyPair = new ec2.KeyPair(this, 'KeyPair', {});
this.instance = new ec2.Instance(this, 'EC2Instance', {
vpc: props.vpc,
vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
securityGroup,
instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
keyPair,
userDataCausesReplacement: true,
ssmSessionPermissions: true,
});
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.116.1 (build 222de71)
Framework Version
No response
Node.js Version
20.10.0
OS
Linux
Language
TypeScript
Language Version
No response
Other information
No response
Describe the bug
With keyName property being deprecated (#28138), creating aws_ec2.KeyPair and passing it to aws_ec2.Instance does nothing.
Expected Behavior
Make sure the keypair is associated with the instance when passed through keyPair property.
Current Behavior
keypair does not get associated with the instance.
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.116.1 (build 222de71)
Framework Version
No response
Node.js Version
20.10.0
OS
Linux
Language
TypeScript
Language Version
No response
Other information
No response