Closed trivikr closed 3 years ago
The workaround is to manually empty the files-bucket using CLI or AWS console, and run the yarn cdk destroy
command.
Verified that deletion is successful:
Are you sure you want to delete: aws-sdk-js-notes-app (y/n)? y
aws-sdk-js-notes-app: destroying...
11:05:31 PM | DELETE_IN_PROGRESS | AWS::CloudFormation::Stack | aws-sdk-js-notes-app
✅ aws-sdk-js-notes-app: destroyed
The existing removalPolicy for files-bucket
is cdk.RemovalPolicy.DESTROY
It should be changed to SNAPSHOT to delete the resource.
This issue can't be fixed as AWS::S3::Bucket does not support deletion policy Snapshot
Following error was thrown when SNAPSHOT removalPolicy was attempted.
❌ aws-sdk-js-notes-app failed: Error [ValidationError]: Template error: resource type AWS::S3::Bucket does not support deletion policy Snapshot
at Request.extractError (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/protocol/query.js:50:29)
at Request.callListeners (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/request.js:688:14)
at Request.transition (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/request.js:690:12)
at Request.callListeners (/Users/trivikr/workspace/aws-sdk-js-notes-app/node_modules/aws-sdk/lib/sequential_executor.js:116:18) {
code: 'ValidationError',
time: 2021-08-05T21:03:14.278Z,
requestId: 'a5c25cdc-1923-4b49-bb08-b13d83ae09fb',
statusCode: 400,
retryable: false,
retryDelay: 692.6105252129084
}
Template error: resource type AWS::S3::Bucket does not support deletion policy Snapshot
Describe the bug
The
yarn cdk detroy
command fails with the following error if the files bucket is not empty:Steps to reproduce
yarn cdk destroy
Observed behavior
The command fails with the following error:
Expected behavior
The command successfully deletes the AWS infrastructure.