From b3255993963779b526108ebc0bddd72f24c0beff Mon Sep 17 00:00:00 2001 From: tmokmss Date: Mon, 25 Mar 2024 23:44:51 +0900 Subject: [PATCH 1/2] chore(opensearchservice): T3 instance type does not support Multi-AZ with standby feature --- .../aws-opensearchservice/lib/domain.ts | 4 ++++ .../aws-opensearchservice/test/domain.test.ts | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts index 81c7060dd7f2f..3d9803c5efb2f 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts @@ -1827,6 +1827,10 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable { } } + if (isSomeInstanceType('t3') && multiAzWithStandbyEnabled) { + throw new Error('T3 instance types does not support Multi-AZ with standby feature.'); + } + const offPeakWindowEnabled = props.offPeakWindowEnabled ?? props.offPeakWindowStart !== undefined; if (offPeakWindowEnabled) { this.validateWindowStartTime(props.offPeakWindowStart); 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 4c7796fe3e5ea..f14bd8778d548 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts @@ -408,6 +408,27 @@ each([testedOpenSearchVersions]).test('can specify multiAZWithStandbyEnabled in }); }); +each([testedOpenSearchVersions]).test('multiAZWithStandbyEnabled: true throws with t3 instance type (data node)', (engineVersion) => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + capacity: { + dataNodeInstanceType: 't3.medium.search', + multiAzWithStandbyEnabled: true, + }, + })).toThrow(/T3 instance types does not support Multi-AZ with standby feature\./); +}); + +each([testedOpenSearchVersions]).test('multiAZWithStandbyEnabled: true throws with t3 instance type (master node)', (engineVersion) => { + expect(() => new Domain(stack, 'Domain', { + version: engineVersion, + capacity: { + masterNodeInstanceType: 't3.medium.search', + masterNodes: 1, + multiAzWithStandbyEnabled: true, + }, + })).toThrow(/T3 instance types does not support Multi-AZ with standby feature\./); +}); + each([testedOpenSearchVersions]).test('ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY set multiAZWithStandbyEnabled value', (engineVersion) => { const stackWithFlag = new Stack(app, 'StackWithFlag', { env: { account: '1234', region: 'testregion' }, From e6ff4ad18cf1e60b4a76f6361267d9785a74341f Mon Sep 17 00:00:00 2001 From: tmokmss Date: Wed, 27 Mar 2024 20:55:48 +0900 Subject: [PATCH 2/2] fix grammer --- packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts | 2 +- .../aws-cdk-lib/aws-opensearchservice/test/domain.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts index 3d9803c5efb2f..ef9692bf05ce1 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts @@ -1828,7 +1828,7 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable { } if (isSomeInstanceType('t3') && multiAzWithStandbyEnabled) { - throw new Error('T3 instance types does not support Multi-AZ with standby feature.'); + throw new Error('T3 instance type does not support Multi-AZ with standby feature.'); } const offPeakWindowEnabled = props.offPeakWindowEnabled ?? props.offPeakWindowStart !== undefined; 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 f14bd8778d548..78bbc70afed30 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts @@ -415,7 +415,7 @@ each([testedOpenSearchVersions]).test('multiAZWithStandbyEnabled: true throws wi dataNodeInstanceType: 't3.medium.search', multiAzWithStandbyEnabled: true, }, - })).toThrow(/T3 instance types does not support Multi-AZ with standby feature\./); + })).toThrow(/T3 instance type does not support Multi-AZ with standby feature\./); }); each([testedOpenSearchVersions]).test('multiAZWithStandbyEnabled: true throws with t3 instance type (master node)', (engineVersion) => { @@ -426,7 +426,7 @@ each([testedOpenSearchVersions]).test('multiAZWithStandbyEnabled: true throws wi masterNodes: 1, multiAzWithStandbyEnabled: true, }, - })).toThrow(/T3 instance types does not support Multi-AZ with standby feature\./); + })).toThrow(/T3 instance type does not support Multi-AZ with standby feature\./); }); each([testedOpenSearchVersions]).test('ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY set multiAZWithStandbyEnabled value', (engineVersion) => {