Cleanup

Cleaning Up At an AWS Event

If you are taking the workshop as part of an AWS event and ran it on the AWS Windows VM, please run “c:\finish-lab” shortcut, and after it completes, shut down the VM. Feel free to ignore the rest of the page.

Cleaning Up After Running The Workshop On Your System

Some manual clean up steps are required to delete resources created in the course of this module. You may need to follow these steps if you used your personal or corporate AWS Account.

You will also need to use these steps if you are taking this lab at an AWS event and you simply want to reset your cloud resources and restart the module from the beginning.

When using your personal or corporate AWS Account, leaving resources created by this lab will result in recurring monthly charges for used resources.

Commands below may remove most of the resources (no guarantees though) created in the course of this module.

Delete Infrastructure “Stacks” Created by CDK Projects

To see how CDK could be leveraged for cleanup, open a Command Prompt window and cd to the root of the “CicdInfraAsCode” project. Here run

cdk destroy

to effectively delete the CloudFormation stack produced by the project, which in turn destroys AWS resources comprising our CI/CD pipeline.

As an alternative, you may run

aws cloudformation delete-stack --stack-name Unicorn-Store-CI-CD-PipelineStack

Since hosting environment stack was run as part of the CI/CD pipeline, deleting it is easily done with deleting the corresponding CloudFormation stack:

aws cloudformation delete-stack --stack-name UnicornSuperstoreStack

Although both commands return instantaneously, the process of deleting resources up to 10 minutes, give or take. To see the progress, please browse to CloudFormation -> Stacks in AWS Console. There you should see DELETE_IN_PROGRESS status next to “UnicornSuperstoreStack” and “Unicorn-Store-CI-CD-PipelineStack” items. Refresh the page periodically using the round arrow icon.

Delete ECR Docker Image Repository

aws ecr delete-repository --repository-name unicorn-store-app --force