From 6c75581ae2b9537fa9d1d724b837fe81ae22d345 Mon Sep 17 00:00:00 2001 From: Luca Pizzini Date: Mon, 17 Jul 2023 19:29:15 +0200 Subject: [PATCH] feat(opensearchservice): support for MultiAZWithStandBy (under feature flag) (#26082) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fix adds support for the [`MultiAZWithStandbyEnabled`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-opensearchservice-domain-clusterconfig.html#:~:text=%3A%20No%20interruption-,MultiAZWithStandbyEnabled,Update%20requires%3A%20No%20interruption,-WarmCount) flag to the [`CapacityConfig`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_opensearchservice.CapacityConfig.html) interface. If enabled, the `ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY` feature flag set the default value of `MultiAZWithStandbyEnabled` to `true` Closes #26026. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../appsync-opensearch.template.json | 3 +- .../test/integ.graphql-opensearch.ts | 3 + ...-opensearch-advancedsecurity.template.json | 3 +- .../test/integ.opensearch.advancedsecurity.ts | 3 + ...search-cognitodashboardsauth.template.json | 3 +- .../integ.opensearch.cognitodashboardsauth.ts | 3 + ...eg-opensearch-custom-kms-key.template.json | 3 +- .../test/integ.opensearch.custom-kms-key.ts | 3 + .../cdk-integ-opensearch.template.json | 6 +- .../cdk-integ-opensearch.template.json | 3 +- .../test/integ.opensearch.min.ts | 3 + ...efaultTestDeployAssertFD2E7982.assets.json | 19 +++ ...aultTestDeployAssertFD2E7982.template.json | 36 +++++ ...pensearch-multiaz-with-standby.assets.json | 19 +++ ...nsearch-multiaz-with-standby.template.json | 74 +++++++++ .../cdk.out | 1 + .../integ.json | 12 ++ .../manifest.json | 111 +++++++++++++ .../tree.json | 153 ++++++++++++++++++ .../integ.opensearch.multiaz-with-standby.ts | 32 ++++ .../test/integ.opensearch.ts | 3 + ...k-integ-opensearch-ultrawarm.template.json | 3 +- .../test/integ.opensearch.ultrawarm.ts | 1 + ...opensearch-unsignedbasicauth.template.json | 3 +- .../integ.opensearch.unsignedbasicauth.ts | 3 + .../cdk-integ-opensearch-vpc.template.json | 3 +- .../test/integ.opensearch.vpc.ts | 1 + .../aws-opensearchservice/README.md | 23 +++ .../aws-opensearchservice/lib/domain.ts | 17 ++ .../aws-opensearchservice/test/domain.test.ts | 32 ++++ packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md | 20 ++- packages/aws-cdk-lib/cx-api/lib/features.ts | 13 ++ 32 files changed, 604 insertions(+), 11 deletions(-) create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk-integ-opensearch-multiaz-with-standby.assets.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk-integ-opensearch-multiaz-with-standby.template.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk.out create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/integ.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/manifest.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/tree.json create mode 100644 packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.ts diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.template.json index d754b3115a94f..4af35a8a8a6db 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.js.snapshot/appsync-opensearch.template.json @@ -22,7 +22,8 @@ "DedicatedMasterEnabled": false, "InstanceCount": 1, "InstanceType": "r5.large.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": true, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.ts index f932464759649..a41a1c04fba0e 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-appsync/test/integ.graphql-opensearch.ts @@ -23,6 +23,9 @@ class OpensSearch23Stack extends cdk.Stack { }, nodeToNodeEncryption: true, enforceHttps: true, + capacity: { + multiAzWithStandbyEnabled: false, + }, }); const api = new appsync.GraphqlApi(this, 'api', { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.template.json index 835566d4606f2..0343e1a25770f 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.js.snapshot/cdk-integ-opensearch-advancedsecurity.template.json @@ -22,7 +22,8 @@ "DedicatedMasterEnabled": false, "InstanceCount": 1, "InstanceType": "r5.large.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": true, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts index d81e16ba0be2b..282cb013c4059 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.advancedsecurity.ts @@ -20,6 +20,9 @@ class TestStack extends Stack { }, nodeToNodeEncryption: true, enforceHttps: true, + capacity: { + multiAzWithStandbyEnabled: false, + }, }); } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json index 35c05f7dceaa0..82b5f5f7385b4 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.js.snapshot/cdk-integ-opensearch-cognitodashboardsauth.template.json @@ -84,7 +84,8 @@ "DedicatedMasterEnabled": false, "InstanceCount": 1, "InstanceType": "r5.large.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "CognitoOptions": { "Enabled": true, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts index 4631bb995a891..bd6eb5eeb2a97 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.cognitodashboardsauth.ts @@ -39,6 +39,9 @@ class TestStack extends Stack { identityPoolId: identityPool.ref, userPoolId: userPool.userPoolId, }, + capacity: { + multiAzWithStandbyEnabled: false, + }, }); } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.template.json index 00e0a0b0c2a2e..a39e430176ce5 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.js.snapshot/cdk-integ-opensearch-custom-kms-key.template.json @@ -42,7 +42,8 @@ "DedicatedMasterEnabled": false, "InstanceCount": 1, "InstanceType": "r5.large.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": false, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts index f7adc8b27b54e..01ab3a3800779 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.custom-kms-key.ts @@ -26,6 +26,9 @@ class TestStack extends Stack { resources: ['*'], }), ], + capacity: { + multiAzWithStandbyEnabled: false, + }, }; new opensearch.Domain(this, 'Domain', domainProps); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.template.json index 2d2c25d874919..9de0556a6cd5b 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.js.snapshot/cdk-integ-opensearch.template.json @@ -114,7 +114,8 @@ "DedicatedMasterEnabled": false, "InstanceCount": 1, "InstanceType": "r5.large.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": false, @@ -419,7 +420,8 @@ "DedicatedMasterEnabled": false, "InstanceCount": 1, "InstanceType": "r5.large.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": false, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.min.js.snapshot/cdk-integ-opensearch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.min.js.snapshot/cdk-integ-opensearch.template.json index 48f820382edcb..96ef1b2bd6d94 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.min.js.snapshot/cdk-integ-opensearch.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.min.js.snapshot/cdk-integ-opensearch.template.json @@ -7,7 +7,8 @@ "DedicatedMasterEnabled": false, "InstanceCount": 1, "InstanceType": "r5.large.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": false, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.min.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.min.ts index d59ed61a69aba..2861e1090b74c 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.min.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.min.ts @@ -11,6 +11,9 @@ class TestStack extends Stack { const domainProps: opensearch.DomainProps = { version: opensearch.EngineVersion.OPENSEARCH_2_7, removalPolicy: RemovalPolicy.DESTROY, + capacity: { + multiAzWithStandbyEnabled: false, + }, }; new opensearch.Domain(this, 'Domain', domainProps); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.assets.json new file mode 100644 index 0000000000000..9c38e48598e3a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.assets.json @@ -0,0 +1,19 @@ +{ + "version": "32.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk-integ-opensearch-multiaz-with-standby.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk-integ-opensearch-multiaz-with-standby.assets.json new file mode 100644 index 0000000000000..1a6854221f39b --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk-integ-opensearch-multiaz-with-standby.assets.json @@ -0,0 +1,19 @@ +{ + "version": "32.0.0", + "files": { + "722892555255764f20f275e929016594c8562b137bbdfb5df2a004c9565301df": { + "source": { + "path": "cdk-integ-opensearch-multiaz-with-standby.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "722892555255764f20f275e929016594c8562b137bbdfb5df2a004c9565301df.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk-integ-opensearch-multiaz-with-standby.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk-integ-opensearch-multiaz-with-standby.template.json new file mode 100644 index 0000000000000..5e389c4440743 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk-integ-opensearch-multiaz-with-standby.template.json @@ -0,0 +1,74 @@ +{ + "Resources": { + "Domain66AC69E0": { + "Type": "AWS::OpenSearchService::Domain", + "Properties": { + "ClusterConfig": { + "DedicatedMasterCount": 3, + "DedicatedMasterEnabled": true, + "DedicatedMasterType": "r5.large.search", + "InstanceCount": 3, + "InstanceType": "r5.large.search", + "MultiAZWithStandbyEnabled": true, + "ZoneAwarenessConfig": { + "AvailabilityZoneCount": 3 + }, + "ZoneAwarenessEnabled": true + }, + "DomainEndpointOptions": { + "EnforceHTTPS": false, + "TLSSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" + }, + "EBSOptions": { + "EBSEnabled": true, + "VolumeSize": 10, + "VolumeType": "gp3" + }, + "EncryptionAtRestOptions": { + "Enabled": false + }, + "EngineVersion": "OpenSearch_1.3", + "LogPublishingOptions": {}, + "NodeToNodeEncryptionOptions": { + "Enabled": false + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk.out new file mode 100644 index 0000000000000..f0b901e7c06e5 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"32.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/integ.json new file mode 100644 index 0000000000000..bce699bd1bddb --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "32.0.0", + "testCases": { + "IntegOpenSearchMultiAzWithStandby/DefaultTest": { + "stacks": [ + "cdk-integ-opensearch-multiaz-with-standby" + ], + "assertionStack": "IntegOpenSearchMultiAzWithStandby/DefaultTest/DeployAssert", + "assertionStackName": "IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/manifest.json new file mode 100644 index 0000000000000..c64bf769d8ad4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/manifest.json @@ -0,0 +1,111 @@ +{ + "version": "32.0.0", + "artifacts": { + "cdk-integ-opensearch-multiaz-with-standby.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "cdk-integ-opensearch-multiaz-with-standby.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "cdk-integ-opensearch-multiaz-with-standby": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "cdk-integ-opensearch-multiaz-with-standby.template.json", + "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}/722892555255764f20f275e929016594c8562b137bbdfb5df2a004c9565301df.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "cdk-integ-opensearch-multiaz-with-standby.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "cdk-integ-opensearch-multiaz-with-standby.assets" + ], + "metadata": { + "/cdk-integ-opensearch-multiaz-with-standby/Domain/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Domain66AC69E0" + } + ], + "/cdk-integ-opensearch-multiaz-with-standby/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/cdk-integ-opensearch-multiaz-with-standby/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "cdk-integ-opensearch-multiaz-with-standby" + }, + "IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.template.json", + "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}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "IntegOpenSearchMultiAzWithStandbyDefaultTestDeployAssertFD2E7982.assets" + ], + "metadata": { + "/IntegOpenSearchMultiAzWithStandby/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/IntegOpenSearchMultiAzWithStandby/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "IntegOpenSearchMultiAzWithStandby/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/tree.json new file mode 100644 index 0000000000000..9fcf3ff1706e6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.js.snapshot/tree.json @@ -0,0 +1,153 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "cdk-integ-opensearch-multiaz-with-standby": { + "id": "cdk-integ-opensearch-multiaz-with-standby", + "path": "cdk-integ-opensearch-multiaz-with-standby", + "children": { + "Domain": { + "id": "Domain", + "path": "cdk-integ-opensearch-multiaz-with-standby/Domain", + "children": { + "Resource": { + "id": "Resource", + "path": "cdk-integ-opensearch-multiaz-with-standby/Domain/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::OpenSearchService::Domain", + "aws:cdk:cloudformation:props": { + "clusterConfig": { + "dedicatedMasterEnabled": true, + "dedicatedMasterCount": 3, + "dedicatedMasterType": "r5.large.search", + "instanceCount": 3, + "instanceType": "r5.large.search", + "multiAzWithStandbyEnabled": true, + "zoneAwarenessEnabled": true, + "zoneAwarenessConfig": { + "availabilityZoneCount": 3 + } + }, + "domainEndpointOptions": { + "enforceHttps": false, + "tlsSecurityPolicy": "Policy-Min-TLS-1-0-2019-07" + }, + "ebsOptions": { + "ebsEnabled": true, + "volumeSize": 10, + "volumeType": "gp3" + }, + "encryptionAtRestOptions": { + "enabled": false + }, + "engineVersion": "OpenSearch_1.3", + "logPublishingOptions": {}, + "nodeToNodeEncryptionOptions": { + "enabled": false + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_opensearchservice.CfnDomain", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_opensearchservice.Domain", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "cdk-integ-opensearch-multiaz-with-standby/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "cdk-integ-opensearch-multiaz-with-standby/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "IntegOpenSearchMultiAzWithStandby": { + "id": "IntegOpenSearchMultiAzWithStandby", + "path": "IntegOpenSearchMultiAzWithStandby", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "IntegOpenSearchMultiAzWithStandby/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "IntegOpenSearchMultiAzWithStandby/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.55" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "IntegOpenSearchMultiAzWithStandby/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "IntegOpenSearchMultiAzWithStandby/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "IntegOpenSearchMultiAzWithStandby/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.2.55" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.ts new file mode 100644 index 0000000000000..f3f2679930f77 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.multiaz-with-standby.ts @@ -0,0 +1,32 @@ +import { App, RemovalPolicy, Stack } from 'aws-cdk-lib'; +import { EbsDeviceVolumeType } from 'aws-cdk-lib/aws-ec2'; +import * as opensearch from 'aws-cdk-lib/aws-opensearchservice'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +const app = new App(); + +const stack = new Stack(app, 'cdk-integ-opensearch-multiaz-with-standby'); + +const domainProps: opensearch.DomainProps = { + removalPolicy: RemovalPolicy.DESTROY, + version: opensearch.EngineVersion.OPENSEARCH_1_3, + ebs: { + volumeSize: 10, + volumeType: EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, + }, + zoneAwareness: { + enabled: true, + availabilityZoneCount: 3, + }, + capacity: { + multiAzWithStandbyEnabled: true, + masterNodes: 3, + dataNodes: 3, + }, +}; + +new opensearch.Domain(stack, 'Domain', domainProps); + +new IntegTest(app, 'IntegOpenSearchMultiAzWithStandby', { testCases: [stack] }); + +app.synth(); diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ts index 30c81360b8c80..68b8b9bd8bd5d 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ts @@ -38,6 +38,9 @@ class TestStack extends Stack { resources: ['*'], }), ], + capacity: { + multiAzWithStandbyEnabled: false, + }, }; // create 2 domains to ensure that Cloudwatch Log Group policy names dont conflict diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.template.json index 4d2c03a81d02e..6e0ddaa07d7be 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.js.snapshot/cdk-integ-opensearch-ultrawarm.template.json @@ -12,7 +12,8 @@ "WarmCount": 2, "WarmEnabled": true, "WarmType": "ultrawarm1.medium.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": false, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts index 068b79b63d77b..b16969439d28a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.ultrawarm.ts @@ -12,6 +12,7 @@ class TestStack extends Stack { capacity: { masterNodes: 2, warmNodes: 2, + multiAzWithStandbyEnabled: false, }, }); } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json index 35be0a6567615..a2e23d2e95027 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.js.snapshot/cdk-integ-opensearch-unsignedbasicauth.template.json @@ -38,7 +38,8 @@ "DedicatedMasterEnabled": false, "InstanceCount": 1, "InstanceType": "r5.large.search", - "ZoneAwarenessEnabled": false + "ZoneAwarenessEnabled": false, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": true, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts index 0137b496e1ffe..1a10d92a672bc 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.unsignedbasicauth.ts @@ -11,6 +11,9 @@ class TestStack extends Stack { removalPolicy: RemovalPolicy.DESTROY, version: opensearch.EngineVersion.ELASTICSEARCH_7_1, useUnsignedBasicAuth: true, + capacity: { + multiAzWithStandbyEnabled: false, + }, }); } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.template.json index c184878ac1456..f14dbb39042de 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.js.snapshot/cdk-integ-opensearch-vpc.template.json @@ -427,7 +427,8 @@ "ZoneAwarenessConfig": { "AvailabilityZoneCount": 2 }, - "ZoneAwarenessEnabled": true + "ZoneAwarenessEnabled": true, + "MultiAZWithStandbyEnabled": false }, "DomainEndpointOptions": { "EnforceHTTPS": false, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.ts index c3384b8ca9b4f..85714cf5e9e09 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-opensearchservice/test/integ.opensearch.vpc.ts @@ -26,6 +26,7 @@ class TestStack extends Stack { }, capacity: { dataNodes: 2, + multiAzWithStandbyEnabled: false, }, }; diff --git a/packages/aws-cdk-lib/aws-opensearchservice/README.md b/packages/aws-cdk-lib/aws-opensearchservice/README.md index 4cc95a5493a85..243d58f30dad0 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/README.md +++ b/packages/aws-cdk-lib/aws-opensearchservice/README.md @@ -374,3 +374,26 @@ const domain = new Domain(this, 'Domain', { }, }); ``` + +## Enable support for Multi-AZ with Standby deployment + +The domain can be configured to use [multi-AZ with standby](https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html#managedomains-za-standby). + +```ts +const domain = new Domain(this, 'Domain', { + version: EngineVersion.OPENSEARCH_1_3, + ebs: { + volumeSize: 10, + volumeType: ec2.EbsDeviceVolumeType.GENERAL_PURPOSE_SSD_GP3, + }, + zoneAwareness: { + enabled: true, + availabilityZoneCount: 3, + }, + capacity: { + multiAzWithStandbyEnabled: true, + masterNodes: 3, + dataNodes: 3, + }, +}); +``` \ No newline at end of file diff --git a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts index 966998e40360b..7d26800e76bf3 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/lib/domain.ts @@ -15,6 +15,7 @@ import * as logs from '../../aws-logs'; import * as route53 from '../../aws-route53'; import * as secretsmanager from '../../aws-secretsmanager'; import * as cdk from '../../core'; +import * as cxapi from '../../cx-api'; /** * Configures the capacity of the cluster such as the instance type and the @@ -73,6 +74,14 @@ export interface CapacityConfig { */ readonly warmInstanceType?: string; + /** + * Indicates whether Multi-AZ with Standby deployment option is enabled. + * For more information, see [Multi-AZ with Standby] + * (https://docs.aws.amazon.com/opensearch-service/latest/developerguide/managedomains-multiaz.html#managedomains-za-standby) + * + * @default - no multi-az with standby + */ + readonly multiAzWithStandbyEnabled?: boolean; } /** @@ -1542,6 +1551,13 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable { } } + let multiAzWithStandbyEnabled = props.capacity?.multiAzWithStandbyEnabled; + if (multiAzWithStandbyEnabled === undefined) { + if (cdk.FeatureFlags.of(this).isEnabled(cxapi.ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY)) { + multiAzWithStandbyEnabled = true; + } + } + // Create the domain this.domain = new CfnDomain(this, 'Resource', { domainName: this.physicalName, @@ -1556,6 +1572,7 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable { : undefined, instanceCount, instanceType, + multiAzWithStandbyEnabled, warmEnabled: warmEnabled ? warmEnabled : 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 b4e2cb8e83fcf..ecb9c8a970a09 100644 --- a/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts +++ b/packages/aws-cdk-lib/aws-opensearchservice/test/domain.test.ts @@ -9,6 +9,7 @@ import * as kms from '../../aws-kms'; import * as logs from '../../aws-logs'; import * as route53 from '../../aws-route53'; import { App, Stack, Duration, SecretValue, CfnParameter, Token } from '../../core'; +import * as cxapi from '../../cx-api'; import { Domain, EngineVersion } from '../lib'; let app: App; @@ -386,6 +387,37 @@ each([testedOpenSearchVersions]).test('can use tokens in capacity configuration' }); }); +each([testedOpenSearchVersions]).test('can specify multiAZWithStandbyEnabled in capacity configuration', (engineVersion) => { + new Domain(stack, 'Domain', { + version: engineVersion, + capacity: { + multiAzWithStandbyEnabled: true, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::OpenSearchService::Domain', { + ClusterConfig: { + MultiAZWithStandbyEnabled: true, + }, + }); +}); + +each([testedOpenSearchVersions]).test('ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY set multiAZWithStandbyEnabled value', (engineVersion) => { + const stackWithFlag = new Stack(app, 'StackWithFlag', { + env: { account: '1234', region: 'testregion' }, + }); + stackWithFlag.node.setContext(cxapi.ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY, true); + new Domain(stackWithFlag, 'Domain', { + version: engineVersion, + }); + + Template.fromStack(stackWithFlag).hasResourceProperties('AWS::OpenSearchService::Domain', { + ClusterConfig: { + MultiAZWithStandbyEnabled: true, + }, + }); +}); + each([testedOpenSearchVersions]).describe('log groups', (engineVersion) => { test('slowSearchLogEnabled should create a custom log group', () => { diff --git a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md index 1fe8d6b287ed4..bad1157e57f3d 100644 --- a/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md +++ b/packages/aws-cdk-lib/cx-api/FEATURE_FLAGS.md @@ -55,6 +55,7 @@ Flags come in three types: | [@aws-cdk/aws-kms:aliasNameRef](#aws-cdkaws-kmsaliasnameref) | KMS Alias name and keyArn will have implicit reference to KMS Key | 2.83.0 | (fix) | | [@aws-cdk/core:includePrefixInUniqueNameGeneration](#aws-cdkcoreincludeprefixinuniquenamegeneration) | Include the stack prefix in the stack name generation process | 2.84.0 | (fix) | | [@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig](#aws-cdkaws-autoscalinggeneratelaunchtemplateinsteadoflaunchconfig) | Generate a launch template when creating an AutoScalingGroup | V2NEXT | (fix) | +| [@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby](#aws-cdkaws-opensearchserviceenableopensearchmultiazwithstandby) | Enables support for Multi-AZ with Standby deployment for opensearch domains | V2NEXT | (default) | @@ -100,7 +101,8 @@ The following json shows the current recommended set of flags, as `cdk init` wou "@aws-cdk/aws-apigateway:requestValidatorUniqueId": true, "@aws-cdk/aws-kms:aliasNameRef": true, "@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig": true, - "@aws-cdk/core:includePrefixInUniqueNameGeneration": true + "@aws-cdk/core:includePrefixInUniqueNameGeneration": true, + "@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby": false } } ``` @@ -1034,4 +1036,20 @@ provided. +### @aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby + +*Enables support for Multi-AZ with Standby deployment for opensearch domains* (default) + +If this is set, an opensearch domain will automatically be created with +multi-az with standby enabled. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| V2NEXT | `false` | `false` | + +**Compatibility with old behavior:** Pass `capacity.multiAzWithStandbyEnabled: false` to `Domain` construct to restore the old behavior. + + diff --git a/packages/aws-cdk-lib/cx-api/lib/features.ts b/packages/aws-cdk-lib/cx-api/lib/features.ts index 335012133d6f6..3a4c461fdcefe 100644 --- a/packages/aws-cdk-lib/cx-api/lib/features.ts +++ b/packages/aws-cdk-lib/cx-api/lib/features.ts @@ -89,6 +89,7 @@ export const APIGATEWAY_REQUEST_VALIDATOR_UNIQUE_ID = '@aws-cdk/aws-apigateway:r export const INCLUDE_PREFIX_IN_UNIQUE_NAME_GENERATION = '@aws-cdk/core:includePrefixInUniqueNameGeneration'; export const KMS_ALIAS_NAME_REF = '@aws-cdk/aws-kms:aliasNameRef'; export const AUTOSCALING_GENERATE_LAUNCH_TEMPLATE = '@aws-cdk/aws-autoscaling:generateLaunchTemplateInsteadOfLaunchConfig'; +export const ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY = '@aws-cdk/aws-opensearchservice:enableOpensearchMultiAzWithStandby'; export const FLAGS: Record = { ////////////////////////////////////////////////////////////////////// @@ -846,6 +847,18 @@ export const FLAGS: Record = { recommendedValue: true, }, + ////////////////////////////////////////////////////////////////////// + [ENABLE_OPENSEARCH_MULTIAZ_WITH_STANDBY]: { + type: FlagType.ApiDefault, + summary: 'Enables support for Multi-AZ with Standby deployment for opensearch domains', + detailsMd: ` + If this is set, an opensearch domain will automatically be created with + multi-az with standby enabled. + `, + introducedIn: { v2: 'V2NEXT' }, + recommendedValue: true, + compatibilityWithOldBehaviorMd: 'Pass `capacity.multiAzWithStandbyEnabled: false` to `Domain` construct to restore the old behavior.', + }, }; const CURRENT_MV = 'v2';