From 1d15d492f137ab1dec871db4f7409ced4c550d3c Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Tue, 11 Feb 2025 16:23:45 -0800 Subject: [PATCH] fix(opensearchservice): wrong iops limit checks (#33401) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Issue # (if applicable) Closes #29711. ### Reason for this change The actual IOPS limit depends on a few factors: ![Screenshot 2025-02-11 at 1 15 41 PM](https://github.com/user-attachments/assets/de6ab224-03d6-4573-9c9a-a5b14584fb66) Therefore, It is not trivial to maintain the limit checks in CDK. In addition, when the the service changes the limit, the CDK outdated limits will be a blocker for users to use the new limits. All in all, this check creates blockers more than benefit. ### Description of changes Removed the limit check on IOPS. ### Description of how you validated changes Unit Test that were expecting the error was failing after the removal of the check. Removed those test. ### 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* --- .../aws-opensearchservice/lib/domain.ts | 10 ---- .../aws-opensearchservice/test/domain.test.ts | 48 ------------------- 2 files changed, 58 deletions(-) diff --git a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts index 349546bb11d2d..24c68a7f2e9f6 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts @@ -1658,16 +1658,6 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable { '`iops` may only be specified if the `volumeType` is `PROVISIONED_IOPS_SSD`, `PROVISIONED_IOPS_SSD_IO2` or `GENERAL_PURPOSE_SSD_GP3`.', ); } - // Enforce minimum & maximum IOPS: - // https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-ebs-volume.html - const iopsRanges: { [key: string]: { Min: number; Max: number } } = {}; - iopsRanges[ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3] = { Min: 3000, Max: 16000 }; - iopsRanges[ec2.EbsDeviceVolumeType.PROVISIONED_IOPS_SSD] = { Min: 100, Max: 64000 }; - iopsRanges[ec2.EbsDeviceVolumeType.PROVISIONED_IOPS_SSD_IO2] = { Min: 100, Max: 64000 }; - const { Min, Max } = iopsRanges[volumeType]; - if (props.ebs?.iops < Min || props.ebs?.iops > Max) { - throw new Error(`\`${volumeType}\` volumes iops must be between ${Min} and ${Max}.`); - } // Enforce maximum ratio of IOPS/GiB: // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html diff --git a/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts b/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts index 69bcf35b719fa..e806ef5b84f4f 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts @@ -2558,54 +2558,6 @@ describe('EBS Options Configurations', () => { new Domain(stack, `Domain${idx++}`, domainProps); }).toThrow('General Purpose EBS volumes can not be used with Iops or Throughput configuration'); - expect(() => { - const domainProps: DomainProps = { - version: EngineVersion.OPENSEARCH_2_5, - ebs: { - volumeSize: 30, - volumeType: EbsDeviceVolumeType.PROVISIONED_IOPS_SSD, - iops: 99, - }, - }; - new Domain(stack, `Domain${idx++}`, domainProps); - }).toThrow('`io1` volumes iops must be between 100 and 64000.'); - - expect(() => { - const domainProps: DomainProps = { - version: EngineVersion.OPENSEARCH_2_5, - ebs: { - volumeSize: 30, - volumeType: EbsDeviceVolumeType.PROVISIONED_IOPS_SSD, - iops: 64001, - }, - }; - new Domain(stack, `Domain${idx++}`, domainProps); - }).toThrow('`io1` volumes iops must be between 100 and 64000.'); - - expect(() => { - const domainProps: DomainProps = { - version: EngineVersion.OPENSEARCH_2_5, - ebs: { - volumeSize: 30, - volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, - iops: 16001, - }, - }; - new Domain(stack, `Domain${idx++}`, domainProps); - }).toThrow('`gp3` volumes iops must be between 3000 and 16000.'); - - expect(() => { - const domainProps: DomainProps = { - version: EngineVersion.OPENSEARCH_2_5, - ebs: { - volumeSize: 30, - volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, - iops: 2999, - }, - }; - new Domain(stack, `Domain${idx++}`, domainProps); - }).toThrow('`gp3` volumes iops must be between 3000 and 16000.'); - expect(() => { const domainProps: DomainProps = { version: EngineVersion.OPENSEARCH_2_5,