Skip to content

Commit 8a7c5c8

Browse files
authored
chore(opensearchservice): t3 instance type does not support Multi-AZ with standby feature (#29607)
### Issue # (if applicable) Related with #26026 ### Reason for this change #26082 enabled Multi-AZ with Standby by default, but deployment fails if we use t3 instance type, because it does not support the feature. To fail fast, this PR adds validation on synth time. > Multi-AZ with Standby only works with the m5, c5, r5, r6g, c6g, m6g, r6gd and i3 instance types. > https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html > You can use T3 instance types only if your domain is provisioned without standby. > https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html#latest-gen ### Description of changes If the instance type of data node or master node is t3, throws an error. I also considered to automatically set `multiAzWithStandbyEnabled: false` if we detect any t3 instance type, but it would introduce unwanted behavior e.g. in the below case: ```ts // Initial state // multiAzWithStandbyEnabled: true as there's no t3 instance type new Domain(stack, 'Domain', { version: engineVersion, capacity: { dataNodeInstanceType: 'r5.large.search', }, }) // Update domain to add master nodes with t3 instance type new Domain(stack, 'Domain', { version: engineVersion, capacity: { dataNodeInstanceType: 'r5.large.search', masterNodeInstanceType: 't3.medium.search', masterNodes: 3, }, }) // multiAzWithStandbyEnabled suddenly become false! ``` so we just throw an error. ### Description of how you validated changes Added some unit tests. I also confirmed that it results in deployment error if we try to deploy with t3 instance type & `multiAzWithStandbyEnabled : true` for both data node and master node. ### 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*
1 parent bb1981b commit 8a7c5c8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,6 +1828,10 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable {
18281828
}
18291829
}
18301830

1831+
if (isSomeInstanceType('t3') && multiAzWithStandbyEnabled) {
1832+
throw new Error('T3 instance type does not support Multi-AZ with standby feature.');
1833+
}
1834+
18311835
const offPeakWindowEnabled = props.offPeakWindowEnabled ?? props.offPeakWindowStart !== undefined;
18321836
if (offPeakWindowEnabled) {
18331837
this.validateWindowStartTime(props.offPeakWindowStart);

packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,27 @@ each([testedOpenSearchVersions]).test('can specify multiAZWithStandbyEnabled in
408408
});
409409
});
410410

411+
each([testedOpenSearchVersions]).test('multiAZWithStandbyEnabled: true throws with t3 instance type (data node)', (engineVersion) => {
412+
expect(() => new Domain(stack, 'Domain', {
413+
version: engineVersion,
414+
capacity: {
415+
dataNodeInstanceType: 't3.medium.search',
416+
multiAzWithStandbyEnabled: true,
417+
},
418+
})).toThrow(/T3 instance type does not support Multi-AZ with standby feature\./);
419+
});
420+
421+
each([testedOpenSearchVersions]).test('multiAZWithStandbyEnabled: true throws with t3 instance type (master node)', (engineVersion) => {
422+
expect(() => new Domain(stack, 'Domain', {
423+
version: engineVersion,
424+
capacity: {
425+
masterNodeInstanceType: 't3.medium.search',
426+
masterNodes: 1,
427+
multiAzWithStandbyEnabled: true,
428+
},
429+
})).toThrow(/T3 instance type does not support Multi-AZ with standby feature\./);
430+
});
431+
411432
each([testedOpenSearchVersions]).test('ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY set multiAZWithStandbyEnabled value', (engineVersion) => {
412433
const stackWithFlag = new Stack(app, 'StackWithFlag', {
413434
env: { account: '1234', region: 'testregion' },

0 commit comments

Comments
 (0)