When you complete the workshop and no longer want to continue using it, delete all resources to avoid incurring charges.
⚠️ Warning: This process cannot be undone. All data will be permanently deleted.
Must delete in reverse order of deployment:
1. Amplify App (Frontend)
2. Observability Stack
3. Backend Stack
4. Auth Stack
5. Core Stack
6. Certificate Stack
7. DNS Stack
8. CDK Bootstrap (optional)
1. Delete via Console
2. Delete via CLI
# Get app ID
APP_ID=$(aws amplify list-apps \
--query 'apps[?name==`everyonecook-frontend`].appId' \
--output text)
# Delete app
aws amplify delete-app --app-id $APP_ID
S3 buckets must be emptied before deletion:
# List all EveryoneCook buckets
aws s3 ls | grep everyonecook
# Empty each bucket (4 buckets)
aws s3 rm s3://everyonecook-content-dev-xxxxx --recursive
aws s3 rm s3://everyonecook-logs-dev-xxxxx --recursive
aws s3 rm s3://everyonecook-emails-dev-xxxxx --recursive
aws s3 rm s3://everyonecook-cdn-logs-dev-xxxxx --recursive
# Or use PowerShell script
$buckets = aws s3 ls | Select-String "everyonecook" | ForEach-Object { $_.ToString().Split()[-1] }
foreach ($bucket in $buckets) {
Write-Host "Emptying bucket: $bucket"
aws s3 rm "s3://$bucket" --recursive
}
1. Delete Observability Stack
cd infrastructure
# Delete Observability stack
npx cdk destroy EveryoneCook-dev-Observability --context environment=dev
# Type 'y' to confirm
2. Delete Backend Stack
# Delete Backend stack
npx cdk destroy EveryoneCook-dev-Backend --context environment=dev
# Type 'y' to confirm
3. Delete Auth Stack
# Delete Auth stack
npx cdk destroy EveryoneCook-dev-Auth --context environment=dev
# Type 'y' to confirm
4. Delete Core Stack
# Delete Core stack (takes 15-20 minutes due to CloudFront)
npx cdk destroy EveryoneCook-dev-Core --context environment=dev
# Type 'y' to confirm
5. Delete Certificate Stack
# Delete Certificate stack
npx cdk destroy EveryoneCook-dev-Certificate --context environment=dev
# Type 'y' to confirm
6. Delete DNS Stack (Optional)
# Delete DNS stack (only if you don't need the domain)
npx cdk destroy EveryoneCook-dev-DNS --context environment=dev
# Type 'y' to confirm
# List remaining stacks
aws cloudformation list-stacks \
--stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE \
--query 'StackSummaries[?contains(StackName, `EveryoneCook-dev`)].StackName'
# Should return empty array
⚠️ Only do this if you’re done with CDK completely:
# Delete CDK bootstrap stack
aws cloudformation delete-stack --stack-name CDKToolkit
# Empty and delete CDK assets bucket
BUCKET_NAME=$(aws s3 ls | grep cdk | awk '{print $3}')
aws s3 rm s3://$BUCKET_NAME --recursive
aws s3 rb s3://$BUCKET_NAME
1. Archive Repository
2. Delete Repository
1. Check CloudFormation
aws cloudformation list-stacks \
--stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE \
| grep EveryoneCook
# Should return nothing
2. Check S3
aws s3 ls | grep everyonecook
# Should return nothing
3. Check Lambda
aws lambda list-functions | grep EveryoneCook
# Should return nothing
4. Check DynamoDB
aws dynamodb list-tables | grep EveryoneCook
# Should return nothing
5. Check API Gateway
aws apigateway get-rest-apis | grep EveryoneCook
# Should return nothing
6. Check Cognito
aws cognito-idp list-user-pools --max-results 10 | grep EveryoneCook
# Should return nothing
7. Check CloudFront
aws cloudfront list-distributions | grep EveryoneCook
# Should return nothing
8. Check OpenSearch
aws opensearch list-domain-names | grep everyonecook
# Should return nothing
9. Check Amplify
aws amplify list-apps | grep everyonecook
# Should return nothing
Immediate:
After 30 days:
Issue: S3 bucket deletion fails
# Force empty and delete
aws s3 rb s3://bucket-name --force
Issue: CloudFormation stack stuck
# Check stack events
aws cloudformation describe-stack-events \
--stack-name EveryoneCook-dev-Core \
--max-items 20
# If stuck, skip failed resources
aws cloudformation delete-stack \
--stack-name EveryoneCook-dev-Core \
--retain-resources ResourceLogicalId
Issue: CloudFront distribution can’t be deleted
# Disable distribution first
DIST_ID=$(aws cloudfront list-distributions \
--query "DistributionList.Items[?Comment=='EveryoneCook-dev'].Id" \
--output text)
# Get ETag
ETAG=$(aws cloudfront get-distribution --id $DIST_ID \
--query "ETag" --output text)
# Disable distribution
aws cloudfront update-distribution \
--id $DIST_ID \
--if-match $ETAG \
--distribution-config file://disabled-config.json
# Wait 15-20 minutes, then delete
aws cloudfront delete-distribution --id $DIST_ID --if-match $ETAG
Issue: DynamoDB table has deletion protection
# Disable deletion protection
aws dynamodb update-table \
--table-name EveryoneCook-dev \
--no-deletion-protection-enabled
# Then delete stack
# Check AWS billing
aws ce get-cost-and-usage \
--time-period Start=2024-01-01,End=2024-01-31 \
--granularity MONTHLY \
--metrics BlendedCost
# Should show decreasing costs
You have completed the EveryoneCook workshop! You have learned:
Infrastructure as Code with AWS CDK
Serverless Architecture with Lambda and API Gateway
DynamoDB Single Table Design with username-based PK
OpenSearch with Vietnamese analyzer
CloudFront CDN with Origin Access Control
Cognito Authentication with Lambda triggers
Bedrock AI integration
GitLab version control and CI/CD
AWS Amplify frontend deployment
CloudWatch monitoring and X-Ray tracing
Total deployed:
Thank you for completing the workshop! 🎉