From 0299908d8a6f7f0cc982610a49010e9828a331cc Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 13:00:51 +0000 Subject: [PATCH 01/13] support placementGroupName --- packages/aws-cdk-lib/aws-ec2/lib/instance.ts | 7 ++++ .../aws-cdk-lib/aws-ec2/test/instance.test.ts | 34 +++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts index c5ac35416e9f4..4f5c375d7ef35 100644 --- a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts @@ -16,6 +16,7 @@ import { IVpc, Subnet, SubnetSelection } from './vpc'; import * as iam from '../../aws-iam'; import { Annotations, Aspects, Duration, Fn, IResource, Lazy, Resource, Stack, Tags } from '../../core'; import { md5hash } from '../../core/lib/helpers-internal'; +import { IPlacementGroup } from './placement-group'; /** * Name tag constant @@ -315,6 +316,11 @@ export interface InstanceProps { * @default false */ readonly ebsOptimized?: boolean; + + /** + * The name of an existing placement group that you want to launch the instance into (cluster | partition | spread). + */ + readonly placementGroup?: IPlacementGroup; } /** @@ -486,6 +492,7 @@ export class Instance extends Resource implements IInstance { monitoring: props.detailedMonitoring, creditSpecification: props.creditSpecification ? { cpuCredits: props.creditSpecification } : undefined, ebsOptimized: props.ebsOptimized, + placementGroupName: props.placementGroup?.placementGroupName, }); this.instance.node.addDependency(this.role); diff --git a/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts b/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts index 6db4d2256bd8b..836480935e5e9 100644 --- a/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts @@ -26,6 +26,7 @@ import { KeyPair, KeyPairType, CpuCredits, + PlacementGroup, } from '../lib'; let stack: Stack; @@ -210,6 +211,39 @@ describe('instance', () => { PropagateTagsToVolumeOnCreation: true, }); }); + // placementGroup + describe('placementGroup', () => { + test('can set placementGroup', () => { + // WHEN + // create a new placementgroup + const pg1 = new PlacementGroup(stack, 'myPlacementGroup1'); + const pg2 = new PlacementGroup(stack, 'myPlacementGroup2'); + new Instance(stack, 'Instance1', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + placementGroup: pg1, + }); + new Instance(stack, 'Instance2', { + vpc, + machineImage: new AmazonLinuxImage(), + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + placementGroup: PlacementGroup.fromPlacementGroupName(stack, 'importedPlacementGroup', 'myPlacementGroup2'), + }); + + const t = Template.fromStack(stack); + Array.isArray(t); + // THEN + t.hasResourceProperties('AWS::EC2::Instance', { + PlacementGroupName: { + 'Fn::GetAtt': ['myPlacementGroup180969E8B', 'GroupName'], + }, + }); + t.hasResourceProperties('AWS::EC2::Instance', { + PlacementGroupName: 'myPlacementGroup2', + }); + }); + }); describe('blockDeviceMappings', () => { test('can set blockDeviceMappings', () => { // WHEN From 90ed40da7af2d6ae1792c1d44c2b45a2cf67fcf5 Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 13:46:28 +0000 Subject: [PATCH 02/13] add integ test and update README --- ...efaultTestDeployAssertCBC801E8.assets.json | 19 + ...aultTestDeployAssertCBC801E8.template.json | 36 + .../__entrypoint__.js | 155 ++++ .../index.js | 1 + .../cdk.out | 1 + .../ec2-instance-test-stack.assets.json | 32 + .../ec2-instance-test-stack.template.json | 443 ++++++++++++ .../integ.json | 12 + .../manifest.json | 227 ++++++ .../tree.json | 667 ++++++++++++++++++ .../test/integ.instance-placement-group.ts | 38 + packages/aws-cdk-lib/aws-ec2/README.md | 15 + 12 files changed, 1646 insertions(+) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json new file mode 100644 index 0000000000000..d808c87102d3f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js new file mode 100644 index 0000000000000..02033f55cf612 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withRetries = exports.handler = exports.external = void 0; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +exports.handler = handler; +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + const parsedUrl = url.parse(event.ResponseURL); + const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; + exports.external.log('submit response to cloudformation', loggingSafeUrl, json); + const responseBody = JSON.stringify(json); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }; + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); +} +async function defaultSendHttpRequest(options, requestBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, (response) => { + response.resume(); // Consume the response but don't care about it + if (!response.statusCode || response.statusCode >= 400) { + reject(new Error(`Unsuccessful HTTP response: ${response.statusCode}`)); + } + else { + resolve(); + } + }); + request.on('error', reject); + request.write(requestBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +exports.withRetries = withRetries; +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js new file mode 100644 index 0000000000000..013bcaffd8fe5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js @@ -0,0 +1 @@ +"use strict";var I=Object.create;var t=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var G=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},n=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!l.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return r};var R=(r,e,o)=>(o=r!=null?I(g(r)):{},n(e||!r||!r.__esModule?t(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>n(t({},"__esModule",{value:!0}),r);var k={};G(k,{handler:()=>f});module.exports=S(k);var a=R(require("@aws-sdk/client-ec2")),u=new a.EC2({});function c(r,e){return{GroupId:r,IpPermissions:[{UserIdGroupPairs:[{GroupId:r,UserId:e}],IpProtocol:"-1"}]}}function d(r){return{GroupId:r,IpPermissions:[{IpRanges:[{CidrIp:"0.0.0.0/0"}],IpProtocol:"-1"}]}}async function f(r){let e=r.ResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.Account;switch(r.RequestType){case"Create":return p(e,o);case"Update":return h(r);case"Delete":return m(e,o)}}async function h(r){let e=r.OldResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.DefaultSecurityGroupId;e!==o&&(await m(e,r.ResourceProperties.Account),await p(o,r.ResourceProperties.Account))}async function p(r,e){try{await u.revokeSecurityGroupEgress(d(r))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}try{await u.revokeSecurityGroupIngress(c(r,e))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}}async function m(r,e){await u.authorizeSecurityGroupIngress(c(r,e)),await u.authorizeSecurityGroupEgress(d(r))}0&&(module.exports={handler}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.assets.json new file mode 100644 index 0000000000000..a44f81d91d787 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "36.0.0", + "files": { + "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1": { + "source": { + "path": "asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "de5657e37d10786b78da041a0816c15d98258d9e40b1acab61380e104bfa191d": { + "source": { + "path": "ec2-instance-test-stack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "de5657e37d10786b78da041a0816c15d98258d9e40b1acab61380e104bfa191d.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.template.json new file mode 100644 index 0000000000000..c4c3360490fdb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.template.json @@ -0,0 +1,443 @@ +{ + "Resources": { + "testpgC328A9B8": { + "Type": "AWS::EC2::PlacementGroup", + "Properties": { + "Strategy": "spread" + } + }, + "VPCB9E5F0B4": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-test-stack/VPC" + } + ] + } + }, + "VPCpublicSubnet1Subnet325F50B2": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/17", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "ec2-instance-test-stack/VPC/publicSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCpublicSubnet1RouteTableF591E248": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-test-stack/VPC/publicSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCpublicSubnet1RouteTableAssociationBFFA43B7": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCpublicSubnet1RouteTableF591E248" + }, + "SubnetId": { + "Ref": "VPCpublicSubnet1Subnet325F50B2" + } + } + }, + "VPCpublicSubnet1DefaultRoute19059ECD": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "RouteTableId": { + "Ref": "VPCpublicSubnet1RouteTableF591E248" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCpublicSubnet2Subnet2B2DFF71": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/17", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "ec2-instance-test-stack/VPC/publicSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCpublicSubnet2RouteTable55DAB1BB": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-test-stack/VPC/publicSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCpublicSubnet2RouteTableAssociation0849466B": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" + }, + "SubnetId": { + "Ref": "VPCpublicSubnet2Subnet2B2DFF71" + } + } + }, + "VPCpublicSubnet2DefaultRoute9ED4D6BC": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "RouteTableId": { + "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCIGWB7E252D3": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-test-stack/VPC" + } + ] + } + }, + "VPCVPCGW99B986DC": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCRestrictDefaultSecurityGroupCustomResource59474679": { + "Type": "Custom::VpcRestrictDefaultSG", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E", + "Arn" + ] + }, + "DefaultSecurityGroupId": { + "Fn::GetAtt": [ + "VPCB9E5F0B4", + "DefaultSecurityGroup" + ] + }, + "Account": { + "Ref": "AWS::AccountId" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ], + "Policies": [ + { + "PolicyName": "Inline", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ec2:AuthorizeSecurityGroupIngress", + "ec2:AuthorizeSecurityGroupEgress", + "ec2:RevokeSecurityGroupIngress", + "ec2:RevokeSecurityGroupEgress" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":security-group/", + { + "Fn::GetAtt": [ + "VPCB9E5F0B4", + "DefaultSecurityGroup" + ] + } + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group" + }, + "DependsOn": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + ] + }, + "InstanceInstanceSecurityGroupF0E2D5BE": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "ec2-instance-test-stack/Instance/InstanceSecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-test-stack/Instance" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "InstanceInstanceRoleE9785DE5": { + "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": "ec2-instance-test-stack/Instance" + } + ] + } + }, + "InstanceInstanceProfileAB5AEF02": { + "Type": "AWS::IAM::InstanceProfile", + "Properties": { + "Roles": [ + { + "Ref": "InstanceInstanceRoleE9785DE5" + } + ] + } + }, + "InstanceC1063A87": { + "Type": "AWS::EC2::Instance", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "IamInstanceProfile": { + "Ref": "InstanceInstanceProfileAB5AEF02" + }, + "ImageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "InstanceType": "t3.nano", + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "InstanceInstanceSecurityGroupF0E2D5BE", + "GroupId" + ] + } + ], + "SubnetId": { + "Ref": "VPCpublicSubnet1Subnet325F50B2" + }, + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-test-stack/Instance" + } + ], + "UserData": { + "Fn::Base64": "#!/bin/bash" + } + }, + "DependsOn": [ + "InstanceInstanceRoleE9785DE5" + ] + } + }, + "Parameters": { + "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64" + }, + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json new file mode 100644 index 0000000000000..493353e856402 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "Ec2InstancePlacementGroup/DefaultTest": { + "stacks": [ + "ec2-instance-test-stack" + ], + "assertionStack": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert", + "assertionStackName": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json new file mode 100644 index 0000000000000..4621f557277f0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json @@ -0,0 +1,227 @@ +{ + "version": "36.0.0", + "artifacts": { + "ec2-instance-test-stack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "ec2-instance-test-stack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "ec2-instance-test-stack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "ec2-instance-test-stack.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}/de5657e37d10786b78da041a0816c15d98258d9e40b1acab61380e104bfa191d.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "ec2-instance-test-stack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "ec2-instance-test-stack.assets" + ], + "metadata": { + "/ec2-instance-test-stack/test-pg/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testpgC328A9B8" + } + ], + "/ec2-instance-test-stack/VPC/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCB9E5F0B4" + } + ], + "/ec2-instance-test-stack/VPC/publicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet1Subnet325F50B2" + } + ], + "/ec2-instance-test-stack/VPC/publicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet1RouteTableF591E248" + } + ], + "/ec2-instance-test-stack/VPC/publicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet1RouteTableAssociationBFFA43B7" + } + ], + "/ec2-instance-test-stack/VPC/publicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet1DefaultRoute19059ECD" + } + ], + "/ec2-instance-test-stack/VPC/publicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet2Subnet2B2DFF71" + } + ], + "/ec2-instance-test-stack/VPC/publicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet2RouteTable55DAB1BB" + } + ], + "/ec2-instance-test-stack/VPC/publicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet2RouteTableAssociation0849466B" + } + ], + "/ec2-instance-test-stack/VPC/publicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet2DefaultRoute9ED4D6BC" + } + ], + "/ec2-instance-test-stack/VPC/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCIGWB7E252D3" + } + ], + "/ec2-instance-test-stack/VPC/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCVPCGW99B986DC" + } + ], + "/ec2-instance-test-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCRestrictDefaultSecurityGroupCustomResource59474679" + } + ], + "/ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + } + ], + "/ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" + } + ], + "/ec2-instance-test-stack/Instance/InstanceSecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "InstanceInstanceSecurityGroupF0E2D5BE" + } + ], + "/ec2-instance-test-stack/Instance/InstanceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "InstanceInstanceRoleE9785DE5" + } + ], + "/ec2-instance-test-stack/Instance/InstanceProfile": [ + { + "type": "aws:cdk:logicalId", + "data": "InstanceInstanceProfileAB5AEF02" + } + ], + "/ec2-instance-test-stack/Instance/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "InstanceC1063A87" + } + ], + "/ec2-instance-test-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ + { + "type": "aws:cdk:logicalId", + "data": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + } + ], + "/ec2-instance-test-stack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/ec2-instance-test-stack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "ec2-instance-test-stack" + }, + "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.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}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets" + ], + "metadata": { + "/Ec2InstancePlacementGroup/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/Ec2InstancePlacementGroup/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json new file mode 100644 index 0000000000000..e5176f00bf92e --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json @@ -0,0 +1,667 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "ec2-instance-test-stack": { + "id": "ec2-instance-test-stack", + "path": "ec2-instance-test-stack", + "children": { + "test-pg": { + "id": "test-pg", + "path": "ec2-instance-test-stack/test-pg", + "children": { + "Resource": { + "id": "Resource", + "path": "ec2-instance-test-stack/test-pg/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::PlacementGroup", + "aws:cdk:cloudformation:props": { + "strategy": "spread" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnPlacementGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PlacementGroup", + "version": "0.0.0" + } + }, + "VPC": { + "id": "VPC", + "path": "ec2-instance-test-stack/VPC", + "children": { + "Resource": { + "id": "Resource", + "path": "ec2-instance-test-stack/VPC/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "ec2-instance-test-stack/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" + } + }, + "publicSubnet1": { + "id": "publicSubnet1", + "path": "ec2-instance-test-stack/VPC/publicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "ec2-instance-test-stack/VPC/publicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/17", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "ec2-instance-test-stack/VPC/publicSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "ec2-instance-test-stack/VPC/publicSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "ec2-instance-test-stack/VPC/publicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ec2-instance-test-stack/VPC/publicSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "ec2-instance-test-stack/VPC/publicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCpublicSubnet1RouteTableF591E248" + }, + "subnetId": { + "Ref": "VPCpublicSubnet1Subnet325F50B2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "ec2-instance-test-stack/VPC/publicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "routeTableId": { + "Ref": "VPCpublicSubnet1RouteTableF591E248" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "publicSubnet2": { + "id": "publicSubnet2", + "path": "ec2-instance-test-stack/VPC/publicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "ec2-instance-test-stack/VPC/publicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/17", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "ec2-instance-test-stack/VPC/publicSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "ec2-instance-test-stack/VPC/publicSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "ec2-instance-test-stack/VPC/publicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ec2-instance-test-stack/VPC/publicSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "ec2-instance-test-stack/VPC/publicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" + }, + "subnetId": { + "Ref": "VPCpublicSubnet2Subnet2B2DFF71" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "ec2-instance-test-stack/VPC/publicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "routeTableId": { + "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "ec2-instance-test-stack/VPC/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ec2-instance-test-stack/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "ec2-instance-test-stack/VPC/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + }, + "RestrictDefaultSecurityGroupCustomResource": { + "id": "RestrictDefaultSecurityGroupCustomResource", + "path": "ec2-instance-test-stack/VPC/RestrictDefaultSecurityGroupCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "ec2-instance-test-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" + } + }, + "Custom::VpcRestrictDefaultSGCustomResourceProvider": { + "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", + "path": "ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProviderBase", + "version": "0.0.0" + } + }, + "Instance": { + "id": "Instance", + "path": "ec2-instance-test-stack/Instance", + "children": { + "InstanceSecurityGroup": { + "id": "InstanceSecurityGroup", + "path": "ec2-instance-test-stack/Instance/InstanceSecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "ec2-instance-test-stack/Instance/InstanceSecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "ec2-instance-test-stack/Instance/InstanceSecurityGroup", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "tags": [ + { + "key": "Name", + "value": "ec2-instance-test-stack/Instance" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "InstanceRole": { + "id": "InstanceRole", + "path": "ec2-instance-test-stack/Instance/InstanceRole", + "children": { + "ImportInstanceRole": { + "id": "ImportInstanceRole", + "path": "ec2-instance-test-stack/Instance/InstanceRole/ImportInstanceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "ec2-instance-test-stack/Instance/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": "ec2-instance-test-stack/Instance" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "InstanceProfile": { + "id": "InstanceProfile", + "path": "ec2-instance-test-stack/Instance/InstanceProfile", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", + "aws:cdk:cloudformation:props": { + "roles": [ + { + "Ref": "InstanceInstanceRoleE9785DE5" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "ec2-instance-test-stack/Instance/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Instance", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "iamInstanceProfile": { + "Ref": "InstanceInstanceProfileAB5AEF02" + }, + "imageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "instanceType": "t3.nano", + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "InstanceInstanceSecurityGroupF0E2D5BE", + "GroupId" + ] + } + ], + "subnetId": { + "Ref": "VPCpublicSubnet1Subnet325F50B2" + }, + "tags": [ + { + "key": "Name", + "value": "ec2-instance-test-stack/Instance" + } + ], + "userData": { + "Fn::Base64": "#!/bin/bash" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "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": "ec2-instance-test-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", + "constructInfo": { + "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": "ec2-instance-test-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "ec2-instance-test-stack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "ec2-instance-test-stack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Ec2InstancePlacementGroup": { + "id": "Ec2InstancePlacementGroup", + "path": "Ec2InstancePlacementGroup", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "Ec2InstancePlacementGroup/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "Ec2InstancePlacementGroup/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "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.instance-placement-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts new file mode 100644 index 0000000000000..977cc22d295a0 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts @@ -0,0 +1,38 @@ +import { App, Stack } from 'aws-cdk-lib'; +import { + Instance, InstanceType, MachineImage, Vpc, + PlacementGroup, PlacementGroupStrategy, + InstanceClass, InstanceSize, SubnetType, +} from 'aws-cdk-lib/aws-ec2'; +import * as integ from '@aws-cdk/integ-tests-alpha'; + +const app = new App(); +const stack = new Stack(app, 'ec2-instance-test-stack'); + +// create a placementGroup +const pg = new PlacementGroup(stack, 'test-pg', { + strategy: PlacementGroupStrategy.SPREAD, +}); + +// create a vpc with one public subnet only +const vpc = new Vpc(stack, 'VPC', { + subnetConfiguration: [ + { + name: 'public', + subnetType: SubnetType.PUBLIC, + }, + ], + natGateways: 0, +}); + +// create a Instance with placementGroup support +new Instance(stack, 'Instance', { + vpc, + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.NANO), + machineImage: MachineImage.latestAmazonLinux2023(), + placementGroup: pg, +}); + +new integ.IntegTest(app, 'Ec2InstancePlacementGroup', { + testCases: [stack], +}); diff --git a/packages/aws-cdk-lib/aws-ec2/README.md b/packages/aws-cdk-lib/aws-ec2/README.md index 900dddf2f20cb..ecf0b30683638 100644 --- a/packages/aws-cdk-lib/aws-ec2/README.md +++ b/packages/aws-cdk-lib/aws-ec2/README.md @@ -1521,6 +1521,21 @@ const host = new ec2.BastionHostLinux(this, 'BastionHost', { }); ``` +### Placement Group + +Specify `placementGroup` to enable the placement group support: + +```ts fixture=with-vpc +declare const pg: ec2.PlacementGroup; + +new Instance(stack, 'Instance', { + vpc, + instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.NANO), + machineImage: MachineImage.latestAmazonLinux2023(), + placementGroup: pg, +}); +``` + ### Block Devices To add EBS block device mappings, specify the `blockDevices` property. The following example sets the EBS-backed From 00c45ae6a2c35d981da1998d1b65809dc2c7209f Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 13:53:14 +0000 Subject: [PATCH 03/13] minor --- packages/aws-cdk-lib/aws-ec2/test/instance.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts b/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts index 836480935e5e9..b13517ee29b21 100644 --- a/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts @@ -232,7 +232,6 @@ describe('instance', () => { }); const t = Template.fromStack(stack); - Array.isArray(t); // THEN t.hasResourceProperties('AWS::EC2::Instance', { PlacementGroupName: { From 6cb4ba6242ea51906a41cb9a7b5e63cfa5eb34d1 Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 13:55:29 +0000 Subject: [PATCH 04/13] lint --- packages/aws-cdk-lib/aws-ec2/lib/instance.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts index 4f5c375d7ef35..129e6b9528295 100644 --- a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts @@ -8,6 +8,7 @@ import { InstanceType } from './instance-types'; import { IKeyPair } from './key-pair'; import { CpuCredits } from './launch-template'; import { IMachineImage, OperatingSystemType } from './machine-image'; +import { IPlacementGroup } from './placement-group'; import { instanceBlockDeviceMappings } from './private/ebs-util'; import { ISecurityGroup, SecurityGroup } from './security-group'; import { UserData } from './user-data'; @@ -16,7 +17,6 @@ import { IVpc, Subnet, SubnetSelection } from './vpc'; import * as iam from '../../aws-iam'; import { Annotations, Aspects, Duration, Fn, IResource, Lazy, Resource, Stack, Tags } from '../../core'; import { md5hash } from '../../core/lib/helpers-internal'; -import { IPlacementGroup } from './placement-group'; /** * Name tag constant @@ -318,7 +318,7 @@ export interface InstanceProps { readonly ebsOptimized?: boolean; /** - * The name of an existing placement group that you want to launch the instance into (cluster | partition | spread). + * The placement group that you want to launch the instance into. */ readonly placementGroup?: IPlacementGroup; } From 4e8818f9f1d31f206eaff8244c58980dddfe52ac Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 13:57:41 +0000 Subject: [PATCH 05/13] lint --- packages/aws-cdk-lib/aws-ec2/test/instance.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts b/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts index b13517ee29b21..7c2cc06177868 100644 --- a/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/instance.test.ts @@ -217,7 +217,7 @@ describe('instance', () => { // WHEN // create a new placementgroup const pg1 = new PlacementGroup(stack, 'myPlacementGroup1'); - const pg2 = new PlacementGroup(stack, 'myPlacementGroup2'); + new PlacementGroup(stack, 'myPlacementGroup2'); new Instance(stack, 'Instance1', { vpc, machineImage: new AmazonLinuxImage(), From 0b5441c7fad7fe511cb99b156b528ae56402b8ac Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 14:44:00 +0000 Subject: [PATCH 06/13] lint --- packages/aws-cdk-lib/aws-ec2/lib/instance.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts index 129e6b9528295..5b486b6ecf376 100644 --- a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts @@ -319,6 +319,8 @@ export interface InstanceProps { /** * The placement group that you want to launch the instance into. + * + * @default - no placement group will be added. */ readonly placementGroup?: IPlacementGroup; } From e46db767335e668342149a678eb03a08b892b5b4 Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 15:34:45 +0000 Subject: [PATCH 07/13] update integ --- ...instance-placementgroup-stack.assets.json} | 6 +- ...stance-placementgroup-stack.template.json} | 20 ++-- .../integ.json | 2 +- .../manifest.json | 60 ++++++------ .../tree.json | 98 +++++++++---------- .../test/integ.instance-placement-group.ts | 2 +- 6 files changed, 94 insertions(+), 94 deletions(-) rename packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/{ec2-instance-test-stack.assets.json => ec2-instance-placementgroup-stack.assets.json} (81%) rename packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/{ec2-instance-test-stack.template.json => ec2-instance-placementgroup-stack.template.json} (93%) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json similarity index 81% rename from packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.assets.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json index a44f81d91d787..07d9f26a70a68 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json @@ -14,15 +14,15 @@ } } }, - "de5657e37d10786b78da041a0816c15d98258d9e40b1acab61380e104bfa191d": { + "2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012": { "source": { - "path": "ec2-instance-test-stack.template.json", + "path": "ec2-instance-placementgroup-stack.template.json", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "de5657e37d10786b78da041a0816c15d98258d9e40b1acab61380e104bfa191d.json", + "objectKey": "2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012.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.instance-placement-group.js.snapshot/ec2-instance-test-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json similarity index 93% rename from packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.template.json rename to packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json index c4c3360490fdb..a24e485df9b9a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-test-stack.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json @@ -16,7 +16,7 @@ "Tags": [ { "Key": "Name", - "Value": "ec2-instance-test-stack/VPC" + "Value": "ec2-instance-placementgroup-stack/VPC" } ] } @@ -45,7 +45,7 @@ }, { "Key": "Name", - "Value": "ec2-instance-test-stack/VPC/publicSubnet1" + "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" } ], "VpcId": { @@ -59,7 +59,7 @@ "Tags": [ { "Key": "Name", - "Value": "ec2-instance-test-stack/VPC/publicSubnet1" + "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" } ], "VpcId": { @@ -117,7 +117,7 @@ }, { "Key": "Name", - "Value": "ec2-instance-test-stack/VPC/publicSubnet2" + "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" } ], "VpcId": { @@ -131,7 +131,7 @@ "Tags": [ { "Key": "Name", - "Value": "ec2-instance-test-stack/VPC/publicSubnet2" + "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" } ], "VpcId": { @@ -171,7 +171,7 @@ "Tags": [ { "Key": "Name", - "Value": "ec2-instance-test-stack/VPC" + "Value": "ec2-instance-placementgroup-stack/VPC" } ] } @@ -306,7 +306,7 @@ "InstanceInstanceSecurityGroupF0E2D5BE": { "Type": "AWS::EC2::SecurityGroup", "Properties": { - "GroupDescription": "ec2-instance-test-stack/Instance/InstanceSecurityGroup", + "GroupDescription": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", "SecurityGroupEgress": [ { "CidrIp": "0.0.0.0/0", @@ -317,7 +317,7 @@ "Tags": [ { "Key": "Name", - "Value": "ec2-instance-test-stack/Instance" + "Value": "ec2-instance-placementgroup-stack/Instance" } ], "VpcId": { @@ -343,7 +343,7 @@ "Tags": [ { "Key": "Name", - "Value": "ec2-instance-test-stack/Instance" + "Value": "ec2-instance-placementgroup-stack/Instance" } ] } @@ -390,7 +390,7 @@ "Tags": [ { "Key": "Name", - "Value": "ec2-instance-test-stack/Instance" + "Value": "ec2-instance-placementgroup-stack/Instance" } ], "UserData": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json index 493353e856402..bdfd95e2e5065 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json @@ -3,7 +3,7 @@ "testCases": { "Ec2InstancePlacementGroup/DefaultTest": { "stacks": [ - "ec2-instance-test-stack" + "ec2-instance-placementgroup-stack" ], "assertionStack": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert", "assertionStackName": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json index 4621f557277f0..b857601e0083d 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json @@ -1,28 +1,28 @@ { "version": "36.0.0", "artifacts": { - "ec2-instance-test-stack.assets": { + "ec2-instance-placementgroup-stack.assets": { "type": "cdk:asset-manifest", "properties": { - "file": "ec2-instance-test-stack.assets.json", + "file": "ec2-instance-placementgroup-stack.assets.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" } }, - "ec2-instance-test-stack": { + "ec2-instance-placementgroup-stack": { "type": "aws:cloudformation:stack", "environment": "aws://unknown-account/unknown-region", "properties": { - "templateFile": "ec2-instance-test-stack.template.json", + "templateFile": "ec2-instance-placementgroup-stack.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}/de5657e37d10786b78da041a0816c15d98258d9e40b1acab61380e104bfa191d.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ - "ec2-instance-test-stack.assets" + "ec2-instance-placementgroup-stack.assets" ], "lookupRole": { "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", @@ -31,143 +31,143 @@ } }, "dependencies": [ - "ec2-instance-test-stack.assets" + "ec2-instance-placementgroup-stack.assets" ], "metadata": { - "/ec2-instance-test-stack/test-pg/Resource": [ + "/ec2-instance-placementgroup-stack/test-pg/Resource": [ { "type": "aws:cdk:logicalId", "data": "testpgC328A9B8" } ], - "/ec2-instance-test-stack/VPC/Resource": [ + "/ec2-instance-placementgroup-stack/VPC/Resource": [ { "type": "aws:cdk:logicalId", "data": "VPCB9E5F0B4" } ], - "/ec2-instance-test-stack/VPC/publicSubnet1/Subnet": [ + "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/Subnet": [ { "type": "aws:cdk:logicalId", "data": "VPCpublicSubnet1Subnet325F50B2" } ], - "/ec2-instance-test-stack/VPC/publicSubnet1/RouteTable": [ + "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTable": [ { "type": "aws:cdk:logicalId", "data": "VPCpublicSubnet1RouteTableF591E248" } ], - "/ec2-instance-test-stack/VPC/publicSubnet1/RouteTableAssociation": [ + "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", "data": "VPCpublicSubnet1RouteTableAssociationBFFA43B7" } ], - "/ec2-instance-test-stack/VPC/publicSubnet1/DefaultRoute": [ + "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/DefaultRoute": [ { "type": "aws:cdk:logicalId", "data": "VPCpublicSubnet1DefaultRoute19059ECD" } ], - "/ec2-instance-test-stack/VPC/publicSubnet2/Subnet": [ + "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/Subnet": [ { "type": "aws:cdk:logicalId", "data": "VPCpublicSubnet2Subnet2B2DFF71" } ], - "/ec2-instance-test-stack/VPC/publicSubnet2/RouteTable": [ + "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTable": [ { "type": "aws:cdk:logicalId", "data": "VPCpublicSubnet2RouteTable55DAB1BB" } ], - "/ec2-instance-test-stack/VPC/publicSubnet2/RouteTableAssociation": [ + "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", "data": "VPCpublicSubnet2RouteTableAssociation0849466B" } ], - "/ec2-instance-test-stack/VPC/publicSubnet2/DefaultRoute": [ + "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/DefaultRoute": [ { "type": "aws:cdk:logicalId", "data": "VPCpublicSubnet2DefaultRoute9ED4D6BC" } ], - "/ec2-instance-test-stack/VPC/IGW": [ + "/ec2-instance-placementgroup-stack/VPC/IGW": [ { "type": "aws:cdk:logicalId", "data": "VPCIGWB7E252D3" } ], - "/ec2-instance-test-stack/VPC/VPCGW": [ + "/ec2-instance-placementgroup-stack/VPC/VPCGW": [ { "type": "aws:cdk:logicalId", "data": "VPCVPCGW99B986DC" } ], - "/ec2-instance-test-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default": [ + "/ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default": [ { "type": "aws:cdk:logicalId", "data": "VPCRestrictDefaultSecurityGroupCustomResource59474679" } ], - "/ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ + "/ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ { "type": "aws:cdk:logicalId", "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" } ], - "/ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ + "/ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ { "type": "aws:cdk:logicalId", "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" } ], - "/ec2-instance-test-stack/Instance/InstanceSecurityGroup/Resource": [ + "/ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup/Resource": [ { "type": "aws:cdk:logicalId", "data": "InstanceInstanceSecurityGroupF0E2D5BE" } ], - "/ec2-instance-test-stack/Instance/InstanceRole/Resource": [ + "/ec2-instance-placementgroup-stack/Instance/InstanceRole/Resource": [ { "type": "aws:cdk:logicalId", "data": "InstanceInstanceRoleE9785DE5" } ], - "/ec2-instance-test-stack/Instance/InstanceProfile": [ + "/ec2-instance-placementgroup-stack/Instance/InstanceProfile": [ { "type": "aws:cdk:logicalId", "data": "InstanceInstanceProfileAB5AEF02" } ], - "/ec2-instance-test-stack/Instance/Resource": [ + "/ec2-instance-placementgroup-stack/Instance/Resource": [ { "type": "aws:cdk:logicalId", "data": "InstanceC1063A87" } ], - "/ec2-instance-test-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ + "/ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ { "type": "aws:cdk:logicalId", "data": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" } ], - "/ec2-instance-test-stack/BootstrapVersion": [ + "/ec2-instance-placementgroup-stack/BootstrapVersion": [ { "type": "aws:cdk:logicalId", "data": "BootstrapVersion" } ], - "/ec2-instance-test-stack/CheckBootstrapVersion": [ + "/ec2-instance-placementgroup-stack/CheckBootstrapVersion": [ { "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } ] }, - "displayName": "ec2-instance-test-stack" + "displayName": "ec2-instance-placementgroup-stack" }, "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets": { "type": "cdk:asset-manifest", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json index e5176f00bf92e..a5605fd808322 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json @@ -4,17 +4,17 @@ "id": "App", "path": "", "children": { - "ec2-instance-test-stack": { - "id": "ec2-instance-test-stack", - "path": "ec2-instance-test-stack", + "ec2-instance-placementgroup-stack": { + "id": "ec2-instance-placementgroup-stack", + "path": "ec2-instance-placementgroup-stack", "children": { "test-pg": { "id": "test-pg", - "path": "ec2-instance-test-stack/test-pg", + "path": "ec2-instance-placementgroup-stack/test-pg", "children": { "Resource": { "id": "Resource", - "path": "ec2-instance-test-stack/test-pg/Resource", + "path": "ec2-instance-placementgroup-stack/test-pg/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::PlacementGroup", "aws:cdk:cloudformation:props": { @@ -34,11 +34,11 @@ }, "VPC": { "id": "VPC", - "path": "ec2-instance-test-stack/VPC", + "path": "ec2-instance-placementgroup-stack/VPC", "children": { "Resource": { "id": "Resource", - "path": "ec2-instance-test-stack/VPC/Resource", + "path": "ec2-instance-placementgroup-stack/VPC/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::VPC", "aws:cdk:cloudformation:props": { @@ -49,7 +49,7 @@ "tags": [ { "key": "Name", - "value": "ec2-instance-test-stack/VPC" + "value": "ec2-instance-placementgroup-stack/VPC" } ] } @@ -61,11 +61,11 @@ }, "publicSubnet1": { "id": "publicSubnet1", - "path": "ec2-instance-test-stack/VPC/publicSubnet1", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1", "children": { "Subnet": { "id": "Subnet", - "path": "ec2-instance-test-stack/VPC/publicSubnet1/Subnet", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/Subnet", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { @@ -90,7 +90,7 @@ }, { "key": "Name", - "value": "ec2-instance-test-stack/VPC/publicSubnet1" + "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" } ], "vpcId": { @@ -105,7 +105,7 @@ }, "Acl": { "id": "Acl", - "path": "ec2-instance-test-stack/VPC/publicSubnet1/Acl", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/Acl", "constructInfo": { "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" @@ -113,14 +113,14 @@ }, "RouteTable": { "id": "RouteTable", - "path": "ec2-instance-test-stack/VPC/publicSubnet1/RouteTable", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTable", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { "tags": [ { "key": "Name", - "value": "ec2-instance-test-stack/VPC/publicSubnet1" + "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" } ], "vpcId": { @@ -135,7 +135,7 @@ }, "RouteTableAssociation": { "id": "RouteTableAssociation", - "path": "ec2-instance-test-stack/VPC/publicSubnet1/RouteTableAssociation", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTableAssociation", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { @@ -154,7 +154,7 @@ }, "DefaultRoute": { "id": "DefaultRoute", - "path": "ec2-instance-test-stack/VPC/publicSubnet1/DefaultRoute", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/DefaultRoute", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { @@ -180,11 +180,11 @@ }, "publicSubnet2": { "id": "publicSubnet2", - "path": "ec2-instance-test-stack/VPC/publicSubnet2", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2", "children": { "Subnet": { "id": "Subnet", - "path": "ec2-instance-test-stack/VPC/publicSubnet2/Subnet", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/Subnet", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { @@ -209,7 +209,7 @@ }, { "key": "Name", - "value": "ec2-instance-test-stack/VPC/publicSubnet2" + "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" } ], "vpcId": { @@ -224,7 +224,7 @@ }, "Acl": { "id": "Acl", - "path": "ec2-instance-test-stack/VPC/publicSubnet2/Acl", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/Acl", "constructInfo": { "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" @@ -232,14 +232,14 @@ }, "RouteTable": { "id": "RouteTable", - "path": "ec2-instance-test-stack/VPC/publicSubnet2/RouteTable", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTable", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", "aws:cdk:cloudformation:props": { "tags": [ { "key": "Name", - "value": "ec2-instance-test-stack/VPC/publicSubnet2" + "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" } ], "vpcId": { @@ -254,7 +254,7 @@ }, "RouteTableAssociation": { "id": "RouteTableAssociation", - "path": "ec2-instance-test-stack/VPC/publicSubnet2/RouteTableAssociation", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTableAssociation", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { @@ -273,7 +273,7 @@ }, "DefaultRoute": { "id": "DefaultRoute", - "path": "ec2-instance-test-stack/VPC/publicSubnet2/DefaultRoute", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/DefaultRoute", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Route", "aws:cdk:cloudformation:props": { @@ -299,14 +299,14 @@ }, "IGW": { "id": "IGW", - "path": "ec2-instance-test-stack/VPC/IGW", + "path": "ec2-instance-placementgroup-stack/VPC/IGW", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", "aws:cdk:cloudformation:props": { "tags": [ { "key": "Name", - "value": "ec2-instance-test-stack/VPC" + "value": "ec2-instance-placementgroup-stack/VPC" } ] } @@ -318,7 +318,7 @@ }, "VPCGW": { "id": "VPCGW", - "path": "ec2-instance-test-stack/VPC/VPCGW", + "path": "ec2-instance-placementgroup-stack/VPC/VPCGW", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", "aws:cdk:cloudformation:props": { @@ -337,11 +337,11 @@ }, "RestrictDefaultSecurityGroupCustomResource": { "id": "RestrictDefaultSecurityGroupCustomResource", - "path": "ec2-instance-test-stack/VPC/RestrictDefaultSecurityGroupCustomResource", + "path": "ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource", "children": { "Default": { "id": "Default", - "path": "ec2-instance-test-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default", + "path": "ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -361,11 +361,11 @@ }, "Custom::VpcRestrictDefaultSGCustomResourceProvider": { "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", - "path": "ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider", + "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider", "children": { "Staging": { "id": "Staging", - "path": "ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", + "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", "constructInfo": { "fqn": "aws-cdk-lib.AssetStaging", "version": "0.0.0" @@ -373,7 +373,7 @@ }, "Role": { "id": "Role", - "path": "ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", + "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -381,7 +381,7 @@ }, "Handler": { "id": "Handler", - "path": "ec2-instance-test-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", + "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", "constructInfo": { "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" @@ -395,19 +395,19 @@ }, "Instance": { "id": "Instance", - "path": "ec2-instance-test-stack/Instance", + "path": "ec2-instance-placementgroup-stack/Instance", "children": { "InstanceSecurityGroup": { "id": "InstanceSecurityGroup", - "path": "ec2-instance-test-stack/Instance/InstanceSecurityGroup", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", "children": { "Resource": { "id": "Resource", - "path": "ec2-instance-test-stack/Instance/InstanceSecurityGroup/Resource", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", "aws:cdk:cloudformation:props": { - "groupDescription": "ec2-instance-test-stack/Instance/InstanceSecurityGroup", + "groupDescription": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", "securityGroupEgress": [ { "cidrIp": "0.0.0.0/0", @@ -418,7 +418,7 @@ "tags": [ { "key": "Name", - "value": "ec2-instance-test-stack/Instance" + "value": "ec2-instance-placementgroup-stack/Instance" } ], "vpcId": { @@ -439,11 +439,11 @@ }, "InstanceRole": { "id": "InstanceRole", - "path": "ec2-instance-test-stack/Instance/InstanceRole", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceRole", "children": { "ImportInstanceRole": { "id": "ImportInstanceRole", - "path": "ec2-instance-test-stack/Instance/InstanceRole/ImportInstanceRole", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceRole/ImportInstanceRole", "constructInfo": { "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" @@ -451,7 +451,7 @@ }, "Resource": { "id": "Resource", - "path": "ec2-instance-test-stack/Instance/InstanceRole/Resource", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceRole/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::Role", "aws:cdk:cloudformation:props": { @@ -470,7 +470,7 @@ "tags": [ { "key": "Name", - "value": "ec2-instance-test-stack/Instance" + "value": "ec2-instance-placementgroup-stack/Instance" } ] } @@ -488,7 +488,7 @@ }, "InstanceProfile": { "id": "InstanceProfile", - "path": "ec2-instance-test-stack/Instance/InstanceProfile", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceProfile", "attributes": { "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", "aws:cdk:cloudformation:props": { @@ -506,7 +506,7 @@ }, "Resource": { "id": "Resource", - "path": "ec2-instance-test-stack/Instance/Resource", + "path": "ec2-instance-placementgroup-stack/Instance/Resource", "attributes": { "aws:cdk:cloudformation:type": "AWS::EC2::Instance", "aws:cdk:cloudformation:props": { @@ -539,7 +539,7 @@ "tags": [ { "key": "Name", - "value": "ec2-instance-test-stack/Instance" + "value": "ec2-instance-placementgroup-stack/Instance" } ], "userData": { @@ -560,7 +560,7 @@ }, "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": "ec2-instance-test-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", + "path": "ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", "version": "0.0.0" @@ -568,7 +568,7 @@ }, "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": "ec2-instance-test-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", + "path": "ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", "constructInfo": { "fqn": "aws-cdk-lib.Resource", "version": "0.0.0" @@ -576,7 +576,7 @@ }, "BootstrapVersion": { "id": "BootstrapVersion", - "path": "ec2-instance-test-stack/BootstrapVersion", + "path": "ec2-instance-placementgroup-stack/BootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnParameter", "version": "0.0.0" @@ -584,7 +584,7 @@ }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", - "path": "ec2-instance-test-stack/CheckBootstrapVersion", + "path": "ec2-instance-placementgroup-stack/CheckBootstrapVersion", "constructInfo": { "fqn": "aws-cdk-lib.CfnRule", "version": "0.0.0" diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts index 977cc22d295a0..72ec124053d10 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts @@ -7,7 +7,7 @@ import { import * as integ from '@aws-cdk/integ-tests-alpha'; const app = new App(); -const stack = new Stack(app, 'ec2-instance-test-stack'); +const stack = new Stack(app, 'ec2-instance-placementgroup-stack'); // create a placementGroup const pg = new PlacementGroup(stack, 'test-pg', { From 36421b8fbe63021109c1e899148cbc4c4588b110 Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 15:37:10 +0000 Subject: [PATCH 08/13] minor --- packages/aws-cdk-lib/aws-ec2/lib/instance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts index 5b486b6ecf376..a9a78e858fdba 100644 --- a/packages/aws-cdk-lib/aws-ec2/lib/instance.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/instance.ts @@ -320,7 +320,7 @@ export interface InstanceProps { /** * The placement group that you want to launch the instance into. * - * @default - no placement group will be added. + * @default - no placement group will be used for this instance. */ readonly placementGroup?: IPlacementGroup; } From 329dc3fa231b22b68867ddb86a5dbd0dfe744df8 Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 16:25:26 +0000 Subject: [PATCH 09/13] remove snapshots --- ...efaultTestDeployAssertCBC801E8.assets.json | 19 - ...aultTestDeployAssertCBC801E8.template.json | 36 - .../__entrypoint__.js | 155 ---- .../index.js | 1 - .../cdk.out | 1 - ...-instance-placementgroup-stack.assets.json | 32 - ...nstance-placementgroup-stack.template.json | 443 ------------ .../integ.json | 12 - .../manifest.json | 227 ------ .../tree.json | 667 ------------------ 10 files changed, 1593 deletions(-) delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json delete mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json deleted file mode 100644 index d808c87102d3f..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "version": "36.0.0", - "files": { - "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { - "source": { - "path": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json deleted file mode 100644 index ad9d0fb73d1dd..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "Parameters": { - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js deleted file mode 100644 index 02033f55cf612..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js +++ /dev/null @@ -1,155 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.withRetries = exports.handler = exports.external = void 0; -const https = require("https"); -const url = require("url"); -// for unit tests -exports.external = { - sendHttpRequest: defaultSendHttpRequest, - log: defaultLog, - includeStackTraces: true, - userHandlerIndex: './index', -}; -const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function handler(event, context) { - const sanitizedEvent = { ...event, ResponseURL: '...' }; - exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { - exports.external.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - // invoke the user handler. this is intentionally inside the try-catch to - // ensure that if there is an error it's reported as a failure to - // cloudformation (otherwise cfn waits). - // eslint-disable-next-line @typescript-eslint/no-require-imports - const userHandler = require(exports.external.userHandlerIndex).handler; - const result = await userHandler(sanitizedEvent, context); - // validate user response and create the combined event - const responseEvent = renderResponse(event, result); - // submit to cfn as success - await submitResponse('SUCCESS', responseEvent); - } - catch (e) { - const resp = { - ...event, - Reason: exports.external.includeStackTraces ? e.stack : e.message, - }; - if (!resp.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', resp); - } -} -exports.handler = handler; -function renderResponse(cfnRequest, handlerResponse = {}) { - // if physical ID is not returned, we have some defaults for you based - // on the request type. - const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; - // if we are in DELETE and physical ID was changed, it's an error. - if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { - throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); - } - // merge request event and result event (result prevails). - return { - ...cfnRequest, - ...handlerResponse, - PhysicalResourceId: physicalResourceId, - }; -} -async function submitResponse(status, event) { - const json = { - Status: status, - Reason: event.Reason ?? status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: event.NoEcho, - Data: event.Data, - }; - const parsedUrl = url.parse(event.ResponseURL); - const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; - exports.external.log('submit response to cloudformation', loggingSafeUrl, json); - const responseBody = JSON.stringify(json); - const req = { - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { - 'content-type': '', - 'content-length': Buffer.byteLength(responseBody, 'utf8'), - }, - }; - const retryOptions = { - attempts: 5, - sleep: 1000, - }; - await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); -} -async function defaultSendHttpRequest(options, requestBody) { - return new Promise((resolve, reject) => { - try { - const request = https.request(options, (response) => { - response.resume(); // Consume the response but don't care about it - if (!response.statusCode || response.statusCode >= 400) { - reject(new Error(`Unsuccessful HTTP response: ${response.statusCode}`)); - } - else { - resolve(); - } - }); - request.on('error', reject); - request.write(requestBody); - request.end(); - } - catch (e) { - reject(e); - } - }); -} -function defaultLog(fmt, ...params) { - // eslint-disable-next-line no-console - console.log(fmt, ...params); -} -function withRetries(options, fn) { - return async (...xs) => { - let attempts = options.attempts; - let ms = options.sleep; - while (true) { - try { - return await fn(...xs); - } - catch (e) { - if (attempts-- <= 0) { - throw e; - } - await sleep(Math.floor(Math.random() * ms)); - ms *= 2; - } - } - }; -} -exports.withRetries = withRetries; -async function sleep(ms) { - return new Promise((ok) => setTimeout(ok, ms)); -} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js deleted file mode 100644 index 013bcaffd8fe5..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";var I=Object.create;var t=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var G=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},n=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!l.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return r};var R=(r,e,o)=>(o=r!=null?I(g(r)):{},n(e||!r||!r.__esModule?t(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>n(t({},"__esModule",{value:!0}),r);var k={};G(k,{handler:()=>f});module.exports=S(k);var a=R(require("@aws-sdk/client-ec2")),u=new a.EC2({});function c(r,e){return{GroupId:r,IpPermissions:[{UserIdGroupPairs:[{GroupId:r,UserId:e}],IpProtocol:"-1"}]}}function d(r){return{GroupId:r,IpPermissions:[{IpRanges:[{CidrIp:"0.0.0.0/0"}],IpProtocol:"-1"}]}}async function f(r){let e=r.ResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.Account;switch(r.RequestType){case"Create":return p(e,o);case"Update":return h(r);case"Delete":return m(e,o)}}async function h(r){let e=r.OldResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.DefaultSecurityGroupId;e!==o&&(await m(e,r.ResourceProperties.Account),await p(o,r.ResourceProperties.Account))}async function p(r,e){try{await u.revokeSecurityGroupEgress(d(r))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}try{await u.revokeSecurityGroupIngress(c(r,e))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}}async function m(r,e){await u.authorizeSecurityGroupIngress(c(r,e)),await u.authorizeSecurityGroupEgress(d(r))}0&&(module.exports={handler}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out deleted file mode 100644 index 1f0068d32659a..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out +++ /dev/null @@ -1 +0,0 @@ -{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json deleted file mode 100644 index 07d9f26a70a68..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "version": "36.0.0", - "files": { - "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1": { - "source": { - "path": "asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1", - "packaging": "zip" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - }, - "2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012": { - "source": { - "path": "ec2-instance-placementgroup-stack.template.json", - "packaging": "file" - }, - "destinations": { - "current_account-current_region": { - "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012.json", - "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" - } - } - } - }, - "dockerImages": {} -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json deleted file mode 100644 index a24e485df9b9a..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json +++ /dev/null @@ -1,443 +0,0 @@ -{ - "Resources": { - "testpgC328A9B8": { - "Type": "AWS::EC2::PlacementGroup", - "Properties": { - "Strategy": "spread" - } - }, - "VPCB9E5F0B4": { - "Type": "AWS::EC2::VPC", - "Properties": { - "CidrBlock": "10.0.0.0/16", - "EnableDnsHostnames": true, - "EnableDnsSupport": true, - "InstanceTenancy": "default", - "Tags": [ - { - "Key": "Name", - "Value": "ec2-instance-placementgroup-stack/VPC" - } - ] - } - }, - "VPCpublicSubnet1Subnet325F50B2": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.0.0/17", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" - } - ], - "VpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "VPCpublicSubnet1RouteTableF591E248": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" - } - ], - "VpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "VPCpublicSubnet1RouteTableAssociationBFFA43B7": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VPCpublicSubnet1RouteTableF591E248" - }, - "SubnetId": { - "Ref": "VPCpublicSubnet1Subnet325F50B2" - } - } - }, - "VPCpublicSubnet1DefaultRoute19059ECD": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VPCIGWB7E252D3" - }, - "RouteTableId": { - "Ref": "VPCpublicSubnet1RouteTableF591E248" - } - }, - "DependsOn": [ - "VPCVPCGW99B986DC" - ] - }, - "VPCpublicSubnet2Subnet2B2DFF71": { - "Type": "AWS::EC2::Subnet", - "Properties": { - "AvailabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "CidrBlock": "10.0.128.0/17", - "MapPublicIpOnLaunch": true, - "Tags": [ - { - "Key": "aws-cdk:subnet-name", - "Value": "public" - }, - { - "Key": "aws-cdk:subnet-type", - "Value": "Public" - }, - { - "Key": "Name", - "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" - } - ], - "VpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "VPCpublicSubnet2RouteTable55DAB1BB": { - "Type": "AWS::EC2::RouteTable", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" - } - ], - "VpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "VPCpublicSubnet2RouteTableAssociation0849466B": { - "Type": "AWS::EC2::SubnetRouteTableAssociation", - "Properties": { - "RouteTableId": { - "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" - }, - "SubnetId": { - "Ref": "VPCpublicSubnet2Subnet2B2DFF71" - } - } - }, - "VPCpublicSubnet2DefaultRoute9ED4D6BC": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "GatewayId": { - "Ref": "VPCIGWB7E252D3" - }, - "RouteTableId": { - "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" - } - }, - "DependsOn": [ - "VPCVPCGW99B986DC" - ] - }, - "VPCIGWB7E252D3": { - "Type": "AWS::EC2::InternetGateway", - "Properties": { - "Tags": [ - { - "Key": "Name", - "Value": "ec2-instance-placementgroup-stack/VPC" - } - ] - } - }, - "VPCVPCGW99B986DC": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "InternetGatewayId": { - "Ref": "VPCIGWB7E252D3" - }, - "VpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "VPCRestrictDefaultSecurityGroupCustomResource59474679": { - "Type": "Custom::VpcRestrictDefaultSG", - "Properties": { - "ServiceToken": { - "Fn::GetAtt": [ - "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E", - "Arn" - ] - }, - "DefaultSecurityGroupId": { - "Fn::GetAtt": [ - "VPCB9E5F0B4", - "DefaultSecurityGroup" - ] - }, - "Account": { - "Ref": "AWS::AccountId" - } - }, - "UpdateReplacePolicy": "Delete", - "DeletionPolicy": "Delete" - }, - "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": "lambda.amazonaws.com" - } - } - ] - }, - "ManagedPolicyArns": [ - { - "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - } - ], - "Policies": [ - { - "PolicyName": "Inline", - "PolicyDocument": { - "Version": "2012-10-17", - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "ec2:AuthorizeSecurityGroupIngress", - "ec2:AuthorizeSecurityGroupEgress", - "ec2:RevokeSecurityGroupIngress", - "ec2:RevokeSecurityGroupEgress" - ], - "Resource": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ec2:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":security-group/", - { - "Fn::GetAtt": [ - "VPCB9E5F0B4", - "DefaultSecurityGroup" - ] - } - ] - ] - } - ] - } - ] - } - } - ] - } - }, - "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "S3Bucket": { - "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" - }, - "S3Key": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip" - }, - "Timeout": 900, - "MemorySize": 128, - "Handler": "__entrypoint__.handler", - "Role": { - "Fn::GetAtt": [ - "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0", - "Arn" - ] - }, - "Runtime": "nodejs18.x", - "Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group" - }, - "DependsOn": [ - "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" - ] - }, - "InstanceInstanceSecurityGroupF0E2D5BE": { - "Type": "AWS::EC2::SecurityGroup", - "Properties": { - "GroupDescription": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", - "SecurityGroupEgress": [ - { - "CidrIp": "0.0.0.0/0", - "Description": "Allow all outbound traffic by default", - "IpProtocol": "-1" - } - ], - "Tags": [ - { - "Key": "Name", - "Value": "ec2-instance-placementgroup-stack/Instance" - } - ], - "VpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "InstanceInstanceRoleE9785DE5": { - "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": "ec2-instance-placementgroup-stack/Instance" - } - ] - } - }, - "InstanceInstanceProfileAB5AEF02": { - "Type": "AWS::IAM::InstanceProfile", - "Properties": { - "Roles": [ - { - "Ref": "InstanceInstanceRoleE9785DE5" - } - ] - } - }, - "InstanceC1063A87": { - "Type": "AWS::EC2::Instance", - "Properties": { - "AvailabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "IamInstanceProfile": { - "Ref": "InstanceInstanceProfileAB5AEF02" - }, - "ImageId": { - "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "InstanceType": "t3.nano", - "SecurityGroupIds": [ - { - "Fn::GetAtt": [ - "InstanceInstanceSecurityGroupF0E2D5BE", - "GroupId" - ] - } - ], - "SubnetId": { - "Ref": "VPCpublicSubnet1Subnet325F50B2" - }, - "Tags": [ - { - "Key": "Name", - "Value": "ec2-instance-placementgroup-stack/Instance" - } - ], - "UserData": { - "Fn::Base64": "#!/bin/bash" - } - }, - "DependsOn": [ - "InstanceInstanceRoleE9785DE5" - ] - } - }, - "Parameters": { - "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64" - }, - "BootstrapVersion": { - "Type": "AWS::SSM::Parameter::Value", - "Default": "/cdk-bootstrap/hnb659fds/version", - "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" - } - }, - "Rules": { - "CheckBootstrapVersion": { - "Assertions": [ - { - "Assert": { - "Fn::Not": [ - { - "Fn::Contains": [ - [ - "1", - "2", - "3", - "4", - "5" - ], - { - "Ref": "BootstrapVersion" - } - ] - } - ] - }, - "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." - } - ] - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json deleted file mode 100644 index bdfd95e2e5065..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": "36.0.0", - "testCases": { - "Ec2InstancePlacementGroup/DefaultTest": { - "stacks": [ - "ec2-instance-placementgroup-stack" - ], - "assertionStack": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert", - "assertionStackName": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8" - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json deleted file mode 100644 index b857601e0083d..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json +++ /dev/null @@ -1,227 +0,0 @@ -{ - "version": "36.0.0", - "artifacts": { - "ec2-instance-placementgroup-stack.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "ec2-instance-placementgroup-stack.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "ec2-instance-placementgroup-stack": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "ec2-instance-placementgroup-stack.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}/2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "ec2-instance-placementgroup-stack.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "ec2-instance-placementgroup-stack.assets" - ], - "metadata": { - "/ec2-instance-placementgroup-stack/test-pg/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "testpgC328A9B8" - } - ], - "/ec2-instance-placementgroup-stack/VPC/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCB9E5F0B4" - } - ], - "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCpublicSubnet1Subnet325F50B2" - } - ], - "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCpublicSubnet1RouteTableF591E248" - } - ], - "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCpublicSubnet1RouteTableAssociationBFFA43B7" - } - ], - "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCpublicSubnet1DefaultRoute19059ECD" - } - ], - "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/Subnet": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCpublicSubnet2Subnet2B2DFF71" - } - ], - "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTable": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCpublicSubnet2RouteTable55DAB1BB" - } - ], - "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTableAssociation": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCpublicSubnet2RouteTableAssociation0849466B" - } - ], - "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/DefaultRoute": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCpublicSubnet2DefaultRoute9ED4D6BC" - } - ], - "/ec2-instance-placementgroup-stack/VPC/IGW": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCIGWB7E252D3" - } - ], - "/ec2-instance-placementgroup-stack/VPC/VPCGW": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCVPCGW99B986DC" - } - ], - "/ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default": [ - { - "type": "aws:cdk:logicalId", - "data": "VPCRestrictDefaultSecurityGroupCustomResource59474679" - } - ], - "/ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" - } - ], - "/ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ - { - "type": "aws:cdk:logicalId", - "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" - } - ], - "/ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "InstanceInstanceSecurityGroupF0E2D5BE" - } - ], - "/ec2-instance-placementgroup-stack/Instance/InstanceRole/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "InstanceInstanceRoleE9785DE5" - } - ], - "/ec2-instance-placementgroup-stack/Instance/InstanceProfile": [ - { - "type": "aws:cdk:logicalId", - "data": "InstanceInstanceProfileAB5AEF02" - } - ], - "/ec2-instance-placementgroup-stack/Instance/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "InstanceC1063A87" - } - ], - "/ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ - { - "type": "aws:cdk:logicalId", - "data": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" - } - ], - "/ec2-instance-placementgroup-stack/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/ec2-instance-placementgroup-stack/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "ec2-instance-placementgroup-stack" - }, - "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets": { - "type": "cdk:asset-manifest", - "properties": { - "file": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8": { - "type": "aws:cloudformation:stack", - "environment": "aws://unknown-account/unknown-region", - "properties": { - "templateFile": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.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}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", - "requiresBootstrapStackVersion": 6, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", - "additionalDependencies": [ - "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets" - ], - "lookupRole": { - "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", - "requiresBootstrapStackVersion": 8, - "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" - } - }, - "dependencies": [ - "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets" - ], - "metadata": { - "/Ec2InstancePlacementGroup/DefaultTest/DeployAssert/BootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "BootstrapVersion" - } - ], - "/Ec2InstancePlacementGroup/DefaultTest/DeployAssert/CheckBootstrapVersion": [ - { - "type": "aws:cdk:logicalId", - "data": "CheckBootstrapVersion" - } - ] - }, - "displayName": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert" - }, - "Tree": { - "type": "cdk:tree", - "properties": { - "file": "tree.json" - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json deleted file mode 100644 index a5605fd808322..0000000000000 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json +++ /dev/null @@ -1,667 +0,0 @@ -{ - "version": "tree-0.1", - "tree": { - "id": "App", - "path": "", - "children": { - "ec2-instance-placementgroup-stack": { - "id": "ec2-instance-placementgroup-stack", - "path": "ec2-instance-placementgroup-stack", - "children": { - "test-pg": { - "id": "test-pg", - "path": "ec2-instance-placementgroup-stack/test-pg", - "children": { - "Resource": { - "id": "Resource", - "path": "ec2-instance-placementgroup-stack/test-pg/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::PlacementGroup", - "aws:cdk:cloudformation:props": { - "strategy": "spread" - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnPlacementGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.PlacementGroup", - "version": "0.0.0" - } - }, - "VPC": { - "id": "VPC", - "path": "ec2-instance-placementgroup-stack/VPC", - "children": { - "Resource": { - "id": "Resource", - "path": "ec2-instance-placementgroup-stack/VPC/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPC", - "aws:cdk:cloudformation:props": { - "cidrBlock": "10.0.0.0/16", - "enableDnsHostnames": true, - "enableDnsSupport": true, - "instanceTenancy": "default", - "tags": [ - { - "key": "Name", - "value": "ec2-instance-placementgroup-stack/VPC" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", - "version": "0.0.0" - } - }, - "publicSubnet1": { - "id": "publicSubnet1", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1", - "children": { - "Subnet": { - "id": "Subnet", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.0.0/17", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" - } - ], - "vpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/Acl", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" - } - ], - "vpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VPCpublicSubnet1RouteTableF591E248" - }, - "subnetId": { - "Ref": "VPCpublicSubnet1Subnet325F50B2" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "VPCIGWB7E252D3" - }, - "routeTableId": { - "Ref": "VPCpublicSubnet1RouteTableF591E248" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "publicSubnet2": { - "id": "publicSubnet2", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2", - "children": { - "Subnet": { - "id": "Subnet", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/Subnet", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", - "aws:cdk:cloudformation:props": { - "availabilityZone": { - "Fn::Select": [ - 1, - { - "Fn::GetAZs": "" - } - ] - }, - "cidrBlock": "10.0.128.0/17", - "mapPublicIpOnLaunch": true, - "tags": [ - { - "key": "aws-cdk:subnet-name", - "value": "public" - }, - { - "key": "aws-cdk:subnet-type", - "value": "Public" - }, - { - "key": "Name", - "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" - } - ], - "vpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", - "version": "0.0.0" - } - }, - "Acl": { - "id": "Acl", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/Acl", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" - } - }, - "RouteTable": { - "id": "RouteTable", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" - } - ], - "vpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", - "version": "0.0.0" - } - }, - "RouteTableAssociation": { - "id": "RouteTableAssociation", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTableAssociation", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", - "aws:cdk:cloudformation:props": { - "routeTableId": { - "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" - }, - "subnetId": { - "Ref": "VPCpublicSubnet2Subnet2B2DFF71" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" - } - }, - "DefaultRoute": { - "id": "DefaultRoute", - "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/DefaultRoute", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "gatewayId": { - "Ref": "VPCIGWB7E252D3" - }, - "routeTableId": { - "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", - "version": "0.0.0" - } - }, - "IGW": { - "id": "IGW", - "path": "ec2-instance-placementgroup-stack/VPC/IGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", - "aws:cdk:cloudformation:props": { - "tags": [ - { - "key": "Name", - "value": "ec2-instance-placementgroup-stack/VPC" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", - "version": "0.0.0" - } - }, - "VPCGW": { - "id": "VPCGW", - "path": "ec2-instance-placementgroup-stack/VPC/VPCGW", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "internetGatewayId": { - "Ref": "VPCIGWB7E252D3" - }, - "vpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - }, - "RestrictDefaultSecurityGroupCustomResource": { - "id": "RestrictDefaultSecurityGroupCustomResource", - "path": "ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource", - "children": { - "Default": { - "id": "Default", - "path": "ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.CustomResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.Vpc", - "version": "0.0.0" - } - }, - "Custom::VpcRestrictDefaultSGCustomResourceProvider": { - "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", - "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider", - "children": { - "Staging": { - "id": "Staging", - "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", - "constructInfo": { - "fqn": "aws-cdk-lib.AssetStaging", - "version": "0.0.0" - } - }, - "Role": { - "id": "Role", - "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnResource", - "version": "0.0.0" - } - }, - "Handler": { - "id": "Handler", - "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnResource", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "0.0.0" - } - }, - "Instance": { - "id": "Instance", - "path": "ec2-instance-placementgroup-stack/Instance", - "children": { - "InstanceSecurityGroup": { - "id": "InstanceSecurityGroup", - "path": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", - "children": { - "Resource": { - "id": "Resource", - "path": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", - "aws:cdk:cloudformation:props": { - "groupDescription": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", - "securityGroupEgress": [ - { - "cidrIp": "0.0.0.0/0", - "description": "Allow all outbound traffic by default", - "ipProtocol": "-1" - } - ], - "tags": [ - { - "key": "Name", - "value": "ec2-instance-placementgroup-stack/Instance" - } - ], - "vpcId": { - "Ref": "VPCB9E5F0B4" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", - "version": "0.0.0" - } - }, - "InstanceRole": { - "id": "InstanceRole", - "path": "ec2-instance-placementgroup-stack/Instance/InstanceRole", - "children": { - "ImportInstanceRole": { - "id": "ImportInstanceRole", - "path": "ec2-instance-placementgroup-stack/Instance/InstanceRole/ImportInstanceRole", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "ec2-instance-placementgroup-stack/Instance/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": "ec2-instance-placementgroup-stack/Instance" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "0.0.0" - } - }, - "InstanceProfile": { - "id": "InstanceProfile", - "path": "ec2-instance-placementgroup-stack/Instance/InstanceProfile", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", - "aws:cdk:cloudformation:props": { - "roles": [ - { - "Ref": "InstanceInstanceRoleE9785DE5" - } - ] - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", - "version": "0.0.0" - } - }, - "Resource": { - "id": "Resource", - "path": "ec2-instance-placementgroup-stack/Instance/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Instance", - "aws:cdk:cloudformation:props": { - "availabilityZone": { - "Fn::Select": [ - 0, - { - "Fn::GetAZs": "" - } - ] - }, - "iamInstanceProfile": { - "Ref": "InstanceInstanceProfileAB5AEF02" - }, - "imageId": { - "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" - }, - "instanceType": "t3.nano", - "securityGroupIds": [ - { - "Fn::GetAtt": [ - "InstanceInstanceSecurityGroupF0E2D5BE", - "GroupId" - ] - } - ], - "subnetId": { - "Ref": "VPCpublicSubnet1Subnet325F50B2" - }, - "tags": [ - { - "key": "Name", - "value": "ec2-instance-placementgroup-stack/Instance" - } - ], - "userData": { - "Fn::Base64": "#!/bin/bash" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "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": "ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", - "constructInfo": { - "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": "ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" - } - }, - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "ec2-instance-placementgroup-stack/BootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "ec2-instance-placementgroup-stack/CheckBootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" - } - }, - "Ec2InstancePlacementGroup": { - "id": "Ec2InstancePlacementGroup", - "path": "Ec2InstancePlacementGroup", - "children": { - "DefaultTest": { - "id": "DefaultTest", - "path": "Ec2InstancePlacementGroup/DefaultTest", - "children": { - "Default": { - "id": "Default", - "path": "Ec2InstancePlacementGroup/DefaultTest/Default", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" - } - }, - "DeployAssert": { - "id": "DeployAssert", - "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert", - "children": { - "BootstrapVersion": { - "id": "BootstrapVersion", - "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert/BootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" - } - }, - "CheckBootstrapVersion": { - "id": "CheckBootstrapVersion", - "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert/CheckBootstrapVersion", - "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", - "version": "0.0.0" - } - }, - "Tree": { - "id": "Tree", - "path": "Tree", - "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.3.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.App", - "version": "0.0.0" - } - } -} \ No newline at end of file From 6727e83133c33a381add51fbeb52a21f256141ab Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 16:35:26 +0000 Subject: [PATCH 10/13] add integ test --- ...efaultTestDeployAssertCBC801E8.assets.json | 19 + ...aultTestDeployAssertCBC801E8.template.json | 36 + .../__entrypoint__.js | 155 ++++ .../index.js | 1 + .../cdk.out | 1 + ...-instance-placementgroup-stack.assets.json | 32 + ...nstance-placementgroup-stack.template.json | 443 ++++++++++++ .../integ.json | 12 + .../manifest.json | 227 ++++++ .../tree.json | 667 ++++++++++++++++++ .../test/integ.instance-placement-group.ts | 4 +- 11 files changed, 1595 insertions(+), 2 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json new file mode 100644 index 0000000000000..d808c87102d3f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js new file mode 100644 index 0000000000000..02033f55cf612 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/__entrypoint__.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withRetries = exports.handler = exports.external = void 0; +const https = require("https"); +const url = require("url"); +// for unit tests +exports.external = { + sendHttpRequest: defaultSendHttpRequest, + log: defaultLog, + includeStackTraces: true, + userHandlerIndex: './index', +}; +const CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +const MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function handler(event, context) { + const sanitizedEvent = { ...event, ResponseURL: '...' }; + exports.external.log(JSON.stringify(sanitizedEvent, undefined, 2)); + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === CREATE_FAILED_PHYSICAL_ID_MARKER) { + exports.external.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + // invoke the user handler. this is intentionally inside the try-catch to + // ensure that if there is an error it's reported as a failure to + // cloudformation (otherwise cfn waits). + // eslint-disable-next-line @typescript-eslint/no-require-imports + const userHandler = require(exports.external.userHandlerIndex).handler; + const result = await userHandler(sanitizedEvent, context); + // validate user response and create the combined event + const responseEvent = renderResponse(event, result); + // submit to cfn as success + await submitResponse('SUCCESS', responseEvent); + } + catch (e) { + const resp = { + ...event, + Reason: exports.external.includeStackTraces ? e.stack : e.message, + }; + if (!resp.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + exports.external.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + resp.PhysicalResourceId = CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + exports.external.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(event)}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', resp); + } +} +exports.handler = handler; +function renderResponse(cfnRequest, handlerResponse = {}) { + // if physical ID is not returned, we have some defaults for you based + // on the request type. + const physicalResourceId = handlerResponse.PhysicalResourceId ?? cfnRequest.PhysicalResourceId ?? cfnRequest.RequestId; + // if we are in DELETE and physical ID was changed, it's an error. + if (cfnRequest.RequestType === 'Delete' && physicalResourceId !== cfnRequest.PhysicalResourceId) { + throw new Error(`DELETE: cannot change the physical resource ID from "${cfnRequest.PhysicalResourceId}" to "${handlerResponse.PhysicalResourceId}" during deletion`); + } + // merge request event and result event (result prevails). + return { + ...cfnRequest, + ...handlerResponse, + PhysicalResourceId: physicalResourceId, + }; +} +async function submitResponse(status, event) { + const json = { + Status: status, + Reason: event.Reason ?? status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: event.NoEcho, + Data: event.Data, + }; + const parsedUrl = url.parse(event.ResponseURL); + const loggingSafeUrl = `${parsedUrl.protocol}//${parsedUrl.hostname}/${parsedUrl.pathname}?***`; + exports.external.log('submit response to cloudformation', loggingSafeUrl, json); + const responseBody = JSON.stringify(json); + const req = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': Buffer.byteLength(responseBody, 'utf8'), + }, + }; + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await withRetries(retryOptions, exports.external.sendHttpRequest)(req, responseBody); +} +async function defaultSendHttpRequest(options, requestBody) { + return new Promise((resolve, reject) => { + try { + const request = https.request(options, (response) => { + response.resume(); // Consume the response but don't care about it + if (!response.statusCode || response.statusCode >= 400) { + reject(new Error(`Unsuccessful HTTP response: ${response.statusCode}`)); + } + else { + resolve(); + } + }); + request.on('error', reject); + request.write(requestBody); + request.end(); + } + catch (e) { + reject(e); + } + }); +} +function defaultLog(fmt, ...params) { + // eslint-disable-next-line no-console + console.log(fmt, ...params); +} +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +exports.withRetries = withRetries; +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js new file mode 100644 index 0000000000000..013bcaffd8fe5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1/index.js @@ -0,0 +1 @@ +"use strict";var I=Object.create;var t=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var G=(r,e)=>{for(var o in e)t(r,o,{get:e[o],enumerable:!0})},n=(r,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of P(e))!l.call(r,s)&&s!==o&&t(r,s,{get:()=>e[s],enumerable:!(i=y(e,s))||i.enumerable});return r};var R=(r,e,o)=>(o=r!=null?I(g(r)):{},n(e||!r||!r.__esModule?t(o,"default",{value:r,enumerable:!0}):o,r)),S=r=>n(t({},"__esModule",{value:!0}),r);var k={};G(k,{handler:()=>f});module.exports=S(k);var a=R(require("@aws-sdk/client-ec2")),u=new a.EC2({});function c(r,e){return{GroupId:r,IpPermissions:[{UserIdGroupPairs:[{GroupId:r,UserId:e}],IpProtocol:"-1"}]}}function d(r){return{GroupId:r,IpPermissions:[{IpRanges:[{CidrIp:"0.0.0.0/0"}],IpProtocol:"-1"}]}}async function f(r){let e=r.ResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.Account;switch(r.RequestType){case"Create":return p(e,o);case"Update":return h(r);case"Delete":return m(e,o)}}async function h(r){let e=r.OldResourceProperties.DefaultSecurityGroupId,o=r.ResourceProperties.DefaultSecurityGroupId;e!==o&&(await m(e,r.ResourceProperties.Account),await p(o,r.ResourceProperties.Account))}async function p(r,e){try{await u.revokeSecurityGroupEgress(d(r))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}try{await u.revokeSecurityGroupIngress(c(r,e))}catch(o){if(o.name!=="InvalidPermission.NotFound")throw o}}async function m(r,e){await u.authorizeSecurityGroupIngress(c(r,e)),await u.authorizeSecurityGroupEgress(d(r))}0&&(module.exports={handler}); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json new file mode 100644 index 0000000000000..07d9f26a70a68 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json @@ -0,0 +1,32 @@ +{ + "version": "36.0.0", + "files": { + "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1": { + "source": { + "path": "asset.bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012": { + "source": { + "path": "ec2-instance-placementgroup-stack.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json new file mode 100644 index 0000000000000..a24e485df9b9a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json @@ -0,0 +1,443 @@ +{ + "Resources": { + "testpgC328A9B8": { + "Type": "AWS::EC2::PlacementGroup", + "Properties": { + "Strategy": "spread" + } + }, + "VPCB9E5F0B4": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-placementgroup-stack/VPC" + } + ] + } + }, + "VPCpublicSubnet1Subnet325F50B2": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/17", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCpublicSubnet1RouteTableF591E248": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCpublicSubnet1RouteTableAssociationBFFA43B7": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCpublicSubnet1RouteTableF591E248" + }, + "SubnetId": { + "Ref": "VPCpublicSubnet1Subnet325F50B2" + } + } + }, + "VPCpublicSubnet1DefaultRoute19059ECD": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "RouteTableId": { + "Ref": "VPCpublicSubnet1RouteTableF591E248" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCpublicSubnet2Subnet2B2DFF71": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/17", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCpublicSubnet2RouteTable55DAB1BB": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCpublicSubnet2RouteTableAssociation0849466B": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" + }, + "SubnetId": { + "Ref": "VPCpublicSubnet2Subnet2B2DFF71" + } + } + }, + "VPCpublicSubnet2DefaultRoute9ED4D6BC": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "RouteTableId": { + "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCIGWB7E252D3": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-placementgroup-stack/VPC" + } + ] + } + }, + "VPCVPCGW99B986DC": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "VPCRestrictDefaultSecurityGroupCustomResource59474679": { + "Type": "Custom::VpcRestrictDefaultSG", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E", + "Arn" + ] + }, + "DefaultSecurityGroupId": { + "Fn::GetAtt": [ + "VPCB9E5F0B4", + "DefaultSecurityGroup" + ] + }, + "Account": { + "Ref": "AWS::AccountId" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ], + "Policies": [ + { + "PolicyName": "Inline", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Effect": "Allow", + "Action": [ + "ec2:AuthorizeSecurityGroupIngress", + "ec2:AuthorizeSecurityGroupEgress", + "ec2:RevokeSecurityGroupIngress", + "ec2:RevokeSecurityGroupEgress" + ], + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ec2:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":security-group/", + { + "Fn::GetAtt": [ + "VPCB9E5F0B4", + "DefaultSecurityGroup" + ] + } + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "bde7b5c89cb43285f884c94f0b9e17cdb0f5eb5345005114dd60342e0b8a85a1.zip" + }, + "Timeout": 900, + "MemorySize": 128, + "Handler": "__entrypoint__.handler", + "Role": { + "Fn::GetAtt": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0", + "Arn" + ] + }, + "Runtime": "nodejs18.x", + "Description": "Lambda function for removing all inbound/outbound rules from the VPC default security group" + }, + "DependsOn": [ + "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + ] + }, + "InstanceInstanceSecurityGroupF0E2D5BE": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-placementgroup-stack/Instance" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "InstanceInstanceRoleE9785DE5": { + "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": "ec2-instance-placementgroup-stack/Instance" + } + ] + } + }, + "InstanceInstanceProfileAB5AEF02": { + "Type": "AWS::IAM::InstanceProfile", + "Properties": { + "Roles": [ + { + "Ref": "InstanceInstanceRoleE9785DE5" + } + ] + } + }, + "InstanceC1063A87": { + "Type": "AWS::EC2::Instance", + "Properties": { + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "IamInstanceProfile": { + "Ref": "InstanceInstanceProfileAB5AEF02" + }, + "ImageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "InstanceType": "t3.nano", + "SecurityGroupIds": [ + { + "Fn::GetAtt": [ + "InstanceInstanceSecurityGroupF0E2D5BE", + "GroupId" + ] + } + ], + "SubnetId": { + "Ref": "VPCpublicSubnet1Subnet325F50B2" + }, + "Tags": [ + { + "Key": "Name", + "Value": "ec2-instance-placementgroup-stack/Instance" + } + ], + "UserData": { + "Fn::Base64": "#!/bin/bash" + } + }, + "DependsOn": [ + "InstanceInstanceRoleE9785DE5" + ] + } + }, + "Parameters": { + "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64" + }, + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json new file mode 100644 index 0000000000000..bdfd95e2e5065 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "Ec2InstancePlacementGroup/DefaultTest": { + "stacks": [ + "ec2-instance-placementgroup-stack" + ], + "assertionStack": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert", + "assertionStackName": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json new file mode 100644 index 0000000000000..b857601e0083d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json @@ -0,0 +1,227 @@ +{ + "version": "36.0.0", + "artifacts": { + "ec2-instance-placementgroup-stack.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "ec2-instance-placementgroup-stack.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "ec2-instance-placementgroup-stack": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "ec2-instance-placementgroup-stack.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}/2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "ec2-instance-placementgroup-stack.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "ec2-instance-placementgroup-stack.assets" + ], + "metadata": { + "/ec2-instance-placementgroup-stack/test-pg/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "testpgC328A9B8" + } + ], + "/ec2-instance-placementgroup-stack/VPC/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCB9E5F0B4" + } + ], + "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet1Subnet325F50B2" + } + ], + "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet1RouteTableF591E248" + } + ], + "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet1RouteTableAssociationBFFA43B7" + } + ], + "/ec2-instance-placementgroup-stack/VPC/publicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet1DefaultRoute19059ECD" + } + ], + "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet2Subnet2B2DFF71" + } + ], + "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet2RouteTable55DAB1BB" + } + ], + "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet2RouteTableAssociation0849466B" + } + ], + "/ec2-instance-placementgroup-stack/VPC/publicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCpublicSubnet2DefaultRoute9ED4D6BC" + } + ], + "/ec2-instance-placementgroup-stack/VPC/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCIGWB7E252D3" + } + ], + "/ec2-instance-placementgroup-stack/VPC/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCVPCGW99B986DC" + } + ], + "/ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCRestrictDefaultSecurityGroupCustomResource59474679" + } + ], + "/ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderRole26592FE0" + } + ], + "/ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomVpcRestrictDefaultSGCustomResourceProviderHandlerDC833E5E" + } + ], + "/ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "InstanceInstanceSecurityGroupF0E2D5BE" + } + ], + "/ec2-instance-placementgroup-stack/Instance/InstanceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "InstanceInstanceRoleE9785DE5" + } + ], + "/ec2-instance-placementgroup-stack/Instance/InstanceProfile": [ + { + "type": "aws:cdk:logicalId", + "data": "InstanceInstanceProfileAB5AEF02" + } + ], + "/ec2-instance-placementgroup-stack/Instance/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "InstanceC1063A87" + } + ], + "/ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter": [ + { + "type": "aws:cdk:logicalId", + "data": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + } + ], + "/ec2-instance-placementgroup-stack/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/ec2-instance-placementgroup-stack/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "ec2-instance-placementgroup-stack" + }, + "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.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}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "Ec2InstancePlacementGroupDefaultTestDeployAssertCBC801E8.assets" + ], + "metadata": { + "/Ec2InstancePlacementGroup/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/Ec2InstancePlacementGroup/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json new file mode 100644 index 0000000000000..a5605fd808322 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json @@ -0,0 +1,667 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "ec2-instance-placementgroup-stack": { + "id": "ec2-instance-placementgroup-stack", + "path": "ec2-instance-placementgroup-stack", + "children": { + "test-pg": { + "id": "test-pg", + "path": "ec2-instance-placementgroup-stack/test-pg", + "children": { + "Resource": { + "id": "Resource", + "path": "ec2-instance-placementgroup-stack/test-pg/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::PlacementGroup", + "aws:cdk:cloudformation:props": { + "strategy": "spread" + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnPlacementGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PlacementGroup", + "version": "0.0.0" + } + }, + "VPC": { + "id": "VPC", + "path": "ec2-instance-placementgroup-stack/VPC", + "children": { + "Resource": { + "id": "Resource", + "path": "ec2-instance-placementgroup-stack/VPC/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "ec2-instance-placementgroup-stack/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", + "version": "0.0.0" + } + }, + "publicSubnet1": { + "id": "publicSubnet1", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/17", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCpublicSubnet1RouteTableF591E248" + }, + "subnetId": { + "Ref": "VPCpublicSubnet1Subnet325F50B2" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "routeTableId": { + "Ref": "VPCpublicSubnet1RouteTableF591E248" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "publicSubnet2": { + "id": "publicSubnet2", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/17", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/Acl", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ec2-instance-placementgroup-stack/VPC/publicSubnet2" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" + }, + "subnetId": { + "Ref": "VPCpublicSubnet2Subnet2B2DFF71" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "routeTableId": { + "Ref": "VPCpublicSubnet2RouteTable55DAB1BB" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "ec2-instance-placementgroup-stack/VPC/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "ec2-instance-placementgroup-stack/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "ec2-instance-placementgroup-stack/VPC/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Ref": "VPCIGWB7E252D3" + }, + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + }, + "RestrictDefaultSecurityGroupCustomResource": { + "id": "RestrictDefaultSecurityGroupCustomResource", + "path": "ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource", + "children": { + "Default": { + "id": "Default", + "path": "ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.Vpc", + "version": "0.0.0" + } + }, + "Custom::VpcRestrictDefaultSGCustomResourceProvider": { + "id": "Custom::VpcRestrictDefaultSGCustomResourceProvider", + "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider", + "children": { + "Staging": { + "id": "Staging", + "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", + "constructInfo": { + "fqn": "aws-cdk-lib.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.CustomResourceProviderBase", + "version": "0.0.0" + } + }, + "Instance": { + "id": "Instance", + "path": "ec2-instance-placementgroup-stack/Instance", + "children": { + "InstanceSecurityGroup": { + "id": "InstanceSecurityGroup", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "ec2-instance-placementgroup-stack/Instance/InstanceSecurityGroup", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "tags": [ + { + "key": "Name", + "value": "ec2-instance-placementgroup-stack/Instance" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "InstanceRole": { + "id": "InstanceRole", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceRole", + "children": { + "ImportInstanceRole": { + "id": "ImportInstanceRole", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceRole/ImportInstanceRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "ec2-instance-placementgroup-stack/Instance/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": "ec2-instance-placementgroup-stack/Instance" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "InstanceProfile": { + "id": "InstanceProfile", + "path": "ec2-instance-placementgroup-stack/Instance/InstanceProfile", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::InstanceProfile", + "aws:cdk:cloudformation:props": { + "roles": [ + { + "Ref": "InstanceInstanceRoleE9785DE5" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "ec2-instance-placementgroup-stack/Instance/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Instance", + "aws:cdk:cloudformation:props": { + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "iamInstanceProfile": { + "Ref": "InstanceInstanceProfileAB5AEF02" + }, + "imageId": { + "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" + }, + "instanceType": "t3.nano", + "securityGroupIds": [ + { + "Fn::GetAtt": [ + "InstanceInstanceSecurityGroupF0E2D5BE", + "GroupId" + ] + } + ], + "subnetId": { + "Ref": "VPCpublicSubnet1Subnet325F50B2" + }, + "tags": [ + { + "key": "Name", + "value": "ec2-instance-placementgroup-stack/Instance" + } + ], + "userData": { + "Fn::Base64": "#!/bin/bash" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "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": "ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", + "constructInfo": { + "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": "ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "ec2-instance-placementgroup-stack/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "ec2-instance-placementgroup-stack/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "Ec2InstancePlacementGroup": { + "id": "Ec2InstancePlacementGroup", + "path": "Ec2InstancePlacementGroup", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "Ec2InstancePlacementGroup/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "Ec2InstancePlacementGroup/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "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.instance-placement-group.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts index 72ec124053d10..7ad41fdcbcad5 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.ts @@ -4,7 +4,7 @@ import { PlacementGroup, PlacementGroupStrategy, InstanceClass, InstanceSize, SubnetType, } from 'aws-cdk-lib/aws-ec2'; -import * as integ from '@aws-cdk/integ-tests-alpha'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; const app = new App(); const stack = new Stack(app, 'ec2-instance-placementgroup-stack'); @@ -33,6 +33,6 @@ new Instance(stack, 'Instance', { placementGroup: pg, }); -new integ.IntegTest(app, 'Ec2InstancePlacementGroup', { +new IntegTest(app, 'Ec2InstancePlacementGroup', { testCases: [stack], }); From e3d063e4a7bddd8b786d42ff8d1aea9d1eae900a Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 17:12:39 +0000 Subject: [PATCH 11/13] update intet tests --- ...-instance-placementgroup-stack.assets.json | 4 +- ...nstance-placementgroup-stack.template.json | 6 + .../manifest.json | 2 +- .../tree.json | 170 +++++++++--------- 4 files changed, 97 insertions(+), 85 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json index 07d9f26a70a68..edf23541eac55 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.assets.json @@ -14,7 +14,7 @@ } } }, - "2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012": { + "24814e48df850d30fbc3f870ad87a95388feacda9a5268077e97ea607886d0f7": { "source": { "path": "ec2-instance-placementgroup-stack.template.json", "packaging": "file" @@ -22,7 +22,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012.json", + "objectKey": "24814e48df850d30fbc3f870ad87a95388feacda9a5268077e97ea607886d0f7.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.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json index a24e485df9b9a..066eea424d00d 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/ec2-instance-placementgroup-stack.template.json @@ -376,6 +376,12 @@ "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" }, "InstanceType": "t3.nano", + "PlacementGroupName": { + "Fn::GetAtt": [ + "testpgC328A9B8", + "GroupName" + ] + }, "SecurityGroupIds": [ { "Fn::GetAtt": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json index b857601e0083d..2bfc11b5531bd 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.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}/2be02d1f0f4014b660694bcbd83fe7df172634c84e54eeba91e64ed20c8ef012.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/24814e48df850d30fbc3f870ad87a95388feacda9a5268077e97ea607886d0f7.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json index a5605fd808322..7a88b9ee6b883 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-placement-group.js.snapshot/tree.json @@ -22,14 +22,14 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnPlacementGroup", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.PlacementGroup", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "VPC": { @@ -55,8 +55,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnVPC", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "publicSubnet1": { @@ -99,16 +99,16 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Acl": { "id": "Acl", "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet1/Acl", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "RouteTable": { @@ -129,8 +129,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "RouteTableAssociation": { @@ -148,8 +148,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "DefaultRoute": { @@ -168,14 +168,14 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "publicSubnet2": { @@ -218,16 +218,16 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSubnet", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Acl": { "id": "Acl", "path": "ec2-instance-placementgroup-stack/VPC/publicSubnet2/Acl", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "RouteTable": { @@ -248,8 +248,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "RouteTableAssociation": { @@ -267,8 +267,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSubnetRouteTableAssociation", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "DefaultRoute": { @@ -287,14 +287,14 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.PublicSubnet", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "IGW": { @@ -312,8 +312,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "VPCGW": { @@ -331,8 +331,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "RestrictDefaultSecurityGroupCustomResource": { @@ -343,20 +343,20 @@ "id": "Default", "path": "ec2-instance-placementgroup-stack/VPC/RestrictDefaultSecurityGroupCustomResource/Default", "constructInfo": { - "fqn": "aws-cdk-lib.CfnResource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.CustomResource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.Vpc", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Custom::VpcRestrictDefaultSGCustomResourceProvider": { @@ -367,30 +367,30 @@ "id": "Staging", "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Staging", "constructInfo": { - "fqn": "aws-cdk-lib.AssetStaging", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Role": { "id": "Role", "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Role", "constructInfo": { - "fqn": "aws-cdk-lib.CfnResource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Handler": { "id": "Handler", "path": "ec2-instance-placementgroup-stack/Custom::VpcRestrictDefaultSGCustomResourceProvider/Handler", "constructInfo": { - "fqn": "aws-cdk-lib.CfnResource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.CustomResourceProviderBase", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Instance": { @@ -427,14 +427,14 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnSecurityGroup", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.SecurityGroup", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "InstanceRole": { @@ -445,8 +445,8 @@ "id": "ImportInstanceRole", "path": "ec2-instance-placementgroup-stack/Instance/InstanceRole/ImportInstanceRole", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Resource": { @@ -476,14 +476,14 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnRole", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.Role", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "InstanceProfile": { @@ -500,8 +500,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_iam.CfnInstanceProfile", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Resource": { @@ -525,6 +525,12 @@ "Ref": "SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter" }, "instanceType": "t3.nano", + "placementGroupName": { + "Fn::GetAtt": [ + "testpgC328A9B8", + "GroupName" + ] + }, "securityGroupIds": [ { "Fn::GetAtt": [ @@ -548,52 +554,52 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnInstance", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.Instance", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.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": "ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118.Parameter", "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.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": "ec2-instance-placementgroup-stack/SsmParameterValue:--aws--service--ami-amazon-linux-latest--al2023-ami-kernel-6.1-x86_64:C96584B6-F00A-464E-AD19-53AFF4B05118", "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "ec2-instance-placementgroup-stack/BootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "ec2-instance-placementgroup-stack/CheckBootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "Ec2InstancePlacementGroup": { @@ -620,22 +626,22 @@ "id": "BootstrapVersion", "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnParameter", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } }, "CheckBootstrapVersion": { "id": "CheckBootstrapVersion", "path": "Ec2InstancePlacementGroup/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { - "fqn": "aws-cdk-lib.CfnRule", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.Stack", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } }, @@ -660,8 +666,8 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.App", - "version": "0.0.0" + "fqn": "constructs.Construct", + "version": "10.3.0" } } } \ No newline at end of file From 3ca7d4286a35fd8238440401a2e8cc94b6f77529 Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Tue, 21 May 2024 17:49:37 +0000 Subject: [PATCH 12/13] update README --- packages/aws-cdk-lib/aws-ec2/README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ec2/README.md b/packages/aws-cdk-lib/aws-ec2/README.md index ecf0b30683638..28dfb0927ddde 100644 --- a/packages/aws-cdk-lib/aws-ec2/README.md +++ b/packages/aws-cdk-lib/aws-ec2/README.md @@ -1526,12 +1526,16 @@ const host = new ec2.BastionHostLinux(this, 'BastionHost', { Specify `placementGroup` to enable the placement group support: ```ts fixture=with-vpc -declare const pg: ec2.PlacementGroup; +declare const instanceType: ec2.InstanceType; + +const pg = new ec2.PlacementGroup(stack, 'test-pg', { + strategy: PlacementGroupStrategy.SPREAD, +}); new Instance(stack, 'Instance', { vpc, - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.NANO), - machineImage: MachineImage.latestAmazonLinux2023(), + instanceType, + machineImage: ec2.MachineImage.latestAmazonLinux2023(), placementGroup: pg, }); ``` From b5302eb9c72653e976c81fde8ae204607ba2354b Mon Sep 17 00:00:00 2001 From: Pahud Hsieh Date: Wed, 22 May 2024 04:17:42 +0000 Subject: [PATCH 13/13] update README --- packages/aws-cdk-lib/aws-ec2/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ec2/README.md b/packages/aws-cdk-lib/aws-ec2/README.md index 28dfb0927ddde..bc0b11422bb2a 100644 --- a/packages/aws-cdk-lib/aws-ec2/README.md +++ b/packages/aws-cdk-lib/aws-ec2/README.md @@ -1528,11 +1528,11 @@ Specify `placementGroup` to enable the placement group support: ```ts fixture=with-vpc declare const instanceType: ec2.InstanceType; -const pg = new ec2.PlacementGroup(stack, 'test-pg', { - strategy: PlacementGroupStrategy.SPREAD, +const pg = new ec2.PlacementGroup(this, 'test-pg', { + strategy: ec2.PlacementGroupStrategy.SPREAD, }); -new Instance(stack, 'Instance', { +new ec2.Instance(this, 'Instance', { vpc, instanceType, machineImage: ec2.MachineImage.latestAmazonLinux2023(),