Skip to content

Commit

Permalink
chore(ec2): dl2q instance type, IntanceType fixes (#29481)
Browse files Browse the repository at this point in the history
### Issue # (if applicable)

None

### Reason for this change

Follow up to #29427. Added a missing instance type, and minor fixes to the `IntanceType` class

### Description of changes

I'd missed an instance type, [`dl2q`](https://aws.amazon.com/ec2/instance-types/dl2q/), which was neither in `us-east-1` or `us-east-2`, but in `us-west-2`.

I've also added a couple of missing symbolic names, as well as fixed some differing comments between the key and its symbolic value (e.g. `M3` and `STANDARD3`)

I also re-ordered a couple of enum values, when the symbolic value was separated from its match

### Description of how you validated changes

Compared the CDK to the SDK to find the missing instance. Programmatically iterated over the comments of `IntanceType` to make sure the comments of the symbolic keys matched the one below. 

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
nmussy authored Mar 15, 2024
1 parent ab94070 commit 98e9fbe
Showing 1 changed file with 36 additions and 12 deletions.
48 changes: 36 additions & 12 deletions packages/aws-cdk-lib/aws-ec2/lib/instance-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ export enum InstanceClass {
*/
MEMORY5_AMD_NVME_DRIVE = 'memory5-amd-nvme-drive',

/**
* Memory optimized instances based on AMD EPYC with local NVME drive, 5th generation
*/
R5AD = 'r5ad',

/**
* High memory instances (3TB) based on Intel Xeon Platinum 8176M (Skylake) processors, 1st generation
*/
Expand Down Expand Up @@ -283,11 +288,6 @@ export enum InstanceClass {
*/
U_24TB1 = 'u-24tb1',

/**
* Memory optimized instances based on AMD EPYC with local NVME drive, 5th generation
*/
R5AD = 'r5ad',

/**
* Memory optimized instances that are also EBS-optimized, 5th generation
*/
Expand Down Expand Up @@ -611,20 +611,30 @@ export enum InstanceClass {
*/
STORAGE_COMPUTE_1 = 'storage-compute-1',

/**
* Storage/compute balanced instances, 1st generation
*/
H1 = 'h1',

/**
* High performance computing powered by AWS Trainium
*/
TRN1 = 'trn1',
TRAINING_ACCELERATOR1 = 'training-accelerator1',

/**
* High performance computing powered by AWS Trainium
*/
TRN1N = 'trn1n',
TRN1 = 'trn1',

/**
* Storage/compute balanced instances, 1st generation
* Network-optimized high performance computing powered by AWS Trainium
*/
H1 = 'h1',
TRAINING_ACCELERATOR1_ENHANCED_NETWORK = 'training-accelerator1-enhanced-network',

/**
* Network-optimized high performance computing powered by AWS Trainium
*/
TRN1N = 'trn1n',

/**
* I/O-optimized instances, 3rd generation
Expand Down Expand Up @@ -742,7 +752,7 @@ export enum InstanceClass {
MEMORY_INTENSIVE_1_EXTENDED = 'memory-intensive-1-extended',

/**
* Memory-intensive instances, 1st generation
* Memory-intensive instances, extended, 1st generation
*/
X1E = 'x1e',

Expand Down Expand Up @@ -881,7 +891,7 @@ export enum InstanceClass {
P2 = 'p2',

/**
* Parallel-processing optimized instances, 3nd generation
* Parallel-processing optimized instances, 3rd generation
*/
PARALLEL3 = 'parallel3',

Expand All @@ -891,7 +901,7 @@ export enum InstanceClass {
P3 = 'p3',

/**
* Parallel-processing optimized instances with local NVME drive for high performance computing, 3nd generation
* Parallel-processing optimized instances with local NVME drive for high performance computing, 3rd generation
*/
PARALLEL3_NVME_DRIVE_HIGH_PERFORMANCE = 'parallel3-nvme-drive-high-performance',

Expand Down Expand Up @@ -1199,6 +1209,16 @@ export enum InstanceClass {
* Deep learning instances powered by Gaudi accelerators from Habana Labs (an Intel company), 1st generation
*/
DL1 = 'dl1',

/**
* Deep learning instances powered by Qualcomm AI 100 Standard accelerators, 2nd generation
*/
DEEP_LEARNING2_QUALCOMM = 'deep-learning2-qualcomm',

/**
* Deep learning instances powered by Qualcomm AI 100 Standard accelerators, 2nd generation
*/
DL2Q = 'dl2q',
}

/**
Expand Down Expand Up @@ -1490,7 +1510,9 @@ export class InstanceType {
[InstanceClass.D3]: 'd3',
[InstanceClass.STORAGE3_ENHANCED_NETWORK]: 'd3en',
[InstanceClass.D3EN]: 'd3en',
[InstanceClass.TRAINING_ACCELERATOR1]: 'trn1',
[InstanceClass.TRN1]: 'trn1',
[InstanceClass.TRAINING_ACCELERATOR1_ENHANCED_NETWORK]: 'trn1n',
[InstanceClass.TRN1N]: 'trn1n',
[InstanceClass.STORAGE_COMPUTE_1]: 'h1',
[InstanceClass.H1]: 'h1',
Expand Down Expand Up @@ -1606,6 +1628,8 @@ export class InstanceType {
[InstanceClass.MEMORY_INTENSIVE_2_XTZ_INTEL]: 'x2iezn',
[InstanceClass.DEEP_LEARNING1]: 'dl1',
[InstanceClass.DL1]: 'dl1',
[InstanceClass.DEEP_LEARNING2_QUALCOMM]: 'dl2q',
[InstanceClass.DL2Q]: 'dl2q',
};
return new InstanceType(`${instanceClassMap[instanceClass] ?? instanceClass}.${instanceSize}`);
}
Expand Down

0 comments on commit 98e9fbe

Please sign in to comment.