Amazon Web Services (AWS) - Delete Serverless Application Model (SAM) app

by
Jeremy Canfield |
Updated: November 30 2023
| Amazon Web Services (AWS) articles
This assumes you have already:
- Downloaded and Installed the AWS Serverless Application Model (SAM) CLI on Linux.
- Initialize Serverless Application Model (SAM) app using the sam init command
- Built your Serverless Application Model (SAM) app using the sam build command
- Deployed Serverless Application Model (SAM) app using the sam deploy command
Let's say the template.yaml file for your SAM app is located at /tmp/sam-app/template.yaml.
]$ ll /tmp/sam-app
total 20
drwxrwxr-x 2 ec2-user ec2-user 24 Nov 16 02:13 events
drwxrwxr-x 2 ec2-user ec2-user 63 Nov 16 02:13 hello_world
-rw-rw-r-- 1 ec2-user ec2-user 0 Nov 16 02:13 __init__.py
-rw-rw-r-- 1 ec2-user ec2-user 8329 Nov 16 02:13 README.md
-rw-rw-r-- 1 ec2-user ec2-user 679 Nov 16 02:13 samconfig.toml
-rw-rw-r-- 1 ec2-user ec2-user 1681 Nov 16 02:13 template.yaml
drwxrwxr-x 4 ec2-user ec2-user 80 Nov 16 02:13 tests
The sam delete command can be used to delete the sam app.
~]$ cd /tmp/sam-app
~]$ sam delete
Are you sure you want to delete the stack sam-app in the region us-east-1 ? [y/N]: y
Do you want to delete the template file 2c2442f3170c7728f9899ef18d9d7ac0.template in S3? [y/N]: y
- Deleting S3 object with key f01066ce6035a17ea2adef79e42373b9
- Deleting S3 object with key 37503c517aa90258ae76a6958d006922.template
- Deleting S3 object with key 2c2442f3170c7728f9899ef18d9d7ac0.template
- Deleting Cloudformation stack sam-app
Deleted successfully
Did you find this article helpful?
If so, consider buying me a coffee over at