If you are running this workshop at an AWS event using a temporary AWS Account, you do not need to complete this section. You have already completed the workshop. Congratulations!
Go to the the terminal on your environment and type the following command. Be sure to navigate to your cdk folder.
~/environment/aws-alien-attack/infrastructure/cdk (master) $ cdk destroy -c envname=$envname
If everything went well, you will receive a message that looks like the following:
✅ <YourEnvironmentName>: destroyed
If you receive an error that looks something like this:
<YourEnvironmentName>: destroy failed Error: The stack named <YourEnvironmentName> is in a failed state: DELETE_FAILED (The following resource(s) failed to delete: [WebSocketLayer<YourEnvironmentName>WebSocketSynchronizeStartFnRole]. )
That is ok we have worked with AWS CDK at Unicorn Games before and can solve this!
If by any reason you no longer have access to the Cloud9 environment, or you are unable to destroy the environment using AWS CDK, go to CloudFormation on your AWS console, and delete the stack with “Stack Name” corresponding to your . Then move to the next activity.
Everything that was created by CloudFormation was deleted with the exception of your S3 buckets. Additionally, the resources that you created directly on the console were not deleted.
Let’s fix this.