Skip to content

Commit a30a205

Browse files
authored
fix(ec2): max iops value for io2 EBS volume is wrong (#28695)
The max value of `iops` for `io2` EBS volume is wrong. And I fixed the reference URL. - 64000 -> 256000 https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html#cfn-ec2-volume-iops ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 2b59ed1 commit a30a205

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/aws-cdk-lib/aws-ec2/lib/volume.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export interface VolumeProps {
344344

345345
/**
346346
* The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size.
347-
* See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html
347+
* See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html
348348
* for details on the allowable size for each type of volume.
349349
*
350350
* @default If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.
@@ -427,7 +427,7 @@ export interface VolumeProps {
427427
/**
428428
* The number of I/O operations per second (IOPS) to provision for the volume. The maximum ratio is 50 IOPS/GiB for PROVISIONED_IOPS_SSD,
429429
* and 500 IOPS/GiB for both PROVISIONED_IOPS_SSD_IO2 and GENERAL_PURPOSE_SSD_GP3.
430-
* See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html
430+
* See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html
431431
* for more information.
432432
*
433433
* This parameter is valid only for PROVISIONED_IOPS_SSD, PROVISIONED_IOPS_SSD_IO2 and GENERAL_PURPOSE_SSD_GP3 volumes.
@@ -446,7 +446,7 @@ export interface VolumeProps {
446446
/**
447447
* The throughput that the volume supports, in MiB/s
448448
* Takes a minimum of 125 and maximum of 1000.
449-
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-throughput
449+
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html#cfn-ec2-volume-throughput
450450
* @default - 125 MiB/s. Only valid on gp3 volumes.
451451
*/
452452
readonly throughput?: number;
@@ -691,11 +691,11 @@ export class Volume extends VolumeBase {
691691
);
692692
}
693693
// Enforce minimum & maximum IOPS:
694-
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html
694+
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html
695695
const iopsRanges: { [key: string]: { Min: number, Max: number } } = {};
696696
iopsRanges[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3] = { Min: 3000, Max: 16000 };
697697
iopsRanges[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD] = { Min: 100, Max: 64000 };
698-
iopsRanges[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2] = { Min: 100, Max: 64000 };
698+
iopsRanges[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2] = { Min: 100, Max: 256000 };
699699
const { Min, Max } = iopsRanges[volumeType];
700700
if (props.iops < Min || props.iops > Max) {
701701
throw new Error(`\`${volumeType}\` volumes iops must be between ${Min} and ${Max}.`);
@@ -739,7 +739,7 @@ export class Volume extends VolumeBase {
739739
if (props.size) {
740740
const size = props.size.toGibibytes({ rounding: SizeRoundingBehavior.FAIL });
741741
// Enforce minimum & maximum volume size:
742-
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html
742+
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html
743743
const sizeRanges: { [key: string]: { Min: number, Max: number } } = {};
744744
sizeRanges[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD] = { Min: 1, Max: 16384 };
745745
sizeRanges[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3] = { Min: 1, Max: 16384 };

packages/aws-cdk-lib/aws-ec2/test/volume.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ describe('volume', () => {
12791279
for (const testData of [
12801280
[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, 3000, 16000],
12811281
[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD, 100, 64000],
1282-
[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2, 100, 64000],
1282+
[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2, 100, 256000],
12831283
]) {
12841284
const volumeType = testData[0] as EbsDeviceVolumeType;
12851285
const min = testData[1] as number;

0 commit comments

Comments
 (0)