Interview Prep/AWS/CloudFormation, CloudWatch, KMS, Secrets and Cost

Updating a stack fails: `Stack:arn:aws:cloudformation:...:stack/app/... is in ROLLBACK_COMPLETE state and can not be updated.`

BeginnerTroubleshootingCloudFormation, CloudWatch, KMS, Secrets and Cost
Answer

Likely causes → The first create of the stack failed and rolled back. A stack in ROLLBACK_COMPLETE cannot be updated; it can only be deleted.

Diagnose →

aws cloudformation describe-stack-events --stack-name app \
  --query "StackEvents[?ResourceStatus=='CREATE_FAILED'].[LogicalResourceId,ResourceStatusReason]" --output table

Fix →

  1. Read the first CREATE_FAILED reason and fix the template
  2. Run aws cloudformation delete-stack --stack-name app && aws cloudformation wait stack-delete-complete --stack-name app
  3. Create the stack again

Prevent → Use --disable-rollback (or --on-failure DO_NOTHING) in dev to debug failed creates, and run cfn-lint in CI.

aws All AWS questions Roadmap: Cloud cost & architecture

More on CloudFormation, CloudWatch, KMS, Secrets and Cost