Having completed this training module successfully we can now rollback the deployed resources.
To roll back the CDK stacks we use command npx cdk destroy, however, the DynamoDb tables that were created are not deleted and the codebuild reports and report groups for the pipelines are also not terminated and if not deleted first will cause stack termination to fail.
For these reasons we will use scripts, located in the scripts folder, to remove these resources first.
./scripts/cleanup-dynamodb-tables.sh./scripts/cleanup-dynamodb-tables.sh./scripts/cleanup-codebuild-reportgroups.shNow we can proceed to terminate the stacks:
Use npx cdk list to provide the names of the stacks to be rolled back, ie:
To remove the deployed dev and test stack resources and pipelines from your Dev and Test Accounts execute:
npx cdk destroy ‘ProjectName’-pipeline-test-GLF/‘ProjectName’-Frontend/UInpx cdk destroy ‘ProjectName’-pipeline-test-GLF/‘ProjectName’-Backend/APInpx cdk destroy ‘ProjectName’-pipeline-dev-GLF/‘ProjectName’-Frontend/UInpx cdk destroy ‘ProjectName’-pipeline-dev-GLF/‘ProjectName’-Backend/APInpx cdk destroy --all - Message shows ‘ProjectName’-pipeline-dev-GLF: destroyedAll training resources should now be deleted