Clean Up Resource
5.6 Clean Up Resource
Use this section to remove workshop resources and avoid unnecessary AWS cost.
1. Recommended order
- Stop active app usage and traffic tests.
- Delete stack resources with CDK destroy.
- Clean failed rollback stacks with AWS CLI if needed.
- Remove retained resources manually (for example S3 buckets, snapshots).
- Verify no workshop resources remain.
If a previous deployment failed and stack is stuck in rollback:
aws cloudformation list-stacks \
--stack-status-filter ROLLBACK_COMPLETE ROLLBACK_FAILED DELETE_FAILED \
--query "StackSummaries[?contains(StackName, 'MyfitInfraStack')].[StackName,StackStatus]" \
--output table
aws cloudformation delete-stack --stack-name MyfitInfraStack --region us-east-1
aws cloudformation wait stack-delete-complete --stack-name MyfitInfraStack --region us-east-1
3. Destroy stack with CDK
From myfit-infra root folder:
npx cdk destroy MyfitInfraStack --region us-east-1 --force
4. Manual cleanup checks
- CloudFormation: no stack in failed or active state.
- ECS: no running services/tasks for workshop stack.
- ALB/Target Group: removed.
- RDS: instance and snapshots cleaned according to your retention policy.
- CloudFront: distribution removed or disabled if no longer used.
- Route 53: remove workshop alias records if no longer needed.
- S3: empty and delete retained buckets if they are workshop-only.
- Secrets Manager: remove temporary secrets that are no longer needed.
- CloudWatch Logs: delete workshop log groups if not needed.
5. Final verification checklist
- No active compute resources from workshop stack.
- No active load balancer or ECS service from workshop stack.
- No orphan DNS records pointing to deleted resources.
- Billing dashboard shows no unexpected ongoing charges from this workshop.