What's Actually Happening
AWS CDK deployment fails. Stack cannot be created or updated, blocking infrastructure changes.
The Error You'll See
```bash $ cdk deploy
MyStack: 12:15:30 PM - CREATE_FAILED Template format error: Resource name is invalid ```
Why This Happens
- 1.Stack configuration error
- 2.Resource quota exceeded
- 3.IAM permission denied
- 4.Resource already exists
- 5.Circular dependency
Step 1: Check CloudFormation Events
aws cloudformation describe-stack-events --stack-name my-stack
aws cloudformation describe-stack-resources --stack-name my-stackStep 2: Check CDK Synth
cdk synth
cat cdk.out/MyStack.template.jsonStep 3: Check Stack Status
aws cloudformation describe-stacks --stack-name my-stack
cdk lsStep 4: Check IAM Permissions
aws iam get-user
aws sts get-caller-identity
# Ensure user has required permissionsStep 5: Check Service Quotas
aws service-quotas get-service-quota --service-code ec2 --quota-code L-12345Step 6: Review Stack Outputs
cdk diff
aws cloudformation get-template --stack-name my-stackStep 7: Check Bootstrap
cdk bootstrap
cdk bootstrap aws://account-id/regionStep 8: Rollback Failed Stack
aws cloudformation rollback-stack --stack-name my-stack
cdk destroy my-stackStep 9: Enable Termination Protection
aws cloudformation update-termination-protection --stack-name my-stack --enable-termination-protectionStep 10: Monitor Deployment
watch -n 10 'aws cloudformation describe-stacks --stack-name my-stack --query "Stacks[0].StackStatus"'Related Issues
- [Fix CloudFormation Stack Failed](/articles/fix-cloudformation-stack-failed)
- [Fix Terraform State Locked](/articles/fix-terraform-state-locked)