Skip to content

Commit

Permalink
fix(ec2): add missing entry for XLARGE3 (#14750)
Browse files Browse the repository at this point in the history
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
cmooreamazon authored Jun 3, 2021
1 parent da6f2c6 commit af6d49f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
5 changes: 5 additions & 0 deletions packages/@aws-cdk/aws-ec2/lib/instance-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,11 @@ export enum InstanceSize {
*/
XLARGE2 = '2xlarge',

/**
* Instance size XLARGE3 (3xlarge)
*/
XLARGE3 = '3xlarge',

/**
* Instance size XLARGE4 (4xlarge)
*/
Expand Down
33 changes: 23 additions & 10 deletions packages/@aws-cdk/aws-ec2/test/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,30 @@ beforeEach(() => {

nodeunitShim({
'instance is created correctly'(test: Test) {
// WHEN
new Instance(stack, 'Instance', {
vpc,
machineImage: new AmazonLinuxImage(),
instanceType: InstanceType.of(InstanceClass.BURSTABLE4_GRAVITON, InstanceSize.LARGE),
});
// GIVEN
const sampleInstances = [{
instanceClass: InstanceClass.BURSTABLE4_GRAVITON,
instanceSize: InstanceSize.LARGE,
instanceType: 't4g.large',
}, {
instanceClass: InstanceClass.HIGH_COMPUTE_MEMORY1,
instanceSize: InstanceSize.XLARGE3,
instanceType: 'z1d.3xlarge',
}];

// THEN
cdkExpect(stack).to(haveResource('AWS::EC2::Instance', {
InstanceType: 't4g.large',
}));
for (const [i, sampleInstance] of sampleInstances.entries()) {
// WHEN
new Instance(stack, `Instance${i}`, {
vpc,
machineImage: new AmazonLinuxImage(),
instanceType: InstanceType.of(sampleInstance.instanceClass, sampleInstance.instanceSize),
});

// THEN
cdkExpect(stack).to(haveResource('AWS::EC2::Instance', {
InstanceType: sampleInstance.instanceType,
}));
}

test.done();
},
Expand Down

0 comments on commit af6d49f

Please sign in to comment.