After completing the workshop, you need to delete all resources to avoid unexpected charges. CloudFormation will automatically delete most resources, but some require manual deletion.
CloudFormation cannot delete S3 buckets containing objects. Delete contents first:
# Get bucket names from outputs
FRONTEND_BUCKET=$(aws cloudformation describe-stacks \
--stack-name workshop-aws-dev \
--region ap-southeast-1 \
--query 'Stacks[0].Outputs[?OutputKey==`FrontendBucketName`].OutputValue' \
--output text)
# Delete all objects in frontend bucket
aws s3 rm s3://$FRONTEND_BUCKET --recursive --region ap-southeast-1
# If backend bucket exists
BACKEND_BUCKET="workshop-aws-dev-backend-$(aws sts get-caller-identity --query Account --output text)-ap-southeast-1"
aws s3 rm s3://$BACKEND_BUCKET --recursive --region ap-southeast-1 2>/dev/null || true
Windows:
cd aws
deploy.bat delete
Linux/Mac:
cd aws
./deploy.sh delete
aws cloudformation delete-stack \
--stack-name workshop-aws-dev \
--region ap-southeast-1
# Check status
aws cloudformation describe-stacks \
--stack-name workshop-aws-dev \
--region ap-southeast-1 \
--query 'Stacks[0].StackStatus'
# Wait for stack deletion (may take 10-15 minutes)
aws cloudformation wait stack-delete-complete \
--stack-name workshop-aws-dev \
--region ap-southeast-1
Via AWS Console:
workshop-aws-dev# Should not see workshop VPC
aws ec2 describe-vpcs \
--filters "Name=tag:aws:cloudformation:stack-name,Values=workshop-aws-dev" \
--region ap-southeast-1
# Should not see workshop instances
aws ec2 describe-instances \
--filters "Name=tag:aws:cloudformation:stack-name,Values=workshop-aws-dev" \
--region ap-southeast-1 \
--query 'Reservations[*].Instances[*].[InstanceId,State.Name]'
# Should not see RDS instance (may have snapshot)
aws rds describe-db-instances \
--region ap-southeast-1 \
--query 'DBInstances[?DBInstanceIdentifier==`workshop-aws-dev-db`]'
# Buckets should be deleted
aws s3 ls | grep workshop-aws-dev
CloudFormation creates snapshot before deleting RDS. Delete if not needed:
# List snapshots
aws rds describe-db-snapshots \
--region ap-southeast-1 \
--query 'DBSnapshots[?contains(DBSnapshotIdentifier,`workshop-aws-dev`)].DBSnapshotIdentifier'
# Delete snapshot
aws rds delete-db-snapshot \
--db-snapshot-identifier <snapshot-id> \
--region ap-southeast-1
Log groups are not automatically deleted:
# List log groups
aws logs describe-log-groups \
--log-group-name-prefix "/aws/workshop-aws" \
--region ap-southeast-1
# Delete log groups
aws logs delete-log-group \
--log-group-name "/aws/workshop-aws/dev/application" \
--region ap-southeast-1
If key pair is no longer needed:
aws ec2 delete-key-pair \
--key-name workshop-aws-key \
--region ap-southeast-1
# Delete local .pem file
rm workshop-aws-key.pem
If stack deletion fails:
aws cloudformation describe-stack-events \
--stack-name workshop-aws-dev \
--region ap-southeast-1 \
--query 'StackEvents[?ResourceStatus==`DELETE_FAILED`].[LogicalResourceId,ResourceStatusReason]' \
--output table
Error: “S3 bucket is not empty”
Error: “Network interface is in use”
Error: “Resource being used by another resource”
# Retain problematic resources and delete stack
aws cloudformation delete-stack \
--stack-name workshop-aws-dev \
--region ap-southeast-1 \
--retain-resources <ResourceLogicalId>
# Then delete resources manually
Ensure all resources are deleted:
After 24-48 hours, check AWS Cost Explorer to ensure no charges from workshop.
You have successfully completed the workshop and cleaned up all resources!
What you learned: ✅ Deploy full-stack application on AWS ✅ Infrastructure as Code with CloudFormation ✅ AWS networking and security best practices ✅ Cost optimization strategies ✅ Monitoring and troubleshooting
Next resources:
Thank you for participating in this workshop! 🎉