When stack creation fails:
- Automatic Rollback: CloudFormation automatically deletes all successfully created resources
- Stack State: Stack goes to
ROLLBACK_COMPLETE
state
- Error Information: Detailed error messages available in Events tab
- Billing: You're only charged for resources that existed during the failed creation period
Prevention strategies:
- Validate templates before deployment
- Use
--disable-rollback
flag only for debugging
- Implement proper IAM permissions
- Check service limits and quotas
- Use change sets for updates
Example debugging:
aws cloudformation describe-stack-events --stack-name my-stack