From 73710e2c9ddb78eda8fca3d682ca2774434682ac Mon Sep 17 00:00:00 2001 From: Matthew Kuntz Date: Wed, 14 Apr 2021 17:17:48 -0400 Subject: [PATCH 1/2] fix(ec2): r5ad instance-type has incorrect value The InstanceClass enum has icorrectly mapped values for R5AD instances. --- packages/@aws-cdk/aws-ec2/lib/instance-types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/aws-ec2/lib/instance-types.ts b/packages/@aws-cdk/aws-ec2/lib/instance-types.ts index c9a7f8ac74509..fc3b3b411d7b3 100644 --- a/packages/@aws-cdk/aws-ec2/lib/instance-types.ts +++ b/packages/@aws-cdk/aws-ec2/lib/instance-types.ts @@ -141,12 +141,12 @@ export enum InstanceClass { /** * Memory optimized instances based on AMD EPYC with local NVME drive, 5th generation */ - MEMORY5_AMD_NVME_DRIVE = 'r5a', + MEMORY5_AMD_NVME_DRIVE = 'r5ad', /** * Memory optimized instances based on AMD EPYC with local NVME drive, 5th generation */ - R5AD = 'r5a', + R5AD = 'r5ad', /** * Memory optimized instances that are also EBS-optimized, 5th generation From 94d9ea9df27d2cdf6d98dfad2fbc86344e88f013 Mon Sep 17 00:00:00 2001 From: Matthew Kuntz Date: Wed, 14 Apr 2021 17:41:18 -0400 Subject: [PATCH 2/2] fix(ec2): r5ad instance-type has incorrect value add unit tests covering a sample of nvme instance classes --- .../@aws-cdk/aws-ec2/test/instance.test.ts | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/packages/@aws-cdk/aws-ec2/test/instance.test.ts b/packages/@aws-cdk/aws-ec2/test/instance.test.ts index 13fa2554eaabd..d5b77e01ad0ea 100644 --- a/packages/@aws-cdk/aws-ec2/test/instance.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/instance.test.ts @@ -138,6 +138,39 @@ nodeunitShim({ test.done(); }, + 'instances with local NVME drive are correctly named'(test: Test) { + // GIVEN + const sampleInstanceClassKeys = [{ + key: 'R5D', + value: 'r5d', + }, { + key: 'MEMORY5_NVME_DRIVE', + value: 'r5d', + }, { + key: 'R5AD', + value: 'r5ad', + }, { + key: 'MEMORY5_AMD_NVME_DRIVE', + value: 'r5ad', + }, { + key: 'M5AD', + value: 'm5ad', + }, { + key: 'STANDARD5_AMD_NVME_DRIVE', + value: 'm5ad', + }]; // A sample of instances with NVME drives + + for (const instanceClass of sampleInstanceClassKeys) { + // WHEN + const key = instanceClass.key as keyof(typeof InstanceClass); + const instanceType = InstanceClass[key]; + + // THEN + expect(instanceType).toBe(instanceClass.value); + } + + test.done(); + }, 'instance architecture throws an error when instance type is invalid'(test: Test) { // GIVEN const malformedInstanceTypes = ['t4', 't4g.nano.', 't4gnano', ''];