From b0346a4b7dc14a53167378b37b06888a0b75fa7c Mon Sep 17 00:00:00 2001 From: Yathi <511386+yuth@users.noreply.github.com> Date: Thu, 30 Jun 2022 03:12:52 -0700 Subject: [PATCH] refactor: update enum types to remove duplicate member values (#19320) CDK has some enums which use the same value for different enum members. This is done to support friendly names for EC2 instance and Subnet type. Having same value for differnt members causes the typescript compiler to ignore the members with same value and causes JSII not to generate the enum members in other languages. To fix this [JSII will throw an error](https://github.com/aws/jsii/pull/3412) when enum members have the same value. Updating CDK code to ensure the build pass when this change lands in JSII re #https://github.com/aws/jsii/pull/3412 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../@aws-cdk/aws-ec2/lib/instance-types.ts | 321 +++++++++++++----- .../@aws-cdk/aws-ec2/lib/machine-image.ts | 19 +- packages/@aws-cdk/aws-ec2/lib/port.ts | 16 +- packages/@aws-cdk/aws-ec2/lib/util.ts | 8 +- packages/@aws-cdk/aws-ec2/lib/vpc.ts | 16 +- .../@aws-cdk/aws-ec2/lib/windows-versions.ts | 26 +- .../@aws-cdk/aws-ec2/test/instance.test.ts | 21 +- 7 files changed, 313 insertions(+), 114 deletions(-) diff --git a/packages/@aws-cdk/aws-ec2/lib/instance-types.ts b/packages/@aws-cdk/aws-ec2/lib/instance-types.ts index 1407693f5a5ef..81f23307868ca 100644 --- a/packages/@aws-cdk/aws-ec2/lib/instance-types.ts +++ b/packages/@aws-cdk/aws-ec2/lib/instance-types.ts @@ -11,7 +11,7 @@ export enum InstanceClass { /** * Standard instances, 3rd generation */ - STANDARD3 = 'm3', + STANDARD3 = 'standard3', /** * Standard instances, 3rd generation @@ -21,7 +21,7 @@ export enum InstanceClass { /** * Standard instances, 4th generation */ - STANDARD4 = 'm4', + STANDARD4 = 'standard4', /** * Standard instances, 4th generation @@ -31,7 +31,7 @@ export enum InstanceClass { /** * Standard instances, 5th generation */ - STANDARD5 = 'm5', + STANDARD5 = 'standard5', /** * Standard instances, 5th generation @@ -41,7 +41,7 @@ export enum InstanceClass { /** * Standard instances with local NVME drive, 5th generation */ - STANDARD5_NVME_DRIVE = 'm5d', + STANDARD5_NVME_DRIVE = 'standard5-nvme-drive', /** * Standard instances with local NVME drive, 5th generation @@ -51,7 +51,7 @@ export enum InstanceClass { /** * Standard instances based on AMD EPYC, 5th generation */ - STANDARD5_AMD = 'm5a', + STANDARD5_AMD = 'standard5-amd', /** * Standard instances based on AMD EPYC, 5th generation @@ -61,7 +61,7 @@ export enum InstanceClass { /** * Standard instances based on AMD EPYC with local NVME drive, 5th generation */ - STANDARD5_AMD_NVME_DRIVE = 'm5ad', + STANDARD5_AMD_NVME_DRIVE = 'standard5-amd-nvme-drive', /** * Standard instances based on AMD EPYC with local NVME drive, 5th generation @@ -71,7 +71,7 @@ export enum InstanceClass { /** * Standard instances for high performance computing, 5th generation */ - STANDARD5_HIGH_PERFORMANCE = 'm5n', + STANDARD5_HIGH_PERFORMANCE = 'standard5-high-performance', /** * Standard instances for high performance computing, 5th generation @@ -81,7 +81,7 @@ export enum InstanceClass { /** * Standard instances with local NVME drive for high performance computing, 5th generation */ - STANDARD5_NVME_DRIVE_HIGH_PERFORMANCE = 'm5dn', + STANDARD5_NVME_DRIVE_HIGH_PERFORMANCE = 'standard5-nvme-drive-high-performance', /** * Standard instances with local NVME drive for high performance computing, 5th generation @@ -91,7 +91,7 @@ export enum InstanceClass { /** * Standard instances with high memory and compute capacity based on Intel Xeon Scalable (Cascade Lake) processors, 5nd generation */ - STANDARD5_HIGH_COMPUTE = 'm5zn', + STANDARD5_HIGH_COMPUTE = 'standard5-high-compute', /** * Standard instances with high memory and compute capacity based on Intel Xeon Scalable (Cascade Lake) processors, 5nd generation @@ -101,7 +101,7 @@ export enum InstanceClass { /** * Memory optimized instances, 3rd generation */ - MEMORY3 = 'r3', + MEMORY3 = 'memory3', /** * Memory optimized instances, 3rd generation @@ -111,7 +111,7 @@ export enum InstanceClass { /** * Memory optimized instances, 4th generation */ - MEMORY4 = 'r4', + MEMORY4 = 'memory4', /** * Memory optimized instances, 4th generation @@ -121,7 +121,7 @@ export enum InstanceClass { /** * Memory optimized instances, 5th generation */ - MEMORY5 = 'r5', + MEMORY5 = 'memory5', /** * Memory optimized instances, 5th generation @@ -131,7 +131,7 @@ export enum InstanceClass { /** * Memory optimized instances, 6th generation with Intel Xeon Scalable processors (3rd generation processors code named Ice Lake) */ - MEMORY6_INTEL = 'r6i', + MEMORY6_INTEL = 'memory6-intel', /** * Memory optimized instances, 6th generation with Intel Xeon Scalable processors (3rd generation processors code named Ice Lake) @@ -141,7 +141,7 @@ export enum InstanceClass { /** * Memory optimized instances for high performance computing, 5th generation */ - MEMORY5_HIGH_PERFORMANCE = 'r5n', + MEMORY5_HIGH_PERFORMANCE = 'memory5-high-performance', /** * Memory optimized instances for high performance computing, 5th generation @@ -151,7 +151,7 @@ export enum InstanceClass { /** * Memory optimized instances with local NVME drive, 5th generation */ - MEMORY5_NVME_DRIVE = 'r5d', + MEMORY5_NVME_DRIVE = 'memory5-nvme-drive', /** * Memory optimized instances with local NVME drive, 5th generation @@ -161,7 +161,7 @@ export enum InstanceClass { /** * Memory optimized instances with local NVME drive for high performance computing, 5th generation */ - MEMORY5_NVME_DRIVE_HIGH_PERFORMANCE = 'r5dn', + MEMORY5_NVME_DRIVE_HIGH_PERFORMANCE = 'memory5-nvme-drive-high-performance', /** * Memory optimized instances with local NVME drive for high performance computing, 5th generation @@ -171,7 +171,7 @@ export enum InstanceClass { /** * Memory optimized instances based on AMD EPYC, 5th generation */ - MEMORY5_AMD = 'r5a', + MEMORY5_AMD = 'memory5-amd', /** * Memory optimized instances based on AMD EPYC, 5th generation @@ -181,12 +181,12 @@ export enum InstanceClass { /** * Memory optimized instances based on AMD EPYC with local NVME drive, 5th generation */ - MEMORY5_AMD_NVME_DRIVE = 'r5ad', + MEMORY5_AMD_NVME_DRIVE = 'memory5-amd-nvme-drive', /** * High memory instances (6TB) based on Intel Xeon Platinum 8176M (Skylake) processors, 1st generation */ - HIGH_MEMORY_6TB_1 = 'u-6tb1', + HIGH_MEMORY_6TB_1 = 'high-memory-6tb-1', /** * High memory instances (6TB) based on Intel Xeon Platinum 8176M (Skylake) processors, 1st generation @@ -196,7 +196,7 @@ export enum InstanceClass { /** * High memory instances (9TB) based on Intel Xeon Platinum 8176M (Skylake) processors, 1st generation */ - HIGH_MEMORY_9TB_1 = 'u-9tb1', + HIGH_MEMORY_9TB_1 = 'high-memory-9tb-1', /** * High memory instances (9TB) based on Intel Xeon Platinum 8176M (Skylake) processors, 1st generation @@ -206,7 +206,7 @@ export enum InstanceClass { /** * High memory instances (12TB) based on Intel Xeon Platinum 8176M (Skylake) processors, 1st generation */ - HIGH_MEMORY_12TB_1 = 'u-12tb1', + HIGH_MEMORY_12TB_1 = 'high-memory-12tb-1', /** * High memory instances (12TB) based on Intel Xeon Platinum 8176M (Skylake) processors, 1st generation @@ -216,7 +216,7 @@ export enum InstanceClass { /** * High memory instances (18TB) based on Intel Xeon Scalable (Cascade Lake) processors, 1st generation */ - HIGH_MEMORY_18TB_1 = 'u-18tb1', + HIGH_MEMORY_18TB_1 = 'high-memory-18tb-1', /** * High memory instances (18TB) based on Intel Xeon Scalable (Cascade Lake) processors, 1st generation @@ -226,7 +226,7 @@ export enum InstanceClass { /** * High memory instances (24TB) based on Intel Xeon Scalable (Cascade Lake) processors, 1st generation */ - HIGH_MEMORY_24TB_1 = 'u-24tb1', + HIGH_MEMORY_24TB_1 = 'high-memory-24tb-1', /** * High memory instances (24TB) based on Intel Xeon Scalable (Cascade Lake) processors, 1st generation @@ -241,7 +241,7 @@ export enum InstanceClass { /** * Memory optimized instances that are also EBS-optimized, 5th generation */ - MEMORY5_EBS_OPTIMIZED = 'r5b', + MEMORY5_EBS_OPTIMIZED = 'memory5-ebs-optimized', /** * Memory optimized instances that are also EBS-optimized, 5th generation @@ -251,7 +251,7 @@ export enum InstanceClass { /** * Memory optimized instances, 6th generation with Graviton2 processors */ - MEMORY6_GRAVITON = 'r6g', + MEMORY6_GRAVITON = 'memory6-graviton', /** * Memory optimized instances, 6th generation with Graviton2 processors @@ -261,7 +261,7 @@ export enum InstanceClass { /** * Memory optimized instances, 6th generation with Graviton2 processors and local NVME drive */ - MEMORY6_GRAVITON2_NVME_DRIVE = 'r6gd', + MEMORY6_GRAVITON2_NVME_DRIVE = 'memory6-graviton2-nvme-drive', /** * Memory optimized instances, 6th generation with Graviton2 processors and local NVME drive @@ -271,7 +271,7 @@ export enum InstanceClass { /** * Compute optimized instances, 3rd generation */ - COMPUTE3 = 'c3', + COMPUTE3 = 'compute3', /** * Compute optimized instances, 3rd generation @@ -281,7 +281,7 @@ export enum InstanceClass { /** * Compute optimized instances, 4th generation */ - COMPUTE4 = 'c4', + COMPUTE4 = 'compute4', /** * Compute optimized instances, 4th generation @@ -291,7 +291,7 @@ export enum InstanceClass { /** * Compute optimized instances, 5th generation */ - COMPUTE5 = 'c5', + COMPUTE5 = 'compute5', /** * Compute optimized instances, 5th generation @@ -301,7 +301,7 @@ export enum InstanceClass { /** * Compute optimized instances with local NVME drive, 5th generation */ - COMPUTE5_NVME_DRIVE = 'c5d', + COMPUTE5_NVME_DRIVE = 'compute5-nvme-drive', /** * Compute optimized instances with local NVME drive, 5th generation @@ -311,7 +311,7 @@ export enum InstanceClass { /** * Compute optimized instances based on AMD EPYC, 5th generation */ - COMPUTE5_AMD = 'c5a', + COMPUTE5_AMD = 'compute5-amd', /** * Compute optimized instances based on AMD EPYC, 5th generation @@ -321,7 +321,7 @@ export enum InstanceClass { /** * Compute optimized instances with local NVME drive based on AMD EPYC, 5th generation */ - COMPUTE5_AMD_NVME_DRIVE = 'c5ad', + COMPUTE5_AMD_NVME_DRIVE = 'compute5-amd-nvme-drive', /** * Compute optimized instances with local NVME drive based on AMD EPYC, 5th generation @@ -331,7 +331,7 @@ export enum InstanceClass { /** * Compute optimized instances for high performance computing, 5th generation */ - COMPUTE5_HIGH_PERFORMANCE = 'c5n', + COMPUTE5_HIGH_PERFORMANCE = 'compute5-high-performance', /** * Compute optimized instances for high performance computing, 5th generation @@ -341,7 +341,7 @@ export enum InstanceClass { /** * Compute optimized instances, 6th generation */ - COMPUTE6_INTEL = 'c6i', + COMPUTE6_INTEL = 'compute6-intel', /** * Compute optimized instances, 6th generation @@ -351,7 +351,7 @@ export enum InstanceClass { /** * Compute optimized instances based on AMD EPYC (codename Milan), 6th generation */ - COMPUTE6_AMD = 'c6a', + COMPUTE6_AMD = 'compute6-amd', /** * Compute optimized instances based on AMD EPYC (codename Milan), 6th generation @@ -361,7 +361,7 @@ export enum InstanceClass { /** * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors */ - COMPUTE6_GRAVITON2 = 'c6g', + COMPUTE6_GRAVITON2 = 'compute6-graviton2', /** * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors @@ -372,7 +372,7 @@ export enum InstanceClass { * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors * and local NVME drive */ - COMPUTE6_GRAVITON2_NVME_DRIVE = 'c6gd', + COMPUTE6_GRAVITON2_NVME_DRIVE = 'compute6-graviton2-nvme-drive', /** * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors @@ -384,7 +384,14 @@ export enum InstanceClass { * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors * and high network bandwidth capabilities */ - COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWITH = 'c6gn', + COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWITH = 'compute6-graviton2-high-network-banwidth', + + + /** + * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors + * and high network bandwidth capabilities + */ + COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWIDTH = 'compute6-graviton2-high-network-bandwidth', /** * Compute optimized instances for high performance computing, 6th generation with Graviton2 processors @@ -395,7 +402,7 @@ export enum InstanceClass { /** * Storage-optimized instances, 2nd generation */ - STORAGE2 = 'd2', + STORAGE2 = 'storage2', /** * Storage-optimized instances, 2nd generation @@ -405,7 +412,7 @@ export enum InstanceClass { /** * Storage-optimized instances, 3rd generation */ - STORAGE3 = 'd3', + STORAGE3 = 'storage3', /** * Storage-optimized instances, 3rd generation @@ -415,7 +422,7 @@ export enum InstanceClass { /** * Storage-optimized instances, 3rd generation */ - STORAGE3_ENHANCED_NETWORK = 'd3en', + STORAGE3_ENHANCED_NETWORK = 'storage3-enhanced-network', /** * Storage-optimized instances, 3rd generation @@ -425,7 +432,7 @@ export enum InstanceClass { /** * Storage/compute balanced instances, 1st generation */ - STORAGE_COMPUTE_1 = 'h1', + STORAGE_COMPUTE_1 = 'storage-compute-1', /** * Storage/compute balanced instances, 1st generation @@ -435,7 +442,7 @@ export enum InstanceClass { /** * I/O-optimized instances, 3rd generation */ - IO3 = 'i3', + IO3 = 'io3', /** * I/O-optimized instances, 3rd generation @@ -445,7 +452,7 @@ export enum InstanceClass { /** * I/O-optimized instances with local NVME drive, 3rd generation */ - IO3_DENSE_NVME_DRIVE = 'i3en', + IO3_DENSE_NVME_DRIVE = 'io3-dense-nvme-drive', /** * I/O-optimized instances with local NVME drive, 3rd generation @@ -455,7 +462,7 @@ export enum InstanceClass { /** * I/O-optimized instances with local NVME drive powered by Intel Xeon Scalable processors (code named Ice Lake), 4th generation */ - IO4_INTEL = 'i4i', + IO4_INTEL = 'io4_intel', /** * I/O-optimized instances with local NVME drive powered by Intel Xeon Scalable processors (code named Ice Lake), 4th generation @@ -465,7 +472,7 @@ export enum InstanceClass { /** * Storage optimized instances powered by Graviton2 processor, 4th generation */ - STORAGE4_GRAVITON_NETWORK_OPTIMIZED = 'im4gn', + STORAGE4_GRAVITON_NETWORK_OPTIMIZED = 'storage4-graviton-network-optimized', /** * Storage optimized instances powered by Graviton2 processor, 4th generation @@ -475,7 +482,7 @@ export enum InstanceClass { /** * Storage optimized instances powered by Graviton2 processor, 4th generation */ - STORAGE4_GRAVITON_NETWORK_STORAGE_OPTIMIZED = 'is4gen', + STORAGE4_GRAVITON_NETWORK_STORAGE_OPTIMIZED = 'storage4-graviton-network-storage-optimized', /** * Storage optimized instances powered by Graviton2 processor, 4th generation @@ -485,7 +492,7 @@ export enum InstanceClass { /** * Burstable instances, 2nd generation */ - BURSTABLE2 = 't2', + BURSTABLE2 = 'burstable2', /** * Burstable instances, 2nd generation @@ -495,7 +502,7 @@ export enum InstanceClass { /** * Burstable instances, 3rd generation */ - BURSTABLE3 = 't3', + BURSTABLE3 = 'burstable3', /** * Burstable instances, 3rd generation @@ -505,7 +512,7 @@ export enum InstanceClass { /** * Burstable instances based on AMD EPYC, 3rd generation */ - BURSTABLE3_AMD = 't3a', + BURSTABLE3_AMD = 'burstable3-amd', /** * Burstable instances based on AMD EPYC, 3rd generation @@ -515,7 +522,7 @@ export enum InstanceClass { /** * Burstable instances, 4th generation with Graviton2 processors */ - BURSTABLE4_GRAVITON = 't4g', + BURSTABLE4_GRAVITON = 'burstable4-graviton', /** * Burstable instances, 4th generation with Graviton2 processors @@ -525,7 +532,7 @@ export enum InstanceClass { /** * Memory-intensive instances, 1st generation */ - MEMORY_INTENSIVE_1 = 'x1', + MEMORY_INTENSIVE_1 = 'memory-intensive-1', /** * Memory-intensive instances, 1st generation @@ -535,7 +542,7 @@ export enum InstanceClass { /** * Memory-intensive instances, extended, 1st generation */ - MEMORY_INTENSIVE_1_EXTENDED = 'x1e', + MEMORY_INTENSIVE_1_EXTENDED = 'memory-intensive-1-extended', /** * Memory-intensive instances, 1st generation @@ -547,7 +554,7 @@ export enum InstanceClass { * * This instance type can be used only in RDS. It is not supported in EC2. */ - MEMORY_INTENSIVE_2_GRAVITON2 = 'x2g', + MEMORY_INTENSIVE_2_GRAVITON2 = 'memory-intensive-2-graviton2', /** * Memory-intensive instances, 2nd generation with Graviton2 processors @@ -559,7 +566,7 @@ export enum InstanceClass { /** * Memory-intensive instances, 2nd generation with Graviton2 processors and local NVME drive */ - MEMORY_INTENSIVE_2_GRAVITON2_NVME_DRIVE = 'x2gd', + MEMORY_INTENSIVE_2_GRAVITON2_NVME_DRIVE = 'memory-intensive-2-graviton2-nvme-drive', /** * Memory-intensive instances, 2nd generation with Graviton2 processors and local NVME drive @@ -569,7 +576,7 @@ export enum InstanceClass { /** * Memory-intensive instances with higher network bandwith, local NVME drive, and extended memory. Intel Xeon Scalable (Ice Lake) processors */ - MEMORY_INTENSIVE_2_XT_INTEL = 'x2iedn', + MEMORY_INTENSIVE_2_XT_INTEL = 'memory_intensive_2_xt_intel', /** * Memory-intensive instances with higher network bandwith, local NVME drive, and extended memory. Intel Xeon Scalable (Ice Lake) processors @@ -579,7 +586,7 @@ export enum InstanceClass { /** * Memory-intensive instances with higher network bandwith and local NVME drive, Intel Xeon Scalable (Ice Lake) processors */ - MEMORY_INTENSIVE_2_INTEL = 'x2idn', + MEMORY_INTENSIVE_2_INTEL = 'memory_intensive_2_intel', /** * Memory-intensive instances with higher network bandwith and local NVME drive, Intel Xeon Scalable (Ice Lake) processors @@ -589,7 +596,7 @@ export enum InstanceClass { /** * Memory-intensive instances with higher network bandwith and single-threaded performance, Intel Xeon Scalable (Cascade Lake) processors */ - MEMORY_INTENSIVE_2_XTZ_INTEL = 'x2iezn', + MEMORY_INTENSIVE_2_XTZ_INTEL = 'memory_intensive_2_xtz_intel', /** * Memory-intensive instances with higher network bandwith and single-threaded performance, Intel Xeon Scalable (Cascade Lake) processors @@ -599,7 +606,7 @@ export enum InstanceClass { /** * Instances with customizable hardware acceleration, 1st generation */ - FPGA1 = 'f1', + FPGA1 = 'fpga1', /** * Instances with customizable hardware acceleration, 1st generation @@ -609,7 +616,7 @@ export enum InstanceClass { /** * Graphics-optimized instances, 3rd generation */ - GRAPHICS3 = 'g3', + GRAPHICS3 = 'graphics3', /** * Graphics-optimized instances, 3rd generation @@ -619,7 +626,7 @@ export enum InstanceClass { /** * Graphics-optimized instances with NVME drive for high performance computing, 4th generation */ - GRAPHICS4_NVME_DRIVE_HIGH_PERFORMANCE = 'g4dn', + GRAPHICS4_NVME_DRIVE_HIGH_PERFORMANCE = 'graphics4-nvme-drive-high-performance', /** * Graphics-optimized instances with NVME drive for high performance computing, 4th generation @@ -629,7 +636,7 @@ export enum InstanceClass { /** * Graphics-optimized instances based on AMD EPYC And Radeon Pro GPU (NAVI) with local NVME drive, 4th generation */ - GRAPHICS4_AMD_NVME_DRIVE = 'g4ad', + GRAPHICS4_AMD_NVME_DRIVE = 'graphics4-amd-nvme-drive', /** * Graphics-optimized instances based on AMD EPYC And Radeon Pro GPU (NAVI) with local NVME drive, 4th generation @@ -639,7 +646,7 @@ export enum InstanceClass { /** * Graphics-optimized instances, 5th generation */ - GRAPHICS5 = 'g5', + GRAPHICS5 = 'graphics5', /** * Graphics-optimized instances, 5th generation @@ -649,7 +656,7 @@ export enum InstanceClass { /** * Graphics-optimized instances powered by AWS Graviton2 Processors and NVIDIA T4G Tensor Core GPUs, 5th generation */ - GRAPHICS5_GRAVITON2 = 'g5g', + GRAPHICS5_GRAVITON2 = 'graphics5-graviton2', /** * Graphics-optimized instances powered by AWS Graviton2 Processors and NVIDIA T4G Tensor Core GPUs, 5th generation @@ -659,7 +666,7 @@ export enum InstanceClass { /** * Parallel-processing optimized instances, 2nd generation */ - PARALLEL2 = 'p2', + PARALLEL2 = 'parallel2', /** * Parallel-processing optimized instances, 2nd generation @@ -669,7 +676,7 @@ export enum InstanceClass { /** * Parallel-processing optimized instances, 3nd generation */ - PARALLEL3 = 'p3', + PARALLEL3 = 'parallel3', /** * Parallel-processing optimized instances, 3rd generation @@ -679,7 +686,7 @@ export enum InstanceClass { /** * Parallel-processing optimized instances, 4th generation */ - PARALLEL4 = 'p4d', + PARALLEL4 = 'parallel4', /** * Parallel-processing optimized instances, 4th generation @@ -689,7 +696,7 @@ export enum InstanceClass { /** * Arm processor based instances, 1st generation */ - ARM1 = 'a1', + ARM1 = 'arm1', /** * Arm processor based instances, 1st generation @@ -699,7 +706,7 @@ export enum InstanceClass { /** * Arm processor based instances, 2nd generation */ - STANDARD6_GRAVITON = 'm6g', + STANDARD6_GRAVITON = 'standard6-graviton', /** * Arm processor based instances, 2nd generation @@ -709,7 +716,7 @@ export enum InstanceClass { /** * Standard instances based on Intel (Ice Lake), 6th generation. */ - STANDARD6_INTEL = 'm6i', + STANDARD6_INTEL = 'standard6-intel', /** * Standard instances based on Intel (Ice Lake), 6th generation. @@ -719,7 +726,7 @@ export enum InstanceClass { /** * Standard instances based on 3rd Gen AMD EPYC processors, 6th generation. */ - STANDARD6_AMD = 'm6a', + STANDARD6_AMD = 'standard6-amd', /** * Standard instances based on 3rd Gen AMD EPYC processors, 6th generation. @@ -729,7 +736,7 @@ export enum InstanceClass { /** * Standard instances, 6th generation with Graviton2 processors and local NVME drive */ - STANDARD6_GRAVITON2_NVME_DRIVE = 'm6gd', + STANDARD6_GRAVITON2_NVME_DRIVE = 'standard6-graviton2-nvme-drive', /** * Standard instances, 6th generation with Graviton2 processors and local NVME drive @@ -739,7 +746,7 @@ export enum InstanceClass { /** * High memory and compute capacity instances, 1st generation */ - HIGH_COMPUTE_MEMORY1 = 'z1d', + HIGH_COMPUTE_MEMORY1 = 'high-compute-memory1', /** * High memory and compute capacity instances, 1st generation @@ -749,7 +756,7 @@ export enum InstanceClass { /** * Inferentia Chips based instances for machine learning inference applications, 1st generation */ - INFERENCE1 = 'inf1', + INFERENCE1 = 'inference1', /** * Inferentia Chips based instances for machine learning inference applications, 1st generation @@ -759,7 +766,7 @@ export enum InstanceClass { /** * Macintosh instances built on Apple Mac mini computers, 1st generation with Intel procesors */ - MACINTOSH1_INTEL = 'mac1', + MACINTOSH1_INTEL = 'macintosh1-intel', /** * Macintosh instances built on Apple Mac mini computers, 1st generation with Intel procesors @@ -769,7 +776,7 @@ export enum InstanceClass { /** * Multi-stream video transcoding instances for resolutions up to 4K UHD, 1st generation */ - VIDEO_TRANSCODING1 = 'vt1', + VIDEO_TRANSCODING1 = 'video-transcoding1', /** * Multi-stream video transcoding instances for resolutions up to 4K UHD, 1st generation @@ -779,7 +786,7 @@ export enum InstanceClass { /** * High performance computing based on AMD EPYC, 6th generation */ - HIGH_PERFORMANCE_COMPUTING6_AMD = 'hpc6a', + HIGH_PERFORMANCE_COMPUTING6_AMD = 'high-performance-computing6-amd', /** * High performance computing based on AMD EPYC, 6th generation @@ -933,7 +940,165 @@ export class InstanceType { * classes are available in all regions. */ public static of(instanceClass: InstanceClass, instanceSize: InstanceSize) { - return new InstanceType(`${instanceClass}.${instanceSize}`); + // JSII does not allow enum types to have same value. So to support the enum, the enum with same value has to be mapped later. + const instanceClassMap: Record = { + [InstanceClass.STANDARD3]: 'm3', + [InstanceClass.M3]: 'm3', + [InstanceClass.STANDARD4]: 'm4', + [InstanceClass.M4]: 'm4', + [InstanceClass.STANDARD5]: 'm5', + [InstanceClass.M5]: 'm5', + [InstanceClass.STANDARD5_NVME_DRIVE]: 'm5d', + [InstanceClass.M5D]: 'm5d', + [InstanceClass.STANDARD5_AMD]: 'm5a', + [InstanceClass.M5A]: 'm5a', + [InstanceClass.STANDARD5_AMD_NVME_DRIVE]: 'm5ad', + [InstanceClass.M5AD]: 'm5ad', + [InstanceClass.STANDARD5_HIGH_PERFORMANCE]: 'm5n', + [InstanceClass.M5N]: 'm5n', + [InstanceClass.STANDARD5_NVME_DRIVE_HIGH_PERFORMANCE]: 'm5dn', + [InstanceClass.M5DN]: 'm5dn', + [InstanceClass.STANDARD5_HIGH_COMPUTE]: 'm5zn', + [InstanceClass.M5ZN]: 'm5zn', + [InstanceClass.MEMORY3]: 'r3', + [InstanceClass.R3]: 'r3', + [InstanceClass.MEMORY4]: 'r4', + [InstanceClass.R4]: 'r4', + [InstanceClass.MEMORY5]: 'r5', + [InstanceClass.R5]: 'r5', + [InstanceClass.MEMORY6_INTEL]: 'r6i', + [InstanceClass.R6I]: 'r6i', + [InstanceClass.MEMORY5_HIGH_PERFORMANCE]: 'r5n', + [InstanceClass.R5N]: 'r5n', + [InstanceClass.MEMORY5_NVME_DRIVE]: 'r5d', + [InstanceClass.R5D]: 'r5d', + [InstanceClass.MEMORY5_NVME_DRIVE_HIGH_PERFORMANCE]: 'r5dn', + [InstanceClass.R5DN]: 'r5dn', + [InstanceClass.MEMORY5_AMD]: 'r5a', + [InstanceClass.R5A]: 'r5a', + [InstanceClass.MEMORY5_AMD_NVME_DRIVE]: 'r5ad', + [InstanceClass.R5AD]: 'r5ad', + [InstanceClass.HIGH_MEMORY_6TB_1]: 'u-6tb1', + [InstanceClass.U_6TB1]: 'u-6tb1', + [InstanceClass.HIGH_MEMORY_9TB_1]: 'u-9tb1', + [InstanceClass.U_9TB1]: 'u-9tb1', + [InstanceClass.HIGH_MEMORY_12TB_1]: 'u-12tb1', + [InstanceClass.U_12TB1]: 'u-12tb1', + [InstanceClass.HIGH_MEMORY_18TB_1]: 'u-18tb1', + [InstanceClass.U_18TB1]: 'u-18tb1', + [InstanceClass.HIGH_MEMORY_24TB_1]: 'u-24tb1', + [InstanceClass.U_24TB1]: 'u-24tb1', + [InstanceClass.MEMORY5_EBS_OPTIMIZED]: 'r5b', + [InstanceClass.R5B]: 'r5b', + [InstanceClass.MEMORY6_GRAVITON]: 'r6g', + [InstanceClass.R6G]: 'r6g', + [InstanceClass.MEMORY6_GRAVITON2_NVME_DRIVE]: 'r6gd', + [InstanceClass.R6GD]: 'r6gd', + [InstanceClass.COMPUTE3]: 'c3', + [InstanceClass.C3]: 'c3', + [InstanceClass.COMPUTE4]: 'c4', + [InstanceClass.C4]: 'c4', + [InstanceClass.COMPUTE5]: 'c5', + [InstanceClass.C5]: 'c5', + [InstanceClass.COMPUTE5_NVME_DRIVE]: 'c5d', + [InstanceClass.C5D]: 'c5d', + [InstanceClass.COMPUTE5_AMD]: 'c5a', + [InstanceClass.C5A]: 'c5a', + [InstanceClass.COMPUTE5_AMD_NVME_DRIVE]: 'c5ad', + [InstanceClass.C5AD]: 'c5ad', + [InstanceClass.COMPUTE5_HIGH_PERFORMANCE]: 'c5n', + [InstanceClass.C5N]: 'c5n', + [InstanceClass.COMPUTE6_INTEL]: 'c6i', + [InstanceClass.C6I]: 'c6i', + [InstanceClass.COMPUTE6_AMD]: 'c6a', + [InstanceClass.C6A]: 'c6a', + [InstanceClass.COMPUTE6_GRAVITON2]: 'c6g', + [InstanceClass.C6G]: 'c6g', + [InstanceClass.COMPUTE6_GRAVITON2_NVME_DRIVE]: 'c6gd', + [InstanceClass.C6GD]: 'c6gd', + [InstanceClass.COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWIDTH]: 'c6gdb', + [InstanceClass.COMPUTE6_GRAVITON2_HIGH_NETWORK_BANDWITH]: 'c6gdb', + [InstanceClass.C6GN]: 'c6gn', + [InstanceClass.STORAGE2]: 'd2', + [InstanceClass.D2]: 'd2', + [InstanceClass.STORAGE3]: 'd3', + [InstanceClass.D3]: 'd3', + [InstanceClass.STORAGE3_ENHANCED_NETWORK]: 'd3en', + [InstanceClass.D3EN]: 'd3en', + [InstanceClass.STORAGE_COMPUTE_1]: 'h1', + [InstanceClass.H1]: 'h1', + [InstanceClass.IO3]: 'i3', + [InstanceClass.I3]: 'i3', + [InstanceClass.IO3_DENSE_NVME_DRIVE]: 'i3en', + [InstanceClass.I3EN]: 'i3en', + [InstanceClass.STORAGE4_GRAVITON_NETWORK_OPTIMIZED]: 'im4gn', + [InstanceClass.IM4GN]: 'im4gn', + [InstanceClass.STORAGE4_GRAVITON_NETWORK_STORAGE_OPTIMIZED]: 'is4gen', + [InstanceClass.IS4GEN]: 'is4gen', + [InstanceClass.BURSTABLE2]: 't2', + [InstanceClass.T2]: 't2', + [InstanceClass.BURSTABLE3]: 't3', + [InstanceClass.T3]: 't3', + [InstanceClass.BURSTABLE3_AMD]: 't3a', + [InstanceClass.T3A]: 't3a', + [InstanceClass.BURSTABLE4_GRAVITON]: 't4g', + [InstanceClass.T4G]: 't4g', + [InstanceClass.MEMORY_INTENSIVE_1]: 'x1', + [InstanceClass.X1]: 'x1', + [InstanceClass.MEMORY_INTENSIVE_1_EXTENDED]: 'x1e', + [InstanceClass.X1E]: 'x1e', + [InstanceClass.MEMORY_INTENSIVE_2_GRAVITON2]: 'x2g', + [InstanceClass.X2G]: 'x2g', + [InstanceClass.MEMORY_INTENSIVE_2_GRAVITON2_NVME_DRIVE]: 'x2gd', + [InstanceClass.X2GD]: 'x2gd', + [InstanceClass.FPGA1]: 'f1', + [InstanceClass.F1]: 'f1', + [InstanceClass.GRAPHICS3]: 'g3', + [InstanceClass.G3]: 'g3', + [InstanceClass.GRAPHICS4_NVME_DRIVE_HIGH_PERFORMANCE]: 'g4dn', + [InstanceClass.G4DN]: 'g4dn', + [InstanceClass.GRAPHICS4_AMD_NVME_DRIVE]: 'g4ad', + [InstanceClass.G4AD]: 'g4ad', + [InstanceClass.GRAPHICS5]: 'g5', + [InstanceClass.G5]: 'g5', + [InstanceClass.GRAPHICS5_GRAVITON2]: 'g5g', + [InstanceClass.G5G]: 'g5g', + [InstanceClass.PARALLEL2]: 'p2', + [InstanceClass.P2]: 'p2', + [InstanceClass.PARALLEL3]: 'p3', + [InstanceClass.P3]: 'p3', + [InstanceClass.PARALLEL4]: 'p4d', + [InstanceClass.P4D]: 'p4d', + [InstanceClass.ARM1]: 'a1', + [InstanceClass.A1]: 'a1', + [InstanceClass.STANDARD6_GRAVITON]: 'm6g', + [InstanceClass.M6G]: 'm6g', + [InstanceClass.STANDARD6_INTEL]: 'm6i', + [InstanceClass.M6I]: 'm6i', + [InstanceClass.STANDARD6_AMD]: 'm6a', + [InstanceClass.M6A]: 'm6a', + [InstanceClass.STANDARD6_GRAVITON2_NVME_DRIVE]: 'm6gd', + [InstanceClass.M6GD]: 'm6gd', + [InstanceClass.HIGH_COMPUTE_MEMORY1]: 'z1d', + [InstanceClass.Z1D]: 'z1d', + [InstanceClass.INFERENCE1]: 'inf1', + [InstanceClass.INF1]: 'inf1', + [InstanceClass.MACINTOSH1_INTEL]: 'mac1', + [InstanceClass.MAC1]: 'mac1', + [InstanceClass.VIDEO_TRANSCODING1]: 'vt1', + [InstanceClass.VT1]: 'vt1', + [InstanceClass.HIGH_PERFORMANCE_COMPUTING6_AMD]: 'hpc6a', + [InstanceClass.HPC6A]: 'hpc6a', + [InstanceClass.I4I]: 'i4i', + [InstanceClass.IO4_INTEL]: 'i4i', + [InstanceClass.X2IEDN]: 'x2iedn', + [InstanceClass.MEMORY_INTENSIVE_2_XT_INTEL]: 'x2iedn', + [InstanceClass.X2IDN]: 'x2idn', + [InstanceClass.MEMORY_INTENSIVE_2_INTEL]: 'x2idn', + [InstanceClass.X2IEZN]: 'x2iezn', + [InstanceClass.MEMORY_INTENSIVE_2_XTZ_INTEL]: 'x2iezn', + }; + return new InstanceType(`${instanceClassMap[instanceClass] ?? instanceClass}.${instanceSize}`); } constructor(private readonly instanceTypeIdentifier: string) { diff --git a/packages/@aws-cdk/aws-ec2/lib/machine-image.ts b/packages/@aws-cdk/aws-ec2/lib/machine-image.ts index 789d17c5167bd..43fc3273837e2 100644 --- a/packages/@aws-cdk/aws-ec2/lib/machine-image.ts +++ b/packages/@aws-cdk/aws-ec2/lib/machine-image.ts @@ -271,8 +271,25 @@ export interface WindowsImageProps { * https://aws.amazon.com/blogs/mt/query-for-the-latest-windows-ami-using-systems-manager-parameter-store/ */ export class WindowsImage extends GenericSSMParameterImage { + private static DEPRECATED_VERSION_NAME_MAP: Partial> = { + [WindowsVersion.WINDOWS_SERVER_2016_GERMAL_FULL_BASE]: WindowsVersion.WINDOWS_SERVER_2016_GERMAN_FULL_BASE, + [WindowsVersion.WINDOWS_SERVER_2012_R2_SP1_PORTUGESE_BRAZIL_64BIT_CORE]: WindowsVersion.WINDOWS_SERVER_2012_R2_SP1_PORTUGUESE_BRAZIL_64BIT_CORE, + [WindowsVersion.WINDOWS_SERVER_2016_PORTUGESE_PORTUGAL_FULL_BASE]: WindowsVersion.WINDOWS_SERVER_2016_PORTUGUESE_PORTUGAL_FULL_BASE, + [WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_BRAZIL_64BIT_BASE]: WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_PORTUGUESE_BRAZIL_64BIT_BASE, + [WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_PORTUGAL_64BIT_BASE]: + WindowsVersion.WINDOWS_SERVER_2012_R2_RTM_PORTUGUESE_PORTUGAL_64BIT_BASE, + [WindowsVersion.WINDOWS_SERVER_2016_PORTUGESE_BRAZIL_FULL_BASE]: WindowsVersion.WINDOWS_SERVER_2016_PORTUGUESE_BRAZIL_FULL_BASE, + [WindowsVersion.WINDOWS_SERVER_2012_SP2_PORTUGESE_BRAZIL_64BIT_BASE]: WindowsVersion.WINDOWS_SERVER_2012_SP2_PORTUGUESE_BRAZIL_64BIT_BASE, + [WindowsVersion.WINDOWS_SERVER_2012_RTM_PORTUGESE_BRAZIL_64BIT_BASE]: WindowsVersion.WINDOWS_SERVER_2012_RTM_PORTUGUESE_BRAZIL_64BIT_BASE, + [WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_PORTUGESE_BRAZIL_64BIT_BASE]: WindowsVersion.WINDOWS_SERVER_2008_R2_SP1_PORTUGUESE_BRAZIL_64BIT_BASE, + [WindowsVersion.WINDOWS_SERVER_2008_SP2_PORTUGESE_BRAZIL_32BIT_BASE]: WindowsVersion.WINDOWS_SERVER_2008_SP2_PORTUGUESE_BRAZIL_32BIT_BASE, + [WindowsVersion.WINDOWS_SERVER_2012_RTM_PORTUGESE_PORTUGAL_64BIT_BASE]: WindowsVersion.WINDOWS_SERVER_2012_RTM_PORTUGUESE_PORTUGAL_64BIT_BASE, + [WindowsVersion.WINDOWS_SERVER_2019_PORTUGESE_BRAZIL_FULL_BASE]: WindowsVersion.WINDOWS_SERVER_2019_PORTUGUESE_BRAZIL_FULL_BASE, + [WindowsVersion.WINDOWS_SERVER_2019_PORTUGESE_PORTUGAL_FULL_BASE]: WindowsVersion.WINDOWS_SERVER_2019_PORTUGUESE_PORTUGAL_FULL_BASE, + } constructor(version: WindowsVersion, props: WindowsImageProps = {}) { - super('/aws/service/ami-windows-latest/' + version, OperatingSystemType.WINDOWS, props.userData); + const nonDeprecatedVersionName = WindowsImage.DEPRECATED_VERSION_NAME_MAP[version] ?? version; + super('/aws/service/ami-windows-latest/' + nonDeprecatedVersionName, OperatingSystemType.WINDOWS, props.userData); } } diff --git a/packages/@aws-cdk/aws-ec2/lib/port.ts b/packages/@aws-cdk/aws-ec2/lib/port.ts index 8436f3455cda1..2317879988f3a 100644 --- a/packages/@aws-cdk/aws-ec2/lib/port.ts +++ b/packages/@aws-cdk/aws-ec2/lib/port.ts @@ -90,7 +90,7 @@ export enum Protocol { SECURE_VMTP = '82', VINES = '83', TTP = '84', - IPTM = '84', + IPTM = '84_', NSFNET_IGP = '85', DGP = '86', TCF = '87', @@ -154,6 +154,7 @@ export enum Protocol { EXPERIMENT_2 = '254', RESERVED = '255', } + /** * Properties to create a port range */ @@ -243,7 +244,9 @@ export class Port { protocol: Protocol.UDP, fromPort: startPort, toPort: endPort, - stringRepresentation: `UDP ${renderPort(startPort)}-${renderPort(endPort)}`, + stringRepresentation: `UDP ${renderPort(startPort)}-${renderPort( + endPort, + )}`, }); } @@ -344,15 +347,20 @@ export class Port { public readonly canInlineRule: boolean; constructor(private readonly props: PortProps) { - this.canInlineRule = !Token.isUnresolved(props.fromPort) && !Token.isUnresolved(props.toPort); + this.canInlineRule = + !Token.isUnresolved(props.fromPort) && !Token.isUnresolved(props.toPort); } /** * Produce the ingress/egress rule JSON for the given connection */ public toRuleJson(): any { + // JSII does not allow enum types to have same value. So to support the enum, the enum with same value has to be mapped later. + const PROTOCOL_MAP: Partial> = { + [Protocol.IPTM]: '84', + }; return { - ipProtocol: this.props.protocol, + ipProtocol: PROTOCOL_MAP[this.props.protocol] ?? this.props.protocol, fromPort: this.props.fromPort, toPort: this.props.toPort, }; diff --git a/packages/@aws-cdk/aws-ec2/lib/util.ts b/packages/@aws-cdk/aws-ec2/lib/util.ts index 31814d5cc45e5..9a1c572f02afe 100644 --- a/packages/@aws-cdk/aws-ec2/lib/util.ts +++ b/packages/@aws-cdk/aws-ec2/lib/util.ts @@ -16,8 +16,12 @@ export function slugify(x: string): string { export function defaultSubnetName(type: SubnetType) { switch (type) { case SubnetType.PUBLIC: return 'Public'; - case SubnetType.PRIVATE_WITH_NAT: return 'Private'; - case SubnetType.PRIVATE_ISOLATED: return 'Isolated'; + case SubnetType.PRIVATE_WITH_NAT: + case SubnetType.PRIVATE: + return 'Private'; + case SubnetType.PRIVATE_ISOLATED: + case SubnetType.ISOLATED: + return 'Isolated'; } } diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index 05cc0de040404..d227a84ab09ad 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -177,7 +177,7 @@ export enum SubnetType { * * @deprecated use `SubnetType.PRIVATE_ISOLATED` */ - ISOLATED = 'Isolated', + ISOLATED = 'Deprecated_Isolated', /** * Isolated Subnets do not route traffic to the Internet (in this VPC), @@ -209,7 +209,7 @@ export enum SubnetType { * * @deprecated use `PRIVATE_WITH_NAT` */ - PRIVATE = 'Private', + PRIVATE = 'Deprecated_Private', /** * Subnet that routes to the internet (via a NAT gateway), but not vice versa. @@ -590,7 +590,9 @@ abstract class VpcBase extends Resource implements IVpc { private selectSubnetObjectsByType(subnetType: SubnetType) { const allSubnets = { [SubnetType.PRIVATE_ISOLATED]: this.isolatedSubnets, + [SubnetType.ISOLATED]: this.isolatedSubnets, [SubnetType.PRIVATE_WITH_NAT]: this.privateSubnets, + [SubnetType.PRIVATE]: this.privateSubnets, [SubnetType.PUBLIC]: this.publicSubnets, }; @@ -1507,11 +1509,13 @@ export class Vpc extends VpcBase { subnet = publicSubnet; break; case SubnetType.PRIVATE_WITH_NAT: + case SubnetType.PRIVATE: const privateSubnet = new PrivateSubnet(this, name, subnetProps); this.privateSubnets.push(privateSubnet); subnet = privateSubnet; break; case SubnetType.PRIVATE_ISOLATED: + case SubnetType.ISOLATED: const isolatedSubnet = new PrivateSubnet(this, name, subnetProps); this.isolatedSubnets.push(isolatedSubnet); subnet = isolatedSubnet; @@ -1534,8 +1538,12 @@ const SUBNETNAME_TAG = 'aws-cdk:subnet-name'; function subnetTypeTagValue(type: SubnetType) { switch (type) { case SubnetType.PUBLIC: return 'Public'; - case SubnetType.PRIVATE_WITH_NAT: return 'Private'; - case SubnetType.PRIVATE_ISOLATED: return 'Isolated'; + case SubnetType.PRIVATE_WITH_NAT: + case SubnetType.PRIVATE: + return 'Private'; + case SubnetType.PRIVATE_ISOLATED: + case SubnetType.ISOLATED: + return 'Isolated'; } } diff --git a/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts b/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts index 2d5a60c5f9c22..d5bd2dd39c526 100644 --- a/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts +++ b/packages/@aws-cdk/aws-ec2/lib/windows-versions.ts @@ -12,13 +12,13 @@ export enum WindowsVersion { WINDOWS_SERVER_2016_ENGLISH_CORE_CONTAINERS = 'Windows_Server-2016-English-Core-Containers', WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP1_WEB = 'Windows_Server-2016-English-Core-SQL_2016_SP1_Web', /** @deprecated - use WINDOWS_SERVER_2016_GERMAN_FULL_BASE */ - WINDOWS_SERVER_2016_GERMAL_FULL_BASE = 'Windows_Server-2016-German-Full-Base', + WINDOWS_SERVER_2016_GERMAL_FULL_BASE = 'Windows_Server-2016-Germal-Full-Base', WINDOWS_SERVER_2016_GERMAN_FULL_BASE = 'Windows_Server-2016-German-Full-Base', WINDOWS_SERVER_2003_R2_SP2_LANGUAGE_PACKS_32BIT_BASE = 'Windows_Server-2003-R2_SP2-Language_Packs-32Bit-Base', WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_WEB = 'Windows_Server-2008-R2_SP1-English-64Bit-SQL_2008_R2_SP3_Web', WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_EXPRESS = 'Windows_Server-2008-R2_SP1-English-64Bit-SQL_2012_SP4_Express', /** @deprecated - use WINDOWS_SERVER_2012_R2_SP1_PORTUGUESE_BRAZIL_64BIT_CORE*/ - WINDOWS_SERVER_2012_R2_SP1_PORTUGESE_BRAZIL_64BIT_CORE = 'Windows_Server-2008-R2_SP1-Portuguese_Brazil-64Bit-Core', + WINDOWS_SERVER_2012_R2_SP1_PORTUGESE_BRAZIL_64BIT_CORE = 'Windows_Server-2008-R2_SP1-Portugese_Brazil-64Bit-Core', WINDOWS_SERVER_2012_R2_SP1_PORTUGUESE_BRAZIL_64BIT_CORE = 'Windows_Server-2008-R2_SP1-Portuguese_Brazil-64Bit-Core', WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP2_STANDARD = 'Windows_Server-2012-R2_RTM-English-64Bit-SQL_2016_SP2_Standard', WINDOWS_SERVER_2012_RTM_ENGLISH_64BIT_SQL_2014_SP2_EXPRESS = 'Windows_Server-2012-RTM-English-64Bit-SQL_2014_SP2_Express', @@ -33,7 +33,7 @@ export enum WindowsVersion { WINDOWS_SERVER_2016_KOREAN_FULL_BASE = 'Windows_Server-2016-Korean-Full-Base', WINDOWS_SERVER_2016_KOREAN_FULL_SQL_2016_SP2_STANDARD = 'Windows_Server-2016-Korean-Full-SQL_2016_SP2_Standard', /** @deprecated - use WINDOWS_SERVER_2016_PORTUGUESE_PORTUGAL_FULL_BASE */ - WINDOWS_SERVER_2016_PORTUGESE_PORTUGAL_FULL_BASE = 'Windows_Server-2016-Portuguese_Portugal-Full-Base', + WINDOWS_SERVER_2016_PORTUGESE_PORTUGAL_FULL_BASE = 'Windows_Server-2016-Portugese_Portugal-Full-Base', WINDOWS_SERVER_2016_PORTUGUESE_PORTUGAL_FULL_BASE = 'Windows_Server-2016-Portuguese_Portugal-Full-Base', WINDOWS_SERVER_2019_ENGLISH_FULL_SQL_2017_WEB = 'Windows_Server-2019-English-Full-SQL_2017_Web', WINDOWS_SERVER_2019_FRENCH_FULL_BASE = 'Windows_Server-2019-French-Full-Base', @@ -97,10 +97,10 @@ export enum WindowsVersion { WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2014_SP3_WEB = 'Windows_Server-2012-R2_RTM-English-64Bit-SQL_2014_SP3_Web', WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_WEB = 'Windows_Server-2012-R2_RTM-Japanese-64Bit-SQL_2016_SP1_Web', /** @deprecated - use WINDOWS_SERVER_2012_R2_RTM_PORTUGUESE_BRAZIL_64BIT_BASE */ - WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_BRAZIL_64BIT_BASE = 'Windows_Server-2012-R2_RTM-Portuguese_Brazil-64Bit-Base', + WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_BRAZIL_64BIT_BASE = 'Windows_Server-2012-R2_RTM-Portugese_Brazil-64Bit-Base', WINDOWS_SERVER_2012_R2_RTM_PORTUGUESE_BRAZIL_64BIT_BASE = 'Windows_Server-2012-R2_RTM-Portuguese_Brazil-64Bit-Base', /** @deprecated - use WINDOWS_SERVER_2012_R2_RTM_PORTUGUESE_PORTUGAL_64BIT_BASE*/ - WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_PORTUGAL_64BIT_BASE = 'Windows_Server-2012-R2_RTM-Portuguese_Portugal-64Bit-Base', + WINDOWS_SERVER_2012_R2_RTM_PORTUGESE_PORTUGAL_64BIT_BASE = 'Windows_Server-2012-R2_RTM-Portugese_Portugal-64Bit-Base', WINDOWS_SERVER_2012_R2_RTM_PORTUGUESE_PORTUGAL_64BIT_BASE = 'Windows_Server-2012-R2_RTM-Portuguese_Portugal-64Bit-Base', WINDOWS_SERVER_2012_R2_RTM_SWEDISH_64BIT_BASE = 'Windows_Server-2012-R2_RTM-Swedish-64Bit-Base', WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_EXPRESS = 'Windows_Server-2016-English-Full-SQL_2016_SP1_Express', @@ -114,7 +114,7 @@ export enum WindowsVersion { WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2014_SP2_WEB = 'Windows_Server-2012-RTM-Japanese-64Bit-SQL_2014_SP2_Web', WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_ENTERPRISE = 'Windows_Server-2016-English-Core-SQL_2016_SP2_Enterprise', /** @deprecated - use WINDOWS_SERVER_2016_PORTUGUESE_BRAZIL_FULL_BASE */ - WINDOWS_SERVER_2016_PORTUGESE_BRAZIL_FULL_BASE = 'Windows_Server-2016-Portuguese_Brazil-Full-Base', + WINDOWS_SERVER_2016_PORTUGESE_BRAZIL_FULL_BASE = 'Windows_Server-2016-Portugese_Brazil-Full-Base', WINDOWS_SERVER_2016_PORTUGUESE_BRAZIL_FULL_BASE = 'Windows_Server-2016-Portuguese_Brazil-Full-Base', WINDOWS_SERVER_2019_ENGLISH_FULL_BASE = 'Windows_Server-2019-English-Full-Base', WINDOWS_SERVER_2003_R2_SP2_ENGLISH_32BIT_BASE = 'Windows_Server-2003-R2_SP2-English-32Bit-Base', @@ -141,7 +141,7 @@ export enum WindowsVersion { WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_BASE = 'Windows_Server-2008-R2_SP1-English-64Bit-Base', WINDOWS_SERVER_2008_R2_SP1_LANGUAGE_PACKS_64BIT_SQL_2008_R2_SP3_EXPRESS = 'Windows_Server-2008-R2_SP1-Language_Packs-64Bit-SQL_2008_R2_SP3_Express', /** @deprecated - use WINDOWS_SERVER_2012_SP2_PORTUGUESE_BRAZIL_64BIT_BASE */ - WINDOWS_SERVER_2012_SP2_PORTUGESE_BRAZIL_64BIT_BASE = 'Windows_Server-2008-SP2-Portuguese_Brazil-64Bit-Base', + WINDOWS_SERVER_2012_SP2_PORTUGESE_BRAZIL_64BIT_BASE = 'Windows_Server-2008-SP2-Portugese_Brazil-64Bit-Base', WINDOWS_SERVER_2012_SP2_PORTUGUESE_BRAZIL_64BIT_BASE = 'Windows_Server-2008-SP2-Portuguese_Brazil-64Bit-Base', WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_SQL_2016_SP1_WEB = 'Windows_Server-2012-R2_RTM-English-64Bit-SQL_2016_SP1_Web', WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP3_EXPRESS = 'Windows_Server-2012-R2_RTM-Japanese-64Bit-SQL_2014_SP3_Express', @@ -156,7 +156,7 @@ export enum WindowsVersion { WINDOWS_SERVER_2008_SP2_ENGLISH_64BIT_SQL_2008_SP4_STANDARD = 'Windows_Server-2008-SP2-English-64Bit-SQL_2008_SP4_Standard', WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_BASE = 'Windows_Server-2012-R2_RTM-English-64Bit-Base', /** @deprecated - use WINDOWS_SERVER_2012_RTM_PORTUGUESE_BRAZIL_64BIT_BASE */ - WINDOWS_SERVER_2012_RTM_PORTUGESE_BRAZIL_64BIT_BASE = 'Windows_Server-2012-RTM-Portuguese_Brazil-64Bit-Base', + WINDOWS_SERVER_2012_RTM_PORTUGESE_BRAZIL_64BIT_BASE = 'Windows_Server-2012-RTM-Portugese_Brazil-64Bit-Base', WINDOWS_SERVER_2012_RTM_PORTUGUESE_BRAZIL_64BIT_BASE = 'Windows_Server-2012-RTM-Portuguese_Brazil-64Bit-Base', WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2016_SP1_WEB = 'Windows_Server-2016-English-Full-SQL_2016_SP1_Web', WINDOWS_SERVER_2016_ENGLISH_P3 = 'Windows_Server-2016-English-P3', @@ -182,7 +182,7 @@ export enum WindowsVersion { WINDOWS_SERVER_2019_POLISH_FULL_BASE = 'Windows_Server-2019-Polish-Full-Base', WINDOWS_SERVER_2008_R2_SP1_JAPANESE_64BIT_SQL_2008_R2_SP3_WEB = 'Windows_Server-2008-R2_SP1-Japanese-64Bit-SQL_2008_R2_SP3_Web', /** @deprecated - use WINDOWS_SERVER_2008_R2_SP1_PORTUGUESE_BRAZIL_64BIT_BASE */ - WINDOWS_SERVER_2008_R2_SP1_PORTUGESE_BRAZIL_64BIT_BASE = 'Windows_Server-2008-R2_SP1-Portuguese_Brazil-64Bit-Base', + WINDOWS_SERVER_2008_R2_SP1_PORTUGESE_BRAZIL_64BIT_BASE = 'Windows_Server-2008-R2_SP1-Portugese_Brazil-64Bit-Base', WINDOWS_SERVER_2008_R2_SP1_PORTUGUESE_BRAZIL_64BIT_BASE = 'Windows_Server-2008-R2_SP1-Portuguese_Brazil-64Bit-Base', WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2016_SP1_ENTERPRISE = 'Windows_Server-2012-R2_RTM-Japanese-64Bit-SQL_2016_SP1_Enterprise', WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2016_SP2_EXPRESS = 'Windows_Server-2012-R2_RTM-Japanese-64Bit-SQL_2016_SP2_Express', @@ -216,11 +216,11 @@ export enum WindowsVersion { WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2012_SP4_STANDARD = 'Windows_Server-2008-R2_SP1-English-64Bit-SQL_2012_SP4_Standard', /** @deprecated - use WINDOWS_SERVER_2008_SP2_PORTUGUESE_BRAZIL_32BIT_BASE */ WINDOWS_SERVER_2008_SP2_PORTUGESE_BRAZIL_32BIT_BASE = 'Windows_Server-2008-SP2-Portuguese_Brazil-32Bit-Base', - WINDOWS_SERVER_2008_SP2_PORTUGUESE_BRAZIL_32BIT_BASE = 'Windows_Server-2008-SP2-Portuguese_Brazil-32Bit-Base', + WINDOWS_SERVER_2008_SP2_PORTUGUESE_BRAZIL_32BIT_BASE = 'Windows_Server-2008-SP2-Portugese_Brazil-32Bit-Base', WINDOWS_SERVER_2012_R2_RTM_JAPANESE_64BIT_SQL_2014_SP2_STANDARD = 'Windows_Server-2012-R2_RTM-Japanese-64Bit-SQL_2014_SP2_Standard', WINDOWS_SERVER_2012_RTM_JAPANESE_64BIT_SQL_2012_SP4_EXPRESS = 'Windows_Server-2012-RTM-Japanese-64Bit-SQL_2012_SP4_Express', /** @deprecated - use WINDOWS_SERVER_2012_RTM_PORTUGUESE_PORTUGAL_64BIT_BASE */ - WINDOWS_SERVER_2012_RTM_PORTUGESE_PORTUGAL_64BIT_BASE = 'Windows_Server-2012-RTM-Portuguese_Portugal-64Bit-Base', + WINDOWS_SERVER_2012_RTM_PORTUGESE_PORTUGAL_64BIT_BASE = 'Windows_Server-2012-RTM-Portugese_Portugal-64Bit-Base', WINDOWS_SERVER_2012_RTM_PORTUGUESE_PORTUGAL_64BIT_BASE = 'Windows_Server-2012-RTM-Portuguese_Portugal-64Bit-Base', WINDOWS_SERVER_2016_CZECH_FULL_BASE = 'Windows_Server-2016-Czech-Full-Base', WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP1_STANDARD = 'Windows_Server-2016-Japanese-Full-SQL_2016_SP1_Standard', @@ -235,7 +235,7 @@ export enum WindowsVersion { WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_WEB = 'Windows_Server-2016-English-Core-SQL_2016_SP2_Web', WINDOWS_SERVER_2016_ENGLISH_FULL_SQL_2017_STANDARD = 'Windows_Server-2016-English-Full-SQL_2017_Standard', /** @deprecated - use WINDOWS_SERVER_2019_PORTUGUESE_BRAZIL_FULL_BASE */ - WINDOWS_SERVER_2019_PORTUGESE_BRAZIL_FULL_BASE = 'Windows_Server-2019-Portuguese_Brazil-Full-Base', + WINDOWS_SERVER_2019_PORTUGESE_BRAZIL_FULL_BASE = 'Windows_Server-2019-Portugese_Brazil-Full-Base', WINDOWS_SERVER_2019_PORTUGUESE_BRAZIL_FULL_BASE = 'Windows_Server-2019-Portuguese_Brazil-Full-Base', WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SQL_2008_R2_SP3_STANDARD = 'Windows_Server-2008-R2_SP1-English-64Bit-SQL_2008_R2_SP3_Standard', WINDOWS_SERVER_2008_R2_SP1_ENGLISH_64BIT_SHAREPOINT_2010_SP2_FOUNDATION = 'Windows_Server-2008-R2_SP1-English-64Bit-SharePoint_2010_SP2_Foundation', @@ -246,7 +246,7 @@ export enum WindowsVersion { WINDOWS_SERVER_2016_ENGLISH_CORE_SQL_2016_SP2_STANDARD = 'Windows_Server-2016-English-Core-SQL_2016_SP2_Standard', WINDOWS_SERVER_2016_JAPANESE_FULL_SQL_2016_SP2_STANDARD = 'Windows_Server-2016-Japanese-Full-SQL_2016_SP2_Standard', /** @deprecated - use WINDOWS_SERVER_2019_PORTUGUESE_PORTUGAL_FULL_BASE */ - WINDOWS_SERVER_2019_PORTUGESE_PORTUGAL_FULL_BASE = 'Windows_Server-2019-Portuguese_Portugal-Full-Base', + WINDOWS_SERVER_2019_PORTUGESE_PORTUGAL_FULL_BASE = 'Windows_Server-2019-Portugese_Portugal-Full-Base', WINDOWS_SERVER_2019_PORTUGUESE_PORTUGAL_FULL_BASE = 'Windows_Server-2019-Portuguese_Portugal-Full-Base', WINDOWS_SERVER_2019_SWEDISH_FULL_BASE = 'Windows_Server-2019-Swedish-Full-Base', WINDOWS_SERVER_2012_R2_RTM_ENGLISH_64BIT_HYPERV = 'Windows_Server-2012-R2_RTM-English-64Bit-HyperV', diff --git a/packages/@aws-cdk/aws-ec2/test/instance.test.ts b/packages/@aws-cdk/aws-ec2/test/instance.test.ts index 6fd215af31bff..fc0d12c4d2482 100644 --- a/packages/@aws-cdk/aws-ec2/test/instance.test.ts +++ b/packages/@aws-cdk/aws-ec2/test/instance.test.ts @@ -131,38 +131,35 @@ describe('instance', () => { }); + test('instances with local NVME drive are correctly named', () => { // GIVEN const sampleInstanceClassKeys = [{ - key: 'R5D', + key: InstanceClass.R5D, value: 'r5d', }, { - key: 'MEMORY5_NVME_DRIVE', + key: InstanceClass.MEMORY5_NVME_DRIVE, value: 'r5d', }, { - key: 'R5AD', + key: InstanceClass.R5AD, value: 'r5ad', }, { - key: 'MEMORY5_AMD_NVME_DRIVE', + key: InstanceClass.MEMORY5_AMD_NVME_DRIVE, value: 'r5ad', }, { - key: 'M5AD', + key: InstanceClass.M5AD, value: 'm5ad', }, { - key: 'STANDARD5_AMD_NVME_DRIVE', + key: InstanceClass.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]; - + const instanceType = InstanceType.of(instanceClass.key, InstanceSize.LARGE); // THEN - expect(instanceType).toBe(instanceClass.value); + expect(instanceType.toString().split('.')[0]).toBe(instanceClass.value); } - - }); test('instance architecture throws an error when instance type is invalid', () => { // GIVEN