From 0d4d44f01fc67bfc60e0b0994c7130ffbc4b65e5 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 30 Sep 2020 13:35:49 +0100 Subject: [PATCH 1/2] feat(ec2): c6 graviton2 instance classes (#10558) Adding support for [EC2 C6g](https://aws.amazon.com/ec2/instance-types/c6/) instance classes. Closes #10372 --- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-ec2/README.md | 6 ++--- .../@aws-cdk/aws-ec2/lib/instance-types.ts | 22 +++++++++++++++++++ .../@aws-cdk/aws-ec2/test/instance.test.ts | 4 ++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/@aws-cdk/aws-ec2/README.md b/packages/@aws-cdk/aws-ec2/README.md index 27dcabd8b69cd..2704685007a0e 100644 --- a/packages/@aws-cdk/aws-ec2/README.md +++ b/packages/@aws-cdk/aws-ec2/README.md @@ -281,8 +281,8 @@ const igwId = vpc.internetGatewayId; For a VPC with only `ISOLATED` subnets, this value will be undefined. -This is only supported for VPC's created in the stack - currently you're -unable to get the ID for imported VPC's. To do that you'd have to specifically +This is only supported for VPCs created in the stack - currently you're +unable to get the ID for imported VPCs. To do that you'd have to specifically look up the Internet Gateway by name, which would require knowing the name beforehand. @@ -700,7 +700,7 @@ ec2.CloudFormationInit.fromElements( ### Bastion Hosts A bastion host functions as an instance used to access servers and resources in a VPC without open up the complete VPC on a network level. -You can use bastion hosts using a standard SSH connection targetting port 22 on the host. As an alternative, you can connect the SSH connection +You can use bastion hosts using a standard SSH connection targeting port 22 on the host. As an alternative, you can connect the SSH connection feature of AWS Systems Manager Session Manager, which does not need an opened security group. (https://aws.amazon.com/about-aws/whats-new/2019/07/session-manager-launches-tunneling-support-for-ssh-and-scp/) A default bastion host for use via SSM can be configured like: diff --git a/packages/@aws-cdk/aws-ec2/lib/instance-types.ts b/packages/@aws-cdk/aws-ec2/lib/instance-types.ts index 28b8c9ee46554..7ad1d2420aa26 100644 --- a/packages/@aws-cdk/aws-ec2/lib/instance-types.ts +++ b/packages/@aws-cdk/aws-ec2/lib/instance-types.ts @@ -198,6 +198,28 @@ export enum InstanceClass { */ C5N = 'c5n', + /** + * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors + */ + COMPUTE6_GRAVITON2 = 'c6g', + + /** + * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors + */ + C6G = 'c6g', + + /** + * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors + * and local NVME drive + */ + COMPUTE6_GRAVITON2_NVME_DRIVE = 'c6gd', + + /** + * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors + * and local NVME drive + */ + C6GD = 'c6gd', + /** * Storage-optimized instances, 2nd generation */ diff --git a/packages/@aws-cdk/aws-ec2/test/instance.test.ts b/packages/@aws-cdk/aws-ec2/test/instance.test.ts index 18e84a910c4f4..f1a0da3ba62f9 100644 --- a/packages/@aws-cdk/aws-ec2/test/instance.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/instance.test.ts @@ -19,12 +19,12 @@ nodeunitShim({ new Instance(stack, 'Instance', { vpc, machineImage: new AmazonLinuxImage(), - instanceType: InstanceType.of(InstanceClass.T3, InstanceSize.LARGE), + instanceType: InstanceType.of(InstanceClass.COMPUTE6_GRAVITON2, InstanceSize.LARGE), }); // THEN cdkExpect(stack).to(haveResource('AWS::EC2::Instance', { - InstanceType: 't3.large', + InstanceType: 'c6g.large', })); test.done(); From 44c1f208d4f284102bd5ce60025ab15c4af6081f Mon Sep 17 00:00:00 2001 From: Ayush Goyal Date: Wed, 30 Sep 2020 18:32:37 +0530 Subject: [PATCH 2/2] fix(cli): listing same stack multiple times fails (#10554) Fixes listing same stack multiple times fails for cdk commands closes #9667 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/cxapp/cloud-assembly.ts | 1 + packages/aws-cdk/test/api/cloud-assembly.test.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/packages/aws-cdk/lib/api/cxapp/cloud-assembly.ts b/packages/aws-cdk/lib/api/cxapp/cloud-assembly.ts index ca8bf10d96375..2ce9fef9b29ce 100644 --- a/packages/aws-cdk/lib/api/cxapp/cloud-assembly.ts +++ b/packages/aws-cdk/lib/api/cxapp/cloud-assembly.ts @@ -69,6 +69,7 @@ export class CloudAssembly { public async selectStacks(selectors: string[], options: SelectStacksOptions): Promise { selectors = selectors.filter(s => s != null); // filter null/undefined + selectors = [...new Set(selectors)]; // make them unique const stacks = this.assembly.stacks; if (stacks.length === 0) { diff --git a/packages/aws-cdk/test/api/cloud-assembly.test.ts b/packages/aws-cdk/test/api/cloud-assembly.test.ts index 3e192e3514c23..e0882882cc55e 100644 --- a/packages/aws-cdk/test/api/cloud-assembly.test.ts +++ b/packages/aws-cdk/test/api/cloud-assembly.test.ts @@ -60,6 +60,19 @@ test('select behavior: single', async () => { .rejects.toThrow('Since this app includes more than a single stack, specify which stacks to use (wildcards are supported)'); }); +test('select behavior: repeat', async () => { + // GIVEN + const cxasm = await testCloudAssembly(); + + // WHEN + const x = await cxasm.selectStacks(['withouterrors', 'withouterrors'], { + defaultBehavior: DefaultSelection.AllStacks, + }); + + // THEN + expect(x.stackCount).toBe(1); +}); + async function testCloudAssembly({ env }: { env?: string, versionReporting?: boolean } = {}) { const cloudExec = new MockCloudExecutable({ stacks: [{