Question

Difficulty: EasyTroubleshooting CloudFormation and CI/CD Deployments

A developer is attempting to deploy a new application stack using AWS CloudFormation for the first time. The stack creation fails during the creation of an Amazon S3 bucket due to a naming conflict, and the stack status changes to ROLLBACK_COMPLETE. Which two actions should the developer take to successfully deploy the stack with the corrected S3 bucket name?

  1. Delete the CloudFormation stack that is in the ROLLBACK_COMPLETE state.Answer
  2. Update the bucket name in the CloudFormation template to a unique value and create a new stack.Answer
  3. C
    Perform a stack update directly on the existing ROLLBACK_COMPLETE stack using the corrected template.
  4. D
    Modify the trust policy of the CloudFormation service role to allow the s3:CreateBucket action.
  5. E
    Run drift detection on the ROLLBACK_COMPLETE stack to import the conflicting bucket name.

Answer

To resolve the issue, delete the failed stack in the ROLLBACK_COMPLETE state, update the bucket name in the CloudFormation template to a globally unique value, and create a new stack.
When a CloudFormation stack fails initial creation and enters the ROLLBACK_COMPLETE status, it cannot be updated. The developer must delete the failed stack. To resolve the root cause, which is a naming conflict for the S3 bucket (S3 requires globally unique bucket names across all AWS accounts), the developer must modify the bucket name in the template to be unique and create a new stack.

Step-by-Step Solution

1
Check the CloudFormation console stack events to confirm the resource failure reason.
The events show that the S3 bucket creation failed because the bucket name is already occupied globally.
This identifies the root cause of the stack creation failure.
2
Delete the failed stack which is in the ROLLBACK_COMPLETE status.
The stack resources are cleaned up and the stack is removed.
AWS CloudFormation does not allow stack updates on stacks that failed during their initial creation.
3
Change the bucket name in the CloudFormation template to a unique string and create a new stack.
The template is successfully validated and the new stack is created without errors.
S3 buckets require globally unique names, and a new stack must be initiated since the previous one was deleted.

Key Concept

CloudFormation initial stack creation failure recovery and S3 naming requirements.
Estimated Time:1m 0s
Rate this question