Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { Construct } from 'constructs';
import { AutoScalingGroupRequireImdsv2Aspect } from './aspects';
import { CfnAutoScalingGroup, CfnAutoScalingGroupProps, CfnLaunchConfiguration } from './autoscaling.generated';
Expand Down Expand Up @@ -2610,7 +2609,7 @@ function synthesizeBlockDeviceMappings(construct: Construct, blockDevices: Block
const { iops, volumeType, throughput } = ebs;

if (throughput) {
const throughputRange = { Min: 125, Max: 1000 };
const throughputRange = { Min: 125, Max: 2000 };
const { Min, Max } = throughputRange;

if (volumeType != EbsDeviceVolumeType.GP3) {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-autoscaling/lib/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface EbsDeviceOptionsBase {

/**
* The throughput that the volume supports, in MiB/s
* Takes a minimum of 125 and maximum of 1000.
* Takes a minimum of 125 and maximum of 2000.
* @see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
* @default - 125 MiB/s. Only valid on gp3 volumes.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ describe('auto scaling group', () => {
}).toThrow(/maxInstanceLifetime must be between 1 and 365 days \(inclusive\)/);
});

test.each([124, 1001])('throws if throughput is set less than 125 or more than 1000', (throughput) => {
test.each([124, 2001])('throws if throughput is set less than 125 or more than 2000', (throughput) => {
const stack = new cdk.Stack();
const vpc = mockVpc(stack);

Expand All @@ -1188,7 +1188,7 @@ describe('auto scaling group', () => {
}),
}],
});
}).toThrow(/throughput property takes a minimum of 125 and a maximum of 1000/);
}).toThrow(/throughput property takes a minimum of 125 and a maximum of 2000/);
});

test.each([
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ You can configure [tag propagation on volume creation](https://docs.aws.amazon.c

#### Throughput on GP3 Volumes

You can specify the `throughput` of a GP3 volume from 125 (default) to 1000.
You can specify the `throughput` of a GP3 volume from 125 (default) to 2000.

```ts
new ec2.Volume(this, 'Volume', {
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/aws-ec2/lib/private/ebs-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ function synthesizeBlockDeviceMappings<RT, NDT>(construct: Construct, blockDevic
throw new ValidationError(`'throughput' must be an integer, got: ${throughput}.`, construct);
}

if (throughput < 125 || throughput > 1000) {
throw new ValidationError(`'throughput' must be between 125 and 1000, got ${throughput}.`, construct);
if (throughput < 125 || throughput > 2000) {
throw new ValidationError(`'throughput' must be between 125 and 2000, got ${throughput}.`, construct);
}

const maximumThroughputRatio = 0.25;
Expand Down
8 changes: 4 additions & 4 deletions packages/aws-cdk-lib/aws-ec2/lib/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export interface EbsDeviceOptionsBase {
/**
* The throughput to provision for a `gp3` volume.
*
* Valid Range: Minimum value of 125. Maximum value of 1000.
* Valid Range: Minimum value of 125. Maximum value of 2000.
*
* `gp3` volumes deliver a consistent baseline throughput performance of 125 MiB/s.
* You can provision additional throughput for an additional cost at a ratio of 0.25 MiB/s per provisioned IOPS.
Expand Down Expand Up @@ -475,7 +475,7 @@ export interface VolumeProps {

/**
* The throughput that the volume supports, in MiB/s
* Takes a minimum of 125 and maximum of 1000.
* Takes a minimum of 125 and maximum of 2000.
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html#cfn-ec2-volume-throughput
* @default - 125 MiB/s. Only valid on gp3 volumes.
*/
Expand Down Expand Up @@ -756,7 +756,7 @@ export class Volume extends VolumeBase {
// Enforce minimum & maximum IOPS:
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html
const iopsRanges: { [key: string]: { Min: number; Max: number } } = {};
iopsRanges[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3] = { Min: 3000, Max: 16000 };
iopsRanges[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3] = { Min: 3000, Max: 80000 };
iopsRanges[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD] = { Min: 100, Max: 64000 };
iopsRanges[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2] = { Min: 100, Max: 256000 };
const { Min, Max } = iopsRanges[volumeType];
Expand Down Expand Up @@ -818,7 +818,7 @@ export class Volume extends VolumeBase {
}

if (props.throughput) {
const throughputRange = { Min: 125, Max: 1000 };
const throughputRange = { Min: 125, Max: 2000 };
const { Min, Max } = throughputRange;
if (props.volumeType != EbsDeviceVolumeType.GP3) {
throw new ValidationError(
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk-lib/aws-ec2/test/launch-template.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ describe('LaunchTemplate', () => {
},
});
});
test.each([124, 1001])('throws if throughput is set less than 125 or more than 1000', (throughput) => {
test.each([124, 2001])('throws if throughput is set less than 125 or more than 2000', (throughput) => {
expect(() => {
new LaunchTemplate(stack, 'LaunchTemplate', {
blockDevices: [{
Expand All @@ -419,7 +419,7 @@ describe('LaunchTemplate', () => {
}),
}],
});
}).toThrow(/'throughput' must be between 125 and 1000, got/);
}).toThrow(/'throughput' must be between 125 and 2000, got/);
});
test('throws if throughput is not an integer', () => {
expect(() => {
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk-lib/aws-ec2/test/volume.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ describe('volume', () => {

// Test: iops in range
for (const testData of [
[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, 3000, 16000],
[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, 3000, 80000],
[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD, 100, 64000],
[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2, 100, 256000],
]) {
Expand Down Expand Up @@ -1475,7 +1475,7 @@ describe('volume', () => {
}
});

test.each([124, 1001])('throws if throughput is set less than 125 or more than 1000', (throughput) => {
test.each([124, 2001])('throws if throughput is set less than 125 or more than 2000', (throughput) => {
const stack = new cdk.Stack();
expect(() => {
new Volume(stack, 'Volume', {
Expand All @@ -1484,7 +1484,7 @@ describe('volume', () => {
volumeType: EbsDeviceVolumeType.GP3,
throughput,
});
}).toThrow(/throughput property takes a minimum of 125 and a maximum of 1000/);
}).toThrow(/throughput property takes a minimum of 125 and a maximum of 2000/);
});

test.each([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,8 @@ export class ServiceManagedVolume extends Construct {
if (throughput !== undefined) {
if (volumeType !== ec2.EbsDeviceVolumeType.GP3) {
throw new ValidationError(`'throughput' can only be configured with gp3 volume type, got ${volumeType}`, this);
} else if (!Token.isUnresolved(throughput) && throughput > 1000) {
throw new ValidationError(`'throughput' must be less than or equal to 1000 MiB/s, got ${throughput} MiB/s`, this);
} else if (!Token.isUnresolved(throughput) && throughput > 2000) {
throw new ValidationError(`'throughput' must be less than or equal to 2000 MiB/s, got ${throughput} MiB/s`, this);
}
}

Expand All @@ -320,7 +320,7 @@ export class ServiceManagedVolume extends Construct {

// Validate IOPS range if specified.
const iopsRanges: { [key: string]: { min: number; max: number } } = {};
iopsRanges[ec2.EbsDeviceVolumeType.GP3]= { min: 3000, max: 16000 };
iopsRanges[ec2.EbsDeviceVolumeType.GP3]= { min: 3000, max: 80000 };
iopsRanges[ec2.EbsDeviceVolumeType.IO1]= { min: 100, max: 64000 };
iopsRanges[ec2.EbsDeviceVolumeType.IO2]= { min: 100, max: 256000 };
if (iops !== undefined && !Token.isUnresolved(iops)) {
Expand Down
63 changes: 21 additions & 42 deletions packages/aws-cdk-lib/aws-ecs/test/fargate/fargate-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2328,48 +2328,6 @@ describe('fargate service', () => {
}).toThrow(/'throughput' can only be configured with gp3 volume type, got gp2/);
});

test('throw an error if throughput is greater tahn 1000 for volume type gp3', ()=> {
// WHEN
container.addMountPoints({
containerPath: '/var/lib',
readOnly: false,
sourceVolume: 'nginx-vol',
});

expect(() => {
service.addVolume(new ServiceManagedVolume(stack, 'EBS Volume', {
name: 'nginx-vol',
managedEBSVolume: {
fileSystemType: ecs.FileSystemType.XFS,
volumeType: ec2.EbsDeviceVolumeType.GP3,
size: cdk.Size.gibibytes(10),
throughput: 10001,
},
}));
}).toThrow("'throughput' must be less than or equal to 1000 MiB/s, got 10001 MiB/s");
});

test('throw an error if throughput is greater tahn 1000 for volume type gp3', ()=> {
// WHEN
container.addMountPoints({
containerPath: '/var/lib',
readOnly: false,
sourceVolume: 'nginx-vol',
});

expect(() => {
service.addVolume(new ServiceManagedVolume(stack, 'EBS Volume', {
name: 'nginx-vol',
managedEBSVolume: {
fileSystemType: ecs.FileSystemType.XFS,
volumeType: ec2.EbsDeviceVolumeType.GP3,
size: cdk.Size.gibibytes(10),
throughput: 10001,
},
}));
}).toThrow("'throughput' must be less than or equal to 1000 MiB/s, got 10001 MiB/s");
});

test('throw an error if iops is not supported for volume type sc1', ()=> {
// WHEN
container.addMountPoints({
Expand Down Expand Up @@ -2580,6 +2538,27 @@ describe('fargate service', () => {
],
});
});

test('throw an error if throughput is greater than 2000 for volume type gp3', () => {
// WHEN
container.addMountPoints({
containerPath: '/var/lib',
readOnly: false,
sourceVolume: 'nginx-vol',
});

expect(() => {
service.addVolume(new ServiceManagedVolume(stack, 'EBS Volume', {
name: 'nginx-vol',
managedEBSVolume: {
fileSystemType: ecs.FileSystemType.XFS,
volumeType: ec2.EbsDeviceVolumeType.GP3,
size: cdk.Size.gibibytes(10),
throughput: 2001,
},
}));
}).toThrow("'throughput' must be less than or equal to 2000 MiB/s, got 2001 MiB/s");
});
});

describe('When setting up a health check', () => {
Expand Down
Loading