When experimenting with AWS SAM (or after our startup didn't go as well as we'd hoped) we may want to delete our entire stack in order to avoid excess charges from AWS (bear in mind that AWS has a lot of services in free tier, like Lambda, DynamoDB and S3).
In this lesson we're going to learn how to delete an AWS SAM application stack using the AWS Console.
Instructor: [0:00] Even though AWS has many Free Tier services, such AWS Lambda, which has one million free requests per month or DynamoDB, which gives you 25 gigabytes of storage for free, at some point you may want to delete your AWS SAM application stack or just in case.
[0:15] In order to do that, we can go to Lambda. Navigate to applications. Afterwards, click on our stack, actions, and delete. It's going to say that we have to go to CloudFormation in order to delete our application stack. Let's follow the thing.
[0:29] Here we can see our stack. Now it's even better because I actually have an issue with the stack right now. I would like to delete it because I would like to redeploy the stack again from scratch.
[0:37] In order to do that, click on delete. Confirm that yes, I would like to delete all those resources. This is going to take a while. It can honestly take a couple of minutes in order to delete all your resources. Bear in mind that sometimes you may have issue with deleting your stack.
[0:50] For instance, over here, the following resource failed to delete, my files bucket. The reason is that I actually had files in my bucket. Before proceeding, I have to delete the bucket myself.
[0:59] Let's go to services, S3, select my bucket, and click on delete. Type the name of the bucket in order to confirm the deletion. I'm actually lazy, so I'm going to copy and paste the name of this bucket and confirm that yes, I would like this bucket to be deleted.
[1:12] Now, back in CloudFormation, let's click on delete again. It's going to tell us that we didn't actually have to delete the bucket. If we want to retain the bucket and only see the content of this bucket, we could just go ahead and click over here in order to retain those resources.
[1:26] I would like to delete everything completely. I've deleted the bucket, and I'm going to delete the entire stack. Right now, it says, "Delete in progress." Again, this is going to take a bunch of minutes. As soon as the status changes to delete complete, our stack is no more.