From 805a00713751952cca827c0498fec755475d1aa9 Mon Sep 17 00:00:00 2001 From: Tatsuya Mori Date: Thu, 26 Oct 2023 16:50:17 +0000 Subject: [PATCH 1/2] fix(ec2): AmazonLinuxImage construct generates incorrect SSM parameter name for AL2023 images --- .../integ.machine-image.js.snapshot/cdk.out | 2 +- .../integ-ec2-machine-image-test.assets.json | 6 +- ...integ-ec2-machine-image-test.template.json | 285 ++++++--- .../integ.json | 2 +- ...efaultTestDeployAssert24D5C536.assets.json | 2 +- .../manifest.json | 43 +- .../integ.machine-image.js.snapshot/tree.json | 540 ++++++++++++------ .../test/aws-ec2/test/integ.machine-image.ts | 13 +- .../lib/machine-image/machine-image.ts | 20 +- .../aws-ec2/test/machine-image.test.ts | 33 +- 10 files changed, 671 insertions(+), 275 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/cdk.out index f0b901e7c06e5..2313ab5436501 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"32.0.0"} \ No newline at end of file +{"version":"34.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.assets.json index 8970273b9f75a..65ef1b2b46842 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.assets.json @@ -1,7 +1,7 @@ { - "version": "32.0.0", + "version": "34.0.0", "files": { - "fa6690179ed0aff2d045f19741af965ccdb151c74c58ea99393b00c3d47ceed9": { + "d898789343437c2eb73edab3927044683b15ba7ce606b73961dcbfe73604deea": { "source": { "path": "integ-ec2-machine-image-test.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "fa6690179ed0aff2d045f19741af965ccdb151c74c58ea99393b00c3d47ceed9.json", + "objectKey": "d898789343437c2eb73edab3927044683b15ba7ce606b73961dcbfe73604deea.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.template.json index aa53f951e2f90..d1431244918c4 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.template.json @@ -18,9 +18,6 @@ "VpcPublicSubnet1Subnet5C2D37C4": { "Type": "AWS::EC2::Subnet", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "AvailabilityZone": "test-region-1a", "CidrBlock": "10.0.0.0/19", "MapPublicIpOnLaunch": true, @@ -37,21 +34,24 @@ "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PublicSubnet1" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPublicSubnet1RouteTable6C95E38E": { "Type": "AWS::EC2::RouteTable", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "Tags": [ { "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PublicSubnet1" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPublicSubnet1RouteTableAssociation97140677": { @@ -68,12 +68,12 @@ "VpcPublicSubnet1DefaultRoute3DA9E72A": { "Type": "AWS::EC2::Route", "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, "DestinationCidrBlock": "0.0.0.0/0", "GatewayId": { "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" } }, "DependsOn": [ @@ -95,15 +95,15 @@ "VpcPublicSubnet1NATGateway4D7517AA": { "Type": "AWS::EC2::NatGateway", "Properties": { - "SubnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - }, "AllocationId": { "Fn::GetAtt": [ "VpcPublicSubnet1EIPD7E02669", "AllocationId" ] }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, "Tags": [ { "Key": "Name", @@ -119,9 +119,6 @@ "VpcPublicSubnet2Subnet691E08A3": { "Type": "AWS::EC2::Subnet", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "AvailabilityZone": "test-region-1b", "CidrBlock": "10.0.32.0/19", "MapPublicIpOnLaunch": true, @@ -138,21 +135,24 @@ "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PublicSubnet2" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPublicSubnet2RouteTable94F7E489": { "Type": "AWS::EC2::RouteTable", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "Tags": [ { "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PublicSubnet2" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPublicSubnet2RouteTableAssociationDD5762D8": { @@ -169,12 +169,12 @@ "VpcPublicSubnet2DefaultRoute97F91067": { "Type": "AWS::EC2::Route", "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, "DestinationCidrBlock": "0.0.0.0/0", "GatewayId": { "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" } }, "DependsOn": [ @@ -196,15 +196,15 @@ "VpcPublicSubnet2NATGateway9182C01D": { "Type": "AWS::EC2::NatGateway", "Properties": { - "SubnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - }, "AllocationId": { "Fn::GetAtt": [ "VpcPublicSubnet2EIP3C605A87", "AllocationId" ] }, + "SubnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, "Tags": [ { "Key": "Name", @@ -220,9 +220,6 @@ "VpcPublicSubnet3SubnetBE12F0B6": { "Type": "AWS::EC2::Subnet", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "AvailabilityZone": "test-region-1c", "CidrBlock": "10.0.64.0/19", "MapPublicIpOnLaunch": true, @@ -239,21 +236,24 @@ "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PublicSubnet3" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPublicSubnet3RouteTable93458DBB": { "Type": "AWS::EC2::RouteTable", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "Tags": [ { "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PublicSubnet3" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPublicSubnet3RouteTableAssociation1F1EDF02": { @@ -270,12 +270,12 @@ "VpcPublicSubnet3DefaultRoute4697774F": { "Type": "AWS::EC2::Route", "Properties": { - "RouteTableId": { - "Ref": "VpcPublicSubnet3RouteTable93458DBB" - }, "DestinationCidrBlock": "0.0.0.0/0", "GatewayId": { "Ref": "VpcIGWD7BA715C" + }, + "RouteTableId": { + "Ref": "VpcPublicSubnet3RouteTable93458DBB" } }, "DependsOn": [ @@ -297,15 +297,15 @@ "VpcPublicSubnet3NATGateway7640CD1D": { "Type": "AWS::EC2::NatGateway", "Properties": { - "SubnetId": { - "Ref": "VpcPublicSubnet3SubnetBE12F0B6" - }, "AllocationId": { "Fn::GetAtt": [ "VpcPublicSubnet3EIP3A666A23", "AllocationId" ] }, + "SubnetId": { + "Ref": "VpcPublicSubnet3SubnetBE12F0B6" + }, "Tags": [ { "Key": "Name", @@ -321,9 +321,6 @@ "VpcPrivateSubnet1Subnet536B997A": { "Type": "AWS::EC2::Subnet", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "AvailabilityZone": "test-region-1a", "CidrBlock": "10.0.96.0/19", "MapPublicIpOnLaunch": false, @@ -340,21 +337,24 @@ "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet1" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPrivateSubnet1RouteTableB2C5B500": { "Type": "AWS::EC2::RouteTable", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "Tags": [ { "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet1" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { @@ -371,21 +371,18 @@ "VpcPrivateSubnet1DefaultRouteBE02A9ED": { "Type": "AWS::EC2::Route", "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, "DestinationCidrBlock": "0.0.0.0/0", "NatGatewayId": { "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" } } }, "VpcPrivateSubnet2Subnet3788AAA1": { "Type": "AWS::EC2::Subnet", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "AvailabilityZone": "test-region-1b", "CidrBlock": "10.0.128.0/19", "MapPublicIpOnLaunch": false, @@ -402,21 +399,24 @@ "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet2" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPrivateSubnet2RouteTableA678073B": { "Type": "AWS::EC2::RouteTable", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "Tags": [ { "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet2" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPrivateSubnet2RouteTableAssociationA89CAD56": { @@ -433,21 +433,18 @@ "VpcPrivateSubnet2DefaultRoute060D2087": { "Type": "AWS::EC2::Route", "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, "DestinationCidrBlock": "0.0.0.0/0", "NatGatewayId": { "Ref": "VpcPublicSubnet2NATGateway9182C01D" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" } } }, "VpcPrivateSubnet3SubnetF258B56E": { "Type": "AWS::EC2::Subnet", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "AvailabilityZone": "test-region-1c", "CidrBlock": "10.0.160.0/19", "MapPublicIpOnLaunch": false, @@ -464,21 +461,24 @@ "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet3" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPrivateSubnet3RouteTableD98824C7": { "Type": "AWS::EC2::RouteTable", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "Tags": [ { "Key": "Name", "Value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet3" } - ] + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } } }, "VpcPrivateSubnet3RouteTableAssociation16BDDC43": { @@ -495,12 +495,12 @@ "VpcPrivateSubnet3DefaultRoute94B74F0D": { "Type": "AWS::EC2::Route", "Properties": { - "RouteTableId": { - "Ref": "VpcPrivateSubnet3RouteTableD98824C7" - }, "DestinationCidrBlock": "0.0.0.0/0", "NatGatewayId": { "Ref": "VpcPublicSubnet3NATGateway7640CD1D" + }, + "RouteTableId": { + "Ref": "VpcPrivateSubnet3RouteTableD98824C7" } } }, @@ -518,11 +518,11 @@ "VpcVPCGWBF912B6E": { "Type": "AWS::EC2::VPCGatewayAttachment", "Properties": { - "VpcId": { - "Ref": "Vpc8378EB38" - }, "InternetGatewayId": { "Ref": "VpcIGWD7BA715C" + }, + "VpcId": { + "Ref": "Vpc8378EB38" } } }, @@ -708,13 +708,104 @@ "al2023InstanceRoleECC2D6DD" ] }, + "al2023withminimalAMIInstanceSecurityGroupB3378C30": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + } + ], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "al2023withminimalAMIInstanceRole6BA4B2B7": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ec2.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "Tags": [ + { + "Key": "Name", + "Value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + } + ] + } + }, + "al2023withminimalAMIInstanceProfile9DC9359F": { + "Type": "AWS::IAM::InstanceProfile", + "Properties": { + "Roles": [ + { + "Ref": "al2023withminimalAMIInstanceRole6BA4B2B7" + } + ] + } + }, + "al2023withminimalAMIF0D18F9E": { + "Type": "AWS::EC2::Instance", + "Properties": { + "AvailabilityZone": "test-region-1a", + "IamInstanceProfile": { + "Ref": "al2023withminimalAMIInstanceProfile9DC9359F" + }, + "ImageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amiminimalkernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "InstanceType": "t3.nano", + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "al2023withminimalAMIInstanceSecurityGroupB3378C30", + "GroupId" + ] + } + ], + "SubnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + "Tags": [ + { + "Key": "Name", + "Value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + } + ], + "UserData": { + "Fn::Base64": "#!/bin/bash" + } + }, + "DependsOn": [ + "al2023withminimalAMIInstanceRole6BA4B2B7" + ] + }, "AmiParameter": { "Type": "AWS::SSM::Parameter", "Properties": { - "Type": "String", - "Value": "ami-06ca3ca175f37dd66", "DataType": "aws:ec2:image", - "Name": "myAmi" + "Name": "myAmi", + "Type": "String", + "Value": "ami-06ca3ca175f37dd66" } }, "ssmresolveinstanceInstanceSecurityGroupEACCDB27": { @@ -779,7 +870,17 @@ "IamInstanceProfile": { "Ref": "ssmresolveinstanceInstanceProfileAD70EB72" }, - "ImageId": "resolve:ssm:myAmi", + "ImageId": { + "Fn::Join": [ + "", + [ + "resolve:ssm:", + { + "Ref": "AmiParameter" + } + ] + ] + }, "InstanceType": "t3.nano", "SecurityGroupIds": [ { @@ -810,7 +911,17 @@ "Type": "AWS::EC2::LaunchTemplate", "Properties": { "LaunchTemplateData": { - "ImageId": "resolve:ssm:myAmi", + "ImageId": { + "Fn::Join": [ + "", + [ + "resolve:ssm:", + { + "Ref": "AmiParameter" + } + ] + ] + }, "InstanceType": "t3.nano", "TagSpecifications": [ { @@ -852,8 +963,6 @@ "ASG46ED3070": { "Type": "AWS::AutoScaling::AutoScalingGroup", "Properties": { - "MaxSize": "1", - "MinSize": "1", "DesiredCapacity": "1", "LaunchTemplate": { "LaunchTemplateId": { @@ -866,6 +975,8 @@ ] } }, + "MaxSize": "1", + "MinSize": "1", "VPCZoneIdentifier": [ { "Ref": "VpcPrivateSubnet1Subnet536B997A" @@ -894,6 +1005,10 @@ "Type": "AWS::SSM::Parameter::Value", "Default": "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64" }, + "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amiminimalkernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/aws/service/ami-amazon-linux-latest/al2023-ami-minimal-kernel-6.1-x86_64" + }, "BootstrapVersion": { "Type": "AWS::SSM::Parameter::Value", "Default": "/cdk-bootstrap/hnb659fds/version", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ.json index 643997436cc45..e6084237f0c1b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ.json @@ -1,6 +1,6 @@ { "enableLookups": true, - "version": "32.0.0", + "version": "34.0.0", "testCases": { "integ-test/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json index 4b008a0cae838..2b470996152e4 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integtestDefaultTestDeployAssert24D5C536.assets.json @@ -1,5 +1,5 @@ { - "version": "32.0.0", + "version": "34.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/manifest.json index 11315c671f6a8..12d1d1a2a1b56 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "32.0.0", + "version": "34.0.0", "artifacts": { "integ-ec2-machine-image-test.assets": { "type": "cdk:asset-manifest", @@ -14,10 +14,11 @@ "environment": "aws://unknown-account/unknown-region", "properties": { "templateFile": "integ-ec2-machine-image-test.template.json", + "terminationProtection": false, "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fa6690179ed0aff2d045f19741af965ccdb151c74c58ea99393b00c3d47ceed9.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d898789343437c2eb73edab3927044683b15ba7ce606b73961dcbfe73604deea.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -291,6 +292,36 @@ "data": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" } ], + "/integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "al2023withminimalAMIInstanceSecurityGroupB3378C30" + } + ], + "/integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "al2023withminimalAMIInstanceRole6BA4B2B7" + } + ], + "/integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceProfile": [ + { + "type": "aws:cdk:logicalId", + "data": "al2023withminimalAMIInstanceProfile9DC9359F" + } + ], + "/integ-ec2-machine-image-test/al2023 with minimal AMI/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "al2023withminimalAMIF0D18F9E" + } + ], + "/integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ + { + "type": "aws:cdk:logicalId", + "data": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amiminimalkernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + } + ], "/integ-ec2-machine-image-test/AmiParameter": [ { "type": "aws:cdk:logicalId", @@ -318,7 +349,10 @@ "/integ-ec2-machine-image-test/ssm-resolve-instance/Resource": [ { "type": "aws:cdk:logicalId", - "data": "ssmresolveinstanceDC2C8573" + "data": "ssmresolveinstanceDC2C8573", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/integ-ec2-machine-image-test/LT/Resource": [ @@ -330,7 +364,7 @@ "/integ-ec2-machine-image-test/ASG": [ { "type": "aws:cdk:warning", - "data": "desiredCapacity has been configured. Be aware this will reset the size of your AutoScalingGroup on every deployment. See https://github.com/aws/aws-cdk/issues/5215" + "data": "desiredCapacity has been configured. Be aware this will reset the size of your AutoScalingGroup on every deployment. See https://github.com/aws/aws-cdk/issues/5215 [ack: @aws-cdk/aws-autoscaling:desiredCapacitySet]" } ], "/integ-ec2-machine-image-test/ASG/ASG": [ @@ -367,6 +401,7 @@ "environment": "aws://unknown-account/unknown-region", "properties": { "templateFile": "integtestDefaultTestDeployAssert24D5C536.template.json", + "terminationProtection": false, "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/tree.json index 385f4d493dce9..ca88eca4ae196 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/tree.json @@ -32,7 +32,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "PublicSubnet1": { @@ -45,9 +45,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "availabilityZone": "test-region-1a", "cidrBlock": "10.0.0.0/19", "mapPublicIpOnLaunch": true, @@ -64,12 +61,15 @@ "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PublicSubnet1" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Acl": { @@ -77,7 +77,7 @@ "path": "integ-ec2-machine-image-test/Vpc/PublicSubnet1/Acl", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTable": { @@ -86,20 +86,20 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "tags": [ { "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PublicSubnet1" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTableAssociation": { @@ -118,7 +118,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "DefaultRoute": { @@ -127,18 +127,18 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet1RouteTable6C95E38E" - }, "destinationCidrBlock": "0.0.0.0/0", "gatewayId": { "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "EIP": { @@ -158,7 +158,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "NATGateway": { @@ -167,15 +167,15 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "VpcPublicSubnet1Subnet5C2D37C4" - }, "allocationId": { "Fn::GetAtt": [ "VpcPublicSubnet1EIPD7E02669", "AllocationId" ] }, + "subnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, "tags": [ { "key": "Name", @@ -186,13 +186,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "PublicSubnet2": { @@ -205,9 +205,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "availabilityZone": "test-region-1b", "cidrBlock": "10.0.32.0/19", "mapPublicIpOnLaunch": true, @@ -224,12 +221,15 @@ "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PublicSubnet2" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Acl": { @@ -237,7 +237,7 @@ "path": "integ-ec2-machine-image-test/Vpc/PublicSubnet2/Acl", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTable": { @@ -246,20 +246,20 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "tags": [ { "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PublicSubnet2" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTableAssociation": { @@ -278,7 +278,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "DefaultRoute": { @@ -287,18 +287,18 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet2RouteTable94F7E489" - }, "destinationCidrBlock": "0.0.0.0/0", "gatewayId": { "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet2RouteTable94F7E489" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "EIP": { @@ -318,7 +318,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "NATGateway": { @@ -327,15 +327,15 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "VpcPublicSubnet2Subnet691E08A3" - }, "allocationId": { "Fn::GetAtt": [ "VpcPublicSubnet2EIP3C605A87", "AllocationId" ] }, + "subnetId": { + "Ref": "VpcPublicSubnet2Subnet691E08A3" + }, "tags": [ { "key": "Name", @@ -346,13 +346,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "PublicSubnet3": { @@ -365,9 +365,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "availabilityZone": "test-region-1c", "cidrBlock": "10.0.64.0/19", "mapPublicIpOnLaunch": true, @@ -384,12 +381,15 @@ "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PublicSubnet3" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Acl": { @@ -397,7 +397,7 @@ "path": "integ-ec2-machine-image-test/Vpc/PublicSubnet3/Acl", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTable": { @@ -406,20 +406,20 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "tags": [ { "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PublicSubnet3" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTableAssociation": { @@ -438,7 +438,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "DefaultRoute": { @@ -447,18 +447,18 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPublicSubnet3RouteTable93458DBB" - }, "destinationCidrBlock": "0.0.0.0/0", "gatewayId": { "Ref": "VpcIGWD7BA715C" + }, + "routeTableId": { + "Ref": "VpcPublicSubnet3RouteTable93458DBB" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "EIP": { @@ -478,7 +478,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "NATGateway": { @@ -487,15 +487,15 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", "aws:cdk:cloudformation:props": { - "subnetId": { - "Ref": "VpcPublicSubnet3SubnetBE12F0B6" - }, "allocationId": { "Fn::GetAtt": [ "VpcPublicSubnet3EIP3A666A23", "AllocationId" ] }, + "subnetId": { + "Ref": "VpcPublicSubnet3SubnetBE12F0B6" + }, "tags": [ { "key": "Name", @@ -506,13 +506,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "PrivateSubnet1": { @@ -525,9 +525,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "availabilityZone": "test-region-1a", "cidrBlock": "10.0.96.0/19", "mapPublicIpOnLaunch": false, @@ -544,12 +541,15 @@ "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet1" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Acl": { @@ -557,7 +557,7 @@ "path": "integ-ec2-machine-image-test/Vpc/PrivateSubnet1/Acl", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTable": { @@ -566,20 +566,20 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "tags": [ { "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet1" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTableAssociation": { @@ -598,7 +598,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "DefaultRoute": { @@ -607,24 +607,24 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" - }, "destinationCidrBlock": "0.0.0.0/0", "natGatewayId": { "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "PrivateSubnet2": { @@ -637,9 +637,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "availabilityZone": "test-region-1b", "cidrBlock": "10.0.128.0/19", "mapPublicIpOnLaunch": false, @@ -656,12 +653,15 @@ "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet2" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Acl": { @@ -669,7 +669,7 @@ "path": "integ-ec2-machine-image-test/Vpc/PrivateSubnet2/Acl", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTable": { @@ -678,20 +678,20 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "tags": [ { "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet2" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTableAssociation": { @@ -710,7 +710,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "DefaultRoute": { @@ -719,24 +719,24 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet2RouteTableA678073B" - }, "destinationCidrBlock": "0.0.0.0/0", "natGatewayId": { "Ref": "VpcPublicSubnet2NATGateway9182C01D" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet2RouteTableA678073B" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "PrivateSubnet3": { @@ -749,9 +749,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "availabilityZone": "test-region-1c", "cidrBlock": "10.0.160.0/19", "mapPublicIpOnLaunch": false, @@ -768,12 +765,15 @@ "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet3" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Acl": { @@ -781,7 +781,7 @@ "path": "integ-ec2-machine-image-test/Vpc/PrivateSubnet3/Acl", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTable": { @@ -790,20 +790,20 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "tags": [ { "key": "Name", "value": "integ-ec2-machine-image-test/Vpc/PrivateSubnet3" } - ] + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "RouteTableAssociation": { @@ -822,7 +822,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "DefaultRoute": { @@ -831,24 +831,24 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VpcPrivateSubnet3RouteTableD98824C7" - }, "destinationCidrBlock": "0.0.0.0/0", "natGatewayId": { "Ref": "VpcPublicSubnet3NATGateway7640CD1D" + }, + "routeTableId": { + "Ref": "VpcPrivateSubnet3RouteTableD98824C7" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "IGW": { @@ -867,7 +867,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "VPCGW": { @@ -876,23 +876,23 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", "aws:cdk:cloudformation:props": { - "vpcId": { - "Ref": "Vpc8378EB38" - }, "internetGatewayId": { "Ref": "VpcIGWD7BA715C" + }, + "vpcId": { + "Ref": "Vpc8378EB38" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "amzn2": { @@ -930,13 +930,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "InstanceRole": { @@ -948,7 +948,7 @@ "path": "integ-ec2-machine-image-test/amzn2/InstanceRole/ImportInstanceRole", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Resource": { @@ -979,13 +979,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "InstanceProfile": { @@ -1003,7 +1003,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Resource": { @@ -1044,13 +1044,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": { @@ -1058,7 +1058,7 @@ "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118": { @@ -1066,7 +1066,7 @@ "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "al2023": { @@ -1104,13 +1104,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "InstanceRole": { @@ -1122,7 +1122,7 @@ "path": "integ-ec2-machine-image-test/al2023/InstanceRole/ImportInstanceRole", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Resource": { @@ -1153,13 +1153,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "InstanceProfile": { @@ -1177,7 +1177,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Resource": { @@ -1218,13 +1218,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": { @@ -1232,7 +1232,7 @@ "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118": { @@ -1240,7 +1240,181 @@ "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" + } + }, + "al2023 with minimal AMI": { + "id": "al2023 with minimal AMI", + "path": "integ-ec2-machine-image-test/al2023 with minimal AMI", + "children": { + "InstanceSecurityGroup": { + "id": "InstanceSecurityGroup", + "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "tags": [ + { + "key": "Name", + "value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + } + ], + "vpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + }, + "InstanceRole": { + "id": "InstanceRole", + "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceRole", + "children": { + "ImportInstanceRole": { + "id": "ImportInstanceRole", + "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceRole/ImportInstanceRole", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "ec2.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "tags": [ + { + "key": "Name", + "value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + }, + "InstanceProfile": { + "id": "InstanceProfile", + "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceProfile", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", + "aws:cdk:cloudformation:props": { + "roles": [ + { + "Ref": "al2023withminimalAMIInstanceRole6BA4B2B7" + } + ] + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Instance", + "aws:cdk:cloudformation:props": { + "availabilityZone": "test-region-1a", + "iamInstanceProfile": { + "Ref": "al2023withminimalAMIInstanceProfile9DC9359F" + }, + "imageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amiminimalkernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "instanceType": "t3.nano", + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "al2023withminimalAMIInstanceSecurityGroupB3378C30", + "GroupId" + ] + } + ], + "subnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + }, + "tags": [ + { + "key": "Name", + "value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + } + ], + "userData": { + "Fn::Base64": "#!/bin/bash" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + }, + "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": { + "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", + "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" + } + }, + "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118": { + "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", + "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.70" } }, "AmiParameter": { @@ -1249,15 +1423,15 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::SSM::Parameter", "aws:cdk:cloudformation:props": { - "type": "String", - "value": "ami-06ca3ca175f37dd66", "dataType": "aws:ec2:image", - "name": "myAmi" + "name": "myAmi", + "type": "String", + "value": "ami-06ca3ca175f37dd66" } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "ssm-resolve-instance": { @@ -1295,13 +1469,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "InstanceRole": { @@ -1313,7 +1487,7 @@ "path": "integ-ec2-machine-image-test/ssm-resolve-instance/InstanceRole/ImportInstanceRole", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Resource": { @@ -1344,13 +1518,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "InstanceProfile": { @@ -1368,7 +1542,7 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "Resource": { @@ -1381,7 +1555,17 @@ "iamInstanceProfile": { "Ref": "ssmresolveinstanceInstanceProfileAD70EB72" }, - "imageId": "resolve:ssm:myAmi", + "imageId": { + "Fn::Join": [ + "", + [ + "resolve:ssm:", + { + "Ref": "AmiParameter" + } + ] + ] + }, "instanceType": "t3.nano", "securityGroupIds": [ { @@ -1407,13 +1591,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "LT": { @@ -1427,7 +1611,17 @@ "aws:cdk:cloudformation:type": "AWS::EC2::LaunchTemplate", "aws:cdk:cloudformation:props": { "launchTemplateData": { - "imageId": "resolve:ssm:myAmi", + "imageId": { + "Fn::Join": [ + "", + [ + "resolve:ssm:", + { + "Ref": "AmiParameter" + } + ] + ] + }, "instanceType": "t3.nano", "tagSpecifications": [ { @@ -1468,13 +1662,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "ASG": { @@ -1487,8 +1681,6 @@ "attributes": { "aws:cdk:cloudformation:type": "AWS::AutoScaling::AutoScalingGroup", "aws:cdk:cloudformation:props": { - "maxSize": "1", - "minSize": "1", "desiredCapacity": "1", "launchTemplate": { "launchTemplateId": { @@ -1501,6 +1693,8 @@ ] } }, + "maxSize": "1", + "minSize": "1", "vpcZoneIdentifier": [ { "Ref": "VpcPrivateSubnet1Subnet536B997A" @@ -1516,13 +1710,13 @@ }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "BootstrapVersion": { @@ -1530,7 +1724,7 @@ "path": "integ-ec2-machine-image-test/BootstrapVersion", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "CheckBootstrapVersion": { @@ -1538,13 +1732,13 @@ "path": "integ-ec2-machine-image-test/CheckBootstrapVersion", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "integ-test": { @@ -1560,7 +1754,7 @@ "path": "integ-test/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "DeployAssert": { @@ -1572,7 +1766,7 @@ "path": "integ-test/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } }, "CheckBootstrapVersion": { @@ -1580,13 +1774,13 @@ "path": "integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, @@ -1606,13 +1800,13 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } }, "constructInfo": { "fqn": "constructs.Construct", - "version": "10.2.55" + "version": "10.2.70" } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.ts index 790f623c5bf14..c6b9039d59601 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.ts @@ -30,14 +30,23 @@ export class TestCase extends Stack { vpc, }); - new ssm.CfnParameter(this, 'AmiParameter', { + new ec2.Instance(this, 'al2023 with minimal AMI', { + instanceType, + machineImage: new ec2.AmazonLinuxImage({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023, + edition: ec2.AmazonLinuxEdition.MINIMAL, + }), + vpc, + }); + + const parameter = new ssm.CfnParameter(this, 'AmiParameter', { name: 'myAmi', type: 'String', dataType: 'aws:ec2:image', value: 'ami-06ca3ca175f37dd66', }); - const machineImage = ec2.MachineImage.resolveSsmParameterAtLaunch('myAmi'); + const machineImage = ec2.MachineImage.resolveSsmParameterAtLaunch(parameter.ref); new ec2.Instance(this, 'ssm-resolve-instance', { instanceType, machineImage, vpc }); const launchTemplate = new ec2.LaunchTemplate(this, 'LT', { instanceType, machineImage }); diff --git a/packages/aws-cdk-lib/aws-ec2/lib/machine-image/machine-image.ts b/packages/aws-cdk-lib/aws-ec2/lib/machine-image/machine-image.ts index fbd22863fa60d..df99fea0afbee 100644 --- a/packages/aws-cdk-lib/aws-ec2/lib/machine-image/machine-image.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/machine-image/machine-image.ts @@ -486,10 +486,18 @@ export class AmazonLinuxImage extends GenericSSMParameterImage { if (generation === AmazonLinuxGeneration.AMAZON_LINUX_2022) { kernel = AmazonLinuxKernel.KERNEL5_X; if (props && props.storage) { - throw new Error('Storage parameter does not exist in smm parameter name for Amazon Linux 2022.'); + throw new Error('Storage parameter does not exist in SSM parameter name for Amazon Linux 2022.'); } if (props && props.virtualization) { - throw new Error('Virtualization parameter does not exist in smm parameter name for Amazon Linux 2022.'); + throw new Error('Virtualization parameter does not exist in SSM parameter name for Amazon Linux 2022.'); + } + } else if (generation === AmazonLinuxGeneration.AMAZON_LINUX_2023) { + kernel = AmazonLinuxKernel.KERNEL6_1; + if (props && props.storage) { + throw new Error('Storage parameter does not exist in SSM parameter name for Amazon Linux 2023.'); + } + if (props && props.virtualization) { + throw new Error('Virtualization parameter does not exist in SSM parameter name for Amazon Linux 2023.'); } } else { virtualization = (props && props.virtualization) || AmazonLinuxVirt.HVM; @@ -537,9 +545,15 @@ export class AmazonLinuxImage extends GenericSSMParameterImage { */ export enum AmazonLinuxKernel { /** - * Standard edition + * Kernel version 5.10 */ KERNEL5_X = 'kernel-5.10', + + /** + * Kernel version 6.1 + */ + KERNEL6_1 = 'kernel-6.1', + } /** diff --git a/packages/aws-cdk-lib/aws-ec2/test/machine-image.test.ts b/packages/aws-cdk-lib/aws-ec2/test/machine-image.test.ts index c52129d095e49..ac2eef24611c9 100644 --- a/packages/aws-cdk-lib/aws-ec2/test/machine-image.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/machine-image.test.ts @@ -261,7 +261,7 @@ test('throw error if storage param is set for Amazon Linux 2022', () => { generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2022, storage: ec2.AmazonLinuxStorage.GENERAL_PURPOSE, }).getImage(stack).imageId; - }).toThrow(/Storage parameter does not exist in smm parameter name for Amazon Linux 2022./); + }).toThrow(/Storage parameter does not exist in SSM parameter name for Amazon Linux 2022./); }); test('throw error if virtualization param is set for Amazon Linux 2022', () => { @@ -271,7 +271,7 @@ test('throw error if virtualization param is set for Amazon Linux 2022', () => { generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2022, virtualization: ec2.AmazonLinuxVirt.HVM, }).getImage(stack).imageId; - }).toThrow(/Virtualization parameter does not exist in smm parameter name for Amazon Linux 2022./); + }).toThrow(/Virtualization parameter does not exist in SSM parameter name for Amazon Linux 2022./); }); test('cached lookups of Amazon Linux 2022 with kernel 5.x', () => { @@ -404,6 +404,35 @@ describe('latest amazon linux', () => { }, ]); }); + + test('AmazonLinuxImage with AMAZON_LINUX_2023', () => { + // WHEN + new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023 }).getImage(stack); + + // THEN + Template.fromStack(stack).hasParameter('*', { + Type: 'AWS::SSM::Parameter::Value', + Default: '/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64', + }); + }); +}); + +test('throw error if storage param is set for Amazon Linux 2023', () => { + expect(() => { + new ec2.AmazonLinuxImage({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023, + storage: ec2.AmazonLinuxStorage.GENERAL_PURPOSE, + }).getImage(stack); + }).toThrow(/Storage parameter does not exist in SSM parameter name for Amazon Linux 2023./); +}); + +test('throw error if virtualization param is set for Amazon Linux 2023', () => { + expect(() => { + new ec2.AmazonLinuxImage({ + generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023, + virtualization: ec2.AmazonLinuxVirt.HVM, + }).getImage(stack); + }).toThrow(/Virtualization parameter does not exist in SSM parameter name for Amazon Linux 2023./); }); function isWindowsUserData(ud: ec2.UserData) { From 32b97942596d3b5e01034cfd3b8839e95f140e20 Mon Sep 17 00:00:00 2001 From: Vinayak Kukreja Date: Wed, 8 Nov 2023 14:50:49 -0800 Subject: [PATCH 2/2] update integ test Signed-off-by: Vinayak Kukreja --- .../integ-ec2-machine-image-test.assets.json | 4 +- ...integ-ec2-machine-image-test.template.json | 42 +- .../manifest.json | 23 +- .../integ.machine-image.js.snapshot/tree.json | 420 +++++++++--------- .../test/aws-ec2/test/integ.machine-image.ts | 7 +- 5 files changed, 252 insertions(+), 244 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.assets.json index 65ef1b2b46842..6c1ca4781fbe5 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.assets.json @@ -1,7 +1,7 @@ { "version": "34.0.0", "files": { - "d898789343437c2eb73edab3927044683b15ba7ce606b73961dcbfe73604deea": { + "b002645f95f6a2b0670b702b8ebd2f5e504cadb0469d1de92f091adf7f3c1855": { "source": { "path": "integ-ec2-machine-image-test.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "d898789343437c2eb73edab3927044683b15ba7ce606b73961dcbfe73604deea.json", + "objectKey": "b002645f95f6a2b0670b702b8ebd2f5e504cadb0469d1de92f091adf7f3c1855.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.template.json index d1431244918c4..b4c916e644ffd 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/integ-ec2-machine-image-test.template.json @@ -708,10 +708,10 @@ "al2023InstanceRoleECC2D6DD" ] }, - "al2023withminimalAMIInstanceSecurityGroupB3378C30": { + "al2023WithMinimalAMIInstanceSecurityGroupBD2FA3C4": { "Type": "AWS::EC2::SecurityGroup", "Properties": { - "GroupDescription": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup", + "GroupDescription": "integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceSecurityGroup", "SecurityGroupEgress": [ { "CidrIp": "0.0.0.0/0", @@ -722,7 +722,7 @@ "Tags": [ { "Key": "Name", - "Value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + "Value": "integ-ec2-machine-image-test/al2023WithMinimalAMI" } ], "VpcId": { @@ -730,7 +730,7 @@ } } }, - "al2023withminimalAMIInstanceRole6BA4B2B7": { + "al2023WithMinimalAMIInstanceRoleD28B1D5E": { "Type": "AWS::IAM::Role", "Properties": { "AssumeRolePolicyDocument": { @@ -748,27 +748,27 @@ "Tags": [ { "Key": "Name", - "Value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + "Value": "integ-ec2-machine-image-test/al2023WithMinimalAMI" } ] } }, - "al2023withminimalAMIInstanceProfile9DC9359F": { + "al2023WithMinimalAMIInstanceProfile3DC008CC": { "Type": "AWS::IAM::InstanceProfile", "Properties": { "Roles": [ { - "Ref": "al2023withminimalAMIInstanceRole6BA4B2B7" + "Ref": "al2023WithMinimalAMIInstanceRoleD28B1D5E" } ] } }, - "al2023withminimalAMIF0D18F9E": { + "al2023WithMinimalAMI03A043A1": { "Type": "AWS::EC2::Instance", "Properties": { "AvailabilityZone": "test-region-1a", "IamInstanceProfile": { - "Ref": "al2023withminimalAMIInstanceProfile9DC9359F" + "Ref": "al2023WithMinimalAMIInstanceProfile3DC008CC" }, "ImageId": { "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amiminimalkernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" @@ -777,7 +777,7 @@ "SecurityGroupIds": [ { "Fn::GetAtt": [ - "al2023withminimalAMIInstanceSecurityGroupB3378C30", + "al2023WithMinimalAMIInstanceSecurityGroupBD2FA3C4", "GroupId" ] } @@ -788,7 +788,7 @@ "Tags": [ { "Key": "Name", - "Value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + "Value": "integ-ec2-machine-image-test/al2023WithMinimalAMI" } ], "UserData": { @@ -796,14 +796,14 @@ } }, "DependsOn": [ - "al2023withminimalAMIInstanceRole6BA4B2B7" + "al2023WithMinimalAMIInstanceRoleD28B1D5E" ] }, "AmiParameter": { "Type": "AWS::SSM::Parameter", "Properties": { "DataType": "aws:ec2:image", - "Name": "myAmi", + "Name": "IntegTestAmi", "Type": "String", "Value": "ami-06ca3ca175f37dd66" } @@ -828,7 +828,10 @@ "VpcId": { "Ref": "Vpc8378EB38" } - } + }, + "DependsOn": [ + "AmiParameter" + ] }, "ssmresolveinstanceInstanceRoleCC771AEF": { "Type": "AWS::IAM::Role", @@ -851,7 +854,10 @@ "Value": "integ-ec2-machine-image-test/ssm-resolve-instance" } ] - } + }, + "DependsOn": [ + "AmiParameter" + ] }, "ssmresolveinstanceInstanceProfileAD70EB72": { "Type": "AWS::IAM::InstanceProfile", @@ -861,7 +867,10 @@ "Ref": "ssmresolveinstanceInstanceRoleCC771AEF" } ] - } + }, + "DependsOn": [ + "AmiParameter" + ] }, "ssmresolveinstanceDC2C8573": { "Type": "AWS::EC2::Instance", @@ -904,6 +913,7 @@ } }, "DependsOn": [ + "AmiParameter", "ssmresolveinstanceInstanceRoleCC771AEF" ] }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/manifest.json index 12d1d1a2a1b56..ce55ac8dbb7c9 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/manifest.json @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d898789343437c2eb73edab3927044683b15ba7ce606b73961dcbfe73604deea.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b002645f95f6a2b0670b702b8ebd2f5e504cadb0469d1de92f091adf7f3c1855.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -292,28 +292,28 @@ "data": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" } ], - "/integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup/Resource": [ + "/integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceSecurityGroup/Resource": [ { "type": "aws:cdk:logicalId", - "data": "al2023withminimalAMIInstanceSecurityGroupB3378C30" + "data": "al2023WithMinimalAMIInstanceSecurityGroupBD2FA3C4" } ], - "/integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceRole/Resource": [ + "/integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceRole/Resource": [ { "type": "aws:cdk:logicalId", - "data": "al2023withminimalAMIInstanceRole6BA4B2B7" + "data": "al2023WithMinimalAMIInstanceRoleD28B1D5E" } ], - "/integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceProfile": [ + "/integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceProfile": [ { "type": "aws:cdk:logicalId", - "data": "al2023withminimalAMIInstanceProfile9DC9359F" + "data": "al2023WithMinimalAMIInstanceProfile3DC008CC" } ], - "/integ-ec2-machine-image-test/al2023 with minimal AMI/Resource": [ + "/integ-ec2-machine-image-test/al2023WithMinimalAMI/Resource": [ { "type": "aws:cdk:logicalId", - "data": "al2023withminimalAMIF0D18F9E" + "data": "al2023WithMinimalAMI03A043A1" } ], "/integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ @@ -349,10 +349,7 @@ "/integ-ec2-machine-image-test/ssm-resolve-instance/Resource": [ { "type": "aws:cdk:logicalId", - "data": "ssmresolveinstanceDC2C8573", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" - ] + "data": "ssmresolveinstanceDC2C8573" } ], "/integ-ec2-machine-image-test/LT/Resource": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/tree.json index ca88eca4ae196..dc58cb1fd94d0 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.js.snapshot/tree.json @@ -31,8 +31,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" } }, "PublicSubnet1": { @@ -68,16 +68,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "integ-ec2-machine-image-test/Vpc/PublicSubnet1/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -98,8 +98,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -117,8 +117,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -137,8 +137,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } }, "EIP": { @@ -157,8 +157,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" } }, "NATGateway": { @@ -185,14 +185,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" } }, "PublicSubnet2": { @@ -228,16 +228,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "integ-ec2-machine-image-test/Vpc/PublicSubnet2/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -258,8 +258,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -277,8 +277,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -297,8 +297,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } }, "EIP": { @@ -317,8 +317,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" } }, "NATGateway": { @@ -345,14 +345,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" } }, "PublicSubnet3": { @@ -388,16 +388,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "integ-ec2-machine-image-test/Vpc/PublicSubnet3/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -418,8 +418,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -437,8 +437,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -457,8 +457,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } }, "EIP": { @@ -477,8 +477,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnEIP", + "version": "0.0.0" } }, "NATGateway": { @@ -505,14 +505,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnNatGateway", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" } }, "PrivateSubnet1": { @@ -548,16 +548,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "integ-ec2-machine-image-test/Vpc/PrivateSubnet1/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -578,8 +578,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -597,8 +597,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -617,14 +617,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" } }, "PrivateSubnet2": { @@ -660,16 +660,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "integ-ec2-machine-image-test/Vpc/PrivateSubnet2/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -690,8 +690,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -709,8 +709,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -729,14 +729,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" } }, "PrivateSubnet3": { @@ -772,16 +772,16 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" } }, "Acl": { "id": "Acl", "path": "integ-ec2-machine-image-test/Vpc/PrivateSubnet3/Acl", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "RouteTable": { @@ -802,8 +802,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } }, "RouteTableAssociation": { @@ -821,8 +821,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" } }, "DefaultRoute": { @@ -841,14 +841,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.PrivateSubnet", + "version": "0.0.0" } }, "IGW": { @@ -866,8 +866,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" } }, "VPCGW": { @@ -885,14 +885,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" } }, "amzn2": { @@ -929,14 +929,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" } }, "InstanceRole": { @@ -947,8 +947,8 @@ "id": "ImportInstanceRole", "path": "integ-ec2-machine-image-test/amzn2/InstanceRole/ImportInstanceRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { @@ -978,14 +978,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" } }, "InstanceProfile": { @@ -1002,8 +1002,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", + "version": "0.0.0" } }, "Resource": { @@ -1043,30 +1043,30 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.Instance", + "version": "0.0.0" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": { "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118": { "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118", "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--amzn2-ami-kernel-5.10-hvm-x86_64-gp2:C96584B6-F00A-464E-AD19-53AFF4B05118", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "al2023": { @@ -1103,14 +1103,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" } }, "InstanceRole": { @@ -1121,8 +1121,8 @@ "id": "ImportInstanceRole", "path": "integ-ec2-machine-image-test/al2023/InstanceRole/ImportInstanceRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { @@ -1152,14 +1152,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" } }, "InstanceProfile": { @@ -1176,8 +1176,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", + "version": "0.0.0" } }, "Resource": { @@ -1217,47 +1217,47 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.Instance", + "version": "0.0.0" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": { "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118": { "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, - "al2023 with minimal AMI": { - "id": "al2023 with minimal AMI", - "path": "integ-ec2-machine-image-test/al2023 with minimal AMI", + "al2023WithMinimalAMI": { + "id": "al2023WithMinimalAMI", + "path": "integ-ec2-machine-image-test/al2023WithMinimalAMI", "children": { "InstanceSecurityGroup": { "id": "InstanceSecurityGroup", - "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup", + "path": "integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceSecurityGroup", "children": { "Resource": { "id": "Resource", - "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup/Resource", + "path": "integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceSecurityGroup/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", "aws:cdk:cloudformation:props": { - "groupDescription": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceSecurityGroup", + "groupDescription": "integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceSecurityGroup", "securityGroupEgress": [ { "cidrIp": "0.0.0.0/0", @@ -1268,7 +1268,7 @@ "tags": [ { "key": "Name", - "value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + "value": "integ-ec2-machine-image-test/al2023WithMinimalAMI" } ], "vpcId": { @@ -1277,31 +1277,31 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" } }, "InstanceRole": { "id": "InstanceRole", - "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceRole", + "path": "integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceRole", "children": { "ImportInstanceRole": { "id": "ImportInstanceRole", - "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceRole/ImportInstanceRole", + "path": "integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceRole/ImportInstanceRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { "id": "Resource", - "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceRole/Resource", + "path": "integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -1320,49 +1320,49 @@ "tags": [ { "key": "Name", - "value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + "value": "integ-ec2-machine-image-test/al2023WithMinimalAMI" } ] } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" } }, "InstanceProfile": { "id": "InstanceProfile", - "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/InstanceProfile", + "path": "integ-ec2-machine-image-test/al2023WithMinimalAMI/InstanceProfile", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", "aws:cdk:cloudformation:props": { "roles": [ { - "Ref": "al2023withminimalAMIInstanceRole6BA4B2B7" + "Ref": "al2023WithMinimalAMIInstanceRoleD28B1D5E" } ] } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", + "version": "0.0.0" } }, "Resource": { "id": "Resource", - "path": "integ-ec2-machine-image-test/al2023 with minimal AMI/Resource", + "path": "integ-ec2-machine-image-test/al2023WithMinimalAMI/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Instance", "aws:cdk:cloudformation:props": { "availabilityZone": "test-region-1a", "iamInstanceProfile": { - "Ref": "al2023withminimalAMIInstanceProfile9DC9359F" + "Ref": "al2023WithMinimalAMIInstanceProfile3DC008CC" }, "imageId": { "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amiminimalkernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" @@ -1371,7 +1371,7 @@ "securityGroupIds": [ { "Fn::GetAtt": [ - "al2023withminimalAMIInstanceSecurityGroupB3378C30", + "al2023WithMinimalAMIInstanceSecurityGroupBD2FA3C4", "GroupId" ] } @@ -1382,7 +1382,7 @@ "tags": [ { "key": "Name", - "value": "integ-ec2-machine-image-test/al2023 with minimal AMI" + "value": "integ-ec2-machine-image-test/al2023WithMinimalAMI" } ], "userData": { @@ -1391,30 +1391,30 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.Instance", + "version": "0.0.0" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": { "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118": { "id": "SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", "path": "integ-ec2-machine-image-test/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-minimal-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "AmiParameter": { @@ -1424,14 +1424,14 @@ "aws:cdk:cloudformation:type": "AWS::SSM::Parameter", "aws:cdk:cloudformation:props": { "dataType": "aws:ec2:image", - "name": "myAmi", + "name": "IntegTestAmi", "type": "String", "value": "ami-06ca3ca175f37dd66" } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ssm.CfnParameter", + "version": "0.0.0" } }, "ssm-resolve-instance": { @@ -1468,14 +1468,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" } }, "InstanceRole": { @@ -1486,8 +1486,8 @@ "id": "ImportInstanceRole", "path": "integ-ec2-machine-image-test/ssm-resolve-instance/InstanceRole/ImportInstanceRole", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" } }, "Resource": { @@ -1517,14 +1517,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" } }, "InstanceProfile": { @@ -1541,8 +1541,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", + "version": "0.0.0" } }, "Resource": { @@ -1590,14 +1590,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.Instance", + "version": "0.0.0" } }, "LT": { @@ -1661,14 +1661,14 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.CfnLaunchTemplate", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_ec2.LaunchTemplate", + "version": "0.0.0" } }, "ASG": { @@ -1709,36 +1709,36 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_autoscaling.CfnAutoScalingGroup", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.aws_autoscaling.AutoScalingGroup", + "version": "0.0.0" } }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "integ-ec2-machine-image-test/BootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "integ-ec2-machine-image-test/CheckBootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" } }, "integ-test": { @@ -1765,22 +1765,22 @@ "id": "BootstrapVersion", "path": "integ-test/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" } } }, @@ -1805,8 +1805,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.2.70" + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.ts index c6b9039d59601..e0f4a80e1abd7 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.machine-image.ts @@ -30,7 +30,7 @@ export class TestCase extends Stack { vpc, }); - new ec2.Instance(this, 'al2023 with minimal AMI', { + new ec2.Instance(this, 'al2023WithMinimalAMI', { instanceType, machineImage: new ec2.AmazonLinuxImage({ generation: ec2.AmazonLinuxGeneration.AMAZON_LINUX_2023, @@ -40,14 +40,15 @@ export class TestCase extends Stack { }); const parameter = new ssm.CfnParameter(this, 'AmiParameter', { - name: 'myAmi', + name: 'IntegTestAmi', type: 'String', dataType: 'aws:ec2:image', value: 'ami-06ca3ca175f37dd66', }); const machineImage = ec2.MachineImage.resolveSsmParameterAtLaunch(parameter.ref); - new ec2.Instance(this, 'ssm-resolve-instance', { instanceType, machineImage, vpc }); + const ssmInstanceTest = new ec2.Instance(this, 'ssm-resolve-instance', { instanceType, machineImage, vpc }); + ssmInstanceTest.node.addDependency(parameter); const launchTemplate = new ec2.LaunchTemplate(this, 'LT', { instanceType, machineImage }); new asg.AutoScalingGroup(this, 'ASG', {