From a30a2058de1af3201e3316ce73ee8ad5f2907ec6 Mon Sep 17 00:00:00 2001 From: "k.goto" <24818752+go-to-k@users.noreply.github.com> Date: Thu, 18 Jan 2024 08:05:59 +0900 Subject: [PATCH] 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* --- packages/aws-cdk-lib/aws-ec2/lib/volume.ts | 12 ++++++------ packages/aws-cdk-lib/aws-ec2/test/volume.test.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/aws-cdk-lib/aws-ec2/lib/volume.ts b/packages/aws-cdk-lib/aws-ec2/lib/volume.ts index 2c29b6e6dbbd9..5b349c2ecd02e 100644 --- a/packages/aws-cdk-lib/aws-ec2/lib/volume.ts +++ b/packages/aws-cdk-lib/aws-ec2/lib/volume.ts @@ -344,7 +344,7 @@ export interface VolumeProps { /** * The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. - * See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html + * See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html * for details on the allowable size for each type of volume. * * @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 { /** * 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, * and 500 IOPS/GiB for both PROVISIONED_IOPS_SSD_IO2 and GENERAL_PURPOSE_SSD_GP3. - * See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html + * See https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html * for more information. * * 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 { /** * The throughput that the volume supports, in MiB/s * Takes a minimum of 125 and maximum of 1000. - * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html#cfn-ec2-ebs-volume-throughput + * @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. */ readonly throughput?: number; @@ -691,11 +691,11 @@ export class Volume extends VolumeBase { ); } // Enforce minimum & maximum IOPS: - // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html + // 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.PROVISIONED_IOPS_SSD] = { Min: 100, Max: 64000 }; - iopsRanges[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2] = { Min: 100, Max: 64000 }; + iopsRanges[EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2] = { Min: 100, Max: 256000 }; const { Min, Max } = iopsRanges[volumeType]; if (props.iops < Min || props.iops > Max) { throw new Error(`\`${volumeType}\` volumes iops must be between ${Min} and ${Max}.`); @@ -739,7 +739,7 @@ export class Volume extends VolumeBase { if (props.size) { const size = props.size.toGibibytes({ rounding: SizeRoundingBehavior.FAIL }); // Enforce minimum & maximum volume size: - // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html + // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html const sizeRanges: { [key: string]: { Min: number, Max: number } } = {}; sizeRanges[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD] = { Min: 1, Max: 16384 }; sizeRanges[EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3] = { Min: 1, Max: 16384 }; diff --git a/packages/aws-cdk-lib/aws-ec2/test/volume.test.ts b/packages/aws-cdk-lib/aws-ec2/test/volume.test.ts index ffe1ef38a9c17..cce55f2497bc8 100644 --- a/packages/aws-cdk-lib/aws-ec2/test/volume.test.ts +++ b/packages/aws-cdk-lib/aws-ec2/test/volume.test.ts @@ -1279,7 +1279,7 @@ describe('volume', () => { for (const testData of [ [EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, 3000, 16000], [EbsDeviceVolumeType.PROVISIONED_IOPS_SSD, 100, 64000], - [EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2, 100, 64000], + [EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2, 100, 256000], ]) { const volumeType = testData[0] as EbsDeviceVolumeType; const min = testData[1] as number;