-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudRelated to Amazon Elastic Compute CloudbugThis 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
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
yuki549 and mmieluchlaurelmay
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudRelated to Amazon Elastic Compute CloudbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp2