@@ -116,6 +116,7 @@ Create an OpenSearch instance with encryption.
116
116
``` ts title="amplify/backend.ts"
117
117
// highlight-start
118
118
import * as opensearch from ' aws-cdk-lib/aws-opensearchservice' ;
119
+ import { RemovalPolicy } from " aws-cdk-lib" ;
119
120
// highlight-end
120
121
import { defineBackend } from ' @aws-amplify/backend' ;
121
122
import { auth } from ' ./auth/resource' ;
@@ -191,6 +192,7 @@ Get the `s3BucketArn` and `s3BucketName` values from storage resource as shown b
191
192
``` ts title="amplify/backend.ts"
192
193
import * as dynamodb from " aws-cdk-lib/aws-dynamodb" ;
193
194
import * as opensearch from " aws-cdk-lib/aws-opensearchservice" ;
195
+ import { RemovalPolicy } from " aws-cdk-lib" ;
194
196
// highlight-next-line
195
197
import * as iam from " aws-cdk-lib/aws-iam" ;
196
198
import { defineBackend } from " @aws-amplify/backend" ;
@@ -319,6 +321,7 @@ Customize the `template_content` JSON-representation to define the data structur
319
321
``` ts title="amplify/backend.ts"
320
322
import * as dynamodb from " aws-cdk-lib/aws-dynamodb" ;
321
323
import * as opensearch from " aws-cdk-lib/aws-opensearchservice" ;
324
+ import { RemovalPolicy } from " aws-cdk-lib" ;
322
325
import * as iam from " aws-cdk-lib/aws-iam" ;
323
326
import { defineBackend } from " @aws-amplify/backend" ;
324
327
import { auth } from " ./auth/resource" ;
@@ -354,6 +357,8 @@ const openSearchDomain = new opensearch.Domain(
354
357
{
355
358
version: opensearch .EngineVersion .OPENSEARCH_2_11 ,
356
359
nodeToNodeEncryption: true ,
360
+ // set removalPolicy to DESTROY to make sure the open search domain is deleted on stack deletion.
361
+ removalPolicy: RemovalPolicy .DESTROY ,
357
362
encryptionAtRest: {
358
363
enabled: true ,
359
364
},
@@ -456,6 +461,7 @@ The configuration is a data-prepper feature of OpenSearch. For specific document
456
461
``` ts title="amplify/backend.ts"
457
462
import * as dynamodb from " aws-cdk-lib/aws-dynamodb" ;
458
463
import * as opensearch from " aws-cdk-lib/aws-opensearchservice" ;
464
+ import { RemovalPolicy } from " aws-cdk-lib" ;
459
465
import * as iam from " aws-cdk-lib/aws-iam" ;
460
466
import { defineBackend } from " @aws-amplify/backend" ;
461
467
import { auth } from " ./auth/resource" ;
@@ -491,6 +497,8 @@ const openSearchDomain = new opensearch.Domain(
491
497
{
492
498
version: opensearch .EngineVersion .OPENSEARCH_2_11 ,
493
499
nodeToNodeEncryption: true ,
500
+ // set removalPolicy to DESTROY to make sure the open search domain is deleted on stack deletion.
501
+ removalPolicy: RemovalPolicy .DESTROY ,
494
502
encryptionAtRest: {
495
503
enabled: true ,
496
504
},
@@ -648,6 +656,7 @@ Now, create the OSIS pipeline resource:
648
656
``` ts title="amplify/backend.ts"
649
657
import * as dynamodb from " aws-cdk-lib/aws-dynamodb" ;
650
658
import * as opensearch from " aws-cdk-lib/aws-opensearchservice" ;
659
+ import { RemovalPolicy } from " aws-cdk-lib" ;
651
660
import * as iam from " aws-cdk-lib/aws-iam" ;
652
661
// highlight-start
653
662
import * as osis from " aws-cdk-lib/aws-osis" ;
@@ -688,6 +697,8 @@ const openSearchDomain = new opensearch.Domain(
688
697
{
689
698
version: opensearch .EngineVersion .OPENSEARCH_2_11 ,
690
699
nodeToNodeEncryption: true ,
700
+ // set removalPolicy to DESTROY to make sure the open search domain is deleted on stack deletion.
701
+ removalPolicy: RemovalPolicy .DESTROY ,
691
702
encryptionAtRest: {
692
703
enabled: true ,
693
704
},
0 commit comments