Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(opensearchservice): configuring gp3 throughput #26172

Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Updated tests after merge conflict
  • Loading branch information
sktan committed Aug 7, 2023
commit 43553b310a973feb39f8faad497e1ecaf1e28cb9
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.0.0",
"version": "33.0.0",
"files": {
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
"source": {
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "32.0.0",
"version": "33.0.0",
"files": {
"aa938a4673097be62b5be7544278cf85696c7afb4f575b2b9ce78688a771caf6": {
"213b01de3bb16c293563a528b8be2db8d685bf9228b484f6c369e8ce3f9f3958": {
"source": {
"path": "cdk-integ-opensearch-gp3.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "aa938a4673097be62b5be7544278cf85696c7afb4f575b2b9ce78688a771caf6.json",
"objectKey": "213b01de3bb16c293563a528b8be2db8d685bf9228b484f6c369e8ce3f9f3958.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
"DedicatedMasterEnabled": false,
"InstanceCount": 1,
"InstanceType": "r5.large.search",
"MultiAZWithStandbyEnabled": true,
"ZoneAwarenessEnabled": false
},
"DomainEndpointOptions": {
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"32.0.0"}
{"version":"33.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.0.0",
"version": "33.0.0",
"testCases": {
"Integ/DefaultTest": {
"stacks": [
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "32.0.0",
"version": "33.0.0",
"artifacts": {
"cdk-integ-opensearch-gp3.assets": {
"type": "cdk:asset-manifest",
@@ -17,7 +17,7 @@
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/aa938a4673097be62b5be7544278cf85696c7afb4f575b2b9ce78688a771caf6.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/213b01de3bb16c293563a528b8be2db8d685bf9228b484f6c369e8ce3f9f3958.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
"dedicatedMasterEnabled": false,
"instanceCount": 1,
"instanceType": "r5.large.search",
"multiAzWithStandbyEnabled": true,
"zoneAwarenessEnabled": false
},
"domainEndpointOptions": {
@@ -91,7 +92,7 @@
"path": "Integ/DefaultTest/Default",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.2.55"
"version": "10.2.69"
}
},
"DeployAssert": {
@@ -137,7 +138,7 @@
"path": "Tree",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.2.55"
"version": "10.2.69"
}
}
},
207 changes: 207 additions & 0 deletions packages/aws-cdk-lib/aws-opensearchservice/test/ebsoptions.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
/* eslint-disable jest/expect-expect */
import { Template } from '../../assertions';
import { EbsDeviceVolumeType } from '../../aws-ec2';
import { App, Stack } from '../../core';
import { Domain, DomainProps, EngineVersion } from '../lib';

let app: App;
let stack: Stack;

beforeEach(() => {
app = new App();
stack = new Stack(app, 'Stack', {
env: { account: '1234', region: 'testregion' },
});

jest.resetAllMocks();
});

describe('EBS Options Configurations', () => {

test('iops', () => {
const domainProps: DomainProps = {
version: EngineVersion.OPENSEARCH_2_5,
ebs: {
volumeSize: 30,
iops: 500,
volumeType: EbsDeviceVolumeType.PROVISIONED_IOPS_SSD,
},
};
new Domain(stack, 'Domain', domainProps);

Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', {
EBSOptions: {
VolumeSize: 30,
Iops: 500,
VolumeType: 'io1',
},
});
});

test('throughput', () => {
const domainProps: DomainProps = {
version: EngineVersion.OPENSEARCH_2_5,
ebs: {
volumeSize: 30,
throughput: 125,
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3,
},
};
new Domain(stack, 'Domain', domainProps);

Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', {
EBSOptions: {
VolumeSize: 30,
Throughput: 125,
VolumeType: 'gp3',
},
});
});

test('throughput and iops', () => {
const domainProps: DomainProps = {
version: EngineVersion.OPENSEARCH_2_5,
ebs: {
volumeSize: 30,
iops: 3000,
throughput: 125,
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3,
},
};
new Domain(stack, 'Domain', domainProps);

Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', {
EBSOptions: {
VolumeSize: 30,
iops: 3000,
Throughput: 125,
VolumeType: 'gp3',
},
});
});

test('validation required props', () => {
let idx: number = 0;

expect(() => {
const domainProps: DomainProps = {
version: EngineVersion.OPENSEARCH_2_5,
ebs: {
volumeSize: 30,
volumeType: EbsDeviceVolumeType.PROVISIONED_IOPS_SSD,
},
};
new Domain(stack, `Domain${idx++}`, domainProps);
}).toThrow('`iops` must be specified if the `volumeType` is `PROVISIONED_IOPS_SSD`.');

expect(() => {
const domainProps: DomainProps = {
version: EngineVersion.OPENSEARCH_2_5,
ebs: {
volumeSize: 30,
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD,
iops: 125,
},
};
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: {
iops: 125,
},
};
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,
ebs: {
volumeSize: 30,
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3,
throughput: 1024,
},
};
new Domain(stack, `Domain${idx++}`, domainProps);
}).toThrow(
'throughput property takes a minimum of 125 and a maximum of 1000.',
);

expect(() => {
const domainProps: DomainProps = {
version: EngineVersion.OPENSEARCH_2_5,
ebs: {
volumeSize: 30,
volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3,
throughput: 100,
},
};
new Domain(stack, `Domain${idx++}`, domainProps);
}).toThrow(
'throughput property takes a minimum of 125 and a maximum of 1000.',
);
});
});