Soru

Zorluk: KolayAWS CloudFormation

A developer attempts to create a new AWS CloudFormation stack to deploy a web application. The stack creation fails because of an invalid AMI ID parameter, and the stack enters the ROLLBACK_COMPLETE status. The developer updates the template with the correct AMI ID.

Which action should the developer take to deploy the resources successfully?

  1. Delete the stack in the ROLLBACK_COMPLETE status, and then create a new stack using the updated template.Cevap
  2. B
    Update the existing stack directly in the ROLLBACK_COMPLETE status by uploading the updated template.
  3. C
    Manually launch the EC2 instance with the correct AMI ID in the Amazon EC2 Console, and then perform a drift detection sync on the stack.
  4. D
    Use AWS Secrets Manager to store the correct AMI ID and force a dynamic reference update on the existing stack.

Cevap

Delete the stack in the ROLLBACK_COMPLETE status, and then create a new stack using the updated template.
When a CloudFormation stack fails to create on its very first attempt, it rolls back all created resources and enters the ROLLBACK_COMPLETE status. Stacks in the ROLLBACK_COMPLETE status cannot be updated; they must be deleted before a new stack can be created with the same name and the corrected template.

Adım Adım Çözüm

1
Identify the stack's current state and origin of failure.
The stack failed during initial creation and rolled back successfully to the ROLLBACK_COMPLETE state.
Before deciding on a recovery action, the developer must determine if the stack was previously successful or if it failed on its first creation attempt.
2
Evaluate the update capability of the stack in the current state.
AWS CloudFormation does not allow update operations on stacks that fail initial creation (ROLLBACK_COMPLETE). Updates are only allowed on successfully created stacks or stacks that fail during a subsequent update (UPDATE_ROLLBACK_COMPLETE).
This determines whether the existing stack can be updated or must be recreated.
3
Perform stack cleanup and recreation.
Delete the failed stack and create a new one using the corrected template.
This removes the failed stack metadata from the account and allows the deployment to start fresh with the corrected parameters.

Anahtar Kavram

CloudFormation Stack Lifecycle and Rollback States
Bu soruyu puanla