Skip to content

Commit

Permalink
fix(opensearchservice): wrong iops limit checks (#33401)
Browse files Browse the repository at this point in the history
### 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*
  • Loading branch information
samson-keung authored Feb 12, 2025
1 parent 19e603b commit 1d15d49
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
10 changes: 0 additions & 10 deletions packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 0 additions & 48 deletions packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1d15d49

Please sign in to comment.