Soru

Zorluk: ZorAWS CloudFormation Stack and Drift Management

An operations team manages an application's infrastructure using an AWS CloudFormation stack. During an unannounced maintenance window, an Amazon RDS DB instance managed by the stack was accidentally deleted and manually recreated with a new physical ID. The stack now shows a drift status of DELETED for the database resource. The team wants to associate the newly recreated DB instance with the existing CloudFormation stack without causing downtime or modifying the configuration of the active database.

Which of the following procedures should a SysOps administrator perform to achieve this goal?

  1. Remove the database resource definition from the CloudFormation template, update the stack, add the database resource definition back to the template, and then create and execute an import change set using the new database instance's physical ID.Cevap
  2. B
    Initiate a stack update using the original template, but pass the new physical ID of the DB instance as a metadata property to force CloudFormation to bind to the new resource.
  3. C
    Modify the stack's service role to grant iam:PassRole permissions for the new DB instance, then execute a stack update using the CLI with the --resolve-drift flag.
  4. D
    Perform an in-place stack rollback using the aws cloudformation rollback-stack command and specify the new database instance's resource ARN to bypass the deletion check.

Cevap

Remove the database resource definition from the CloudFormation template, update the stack, add the database resource definition back to the template, and then create and execute an import change set using the new database instance's physical ID.
To import an out-of-band recreated resource into an existing stack, the resource must first be removed from the stack's state by modifying the template and updating the stack. After the resource is removed from the stack state, it can be added back to the template and imported into the stack using its new physical ID with an import change set.

Adım Adım Çözüm

1
Remove the database resource definition from the CloudFormation template.
The template is prepared without the RDS resource definition.
This is necessary to clean up the stack state in the next step before importing the new resource.
2
Execute a stack update using the modified template.
The stack state is updated and the deleted database resource is removed from CloudFormation management.
Because the resource is already deleted out-of-band, the deletion action completes successfully in the stack state.
3
Add the database resource definition back into the template.
The template configuration matches the desired state of the new RDS database instance.
The resource must be defined in the template so that CloudFormation knows what configuration to import.
4
Create and execute an import change set, providing the new physical ID of the manually recreated RDS DB instance.
The new resource is successfully imported and bound to the stack logical resource without recreation.
The import process associates the logical resource in the template with the new physical resource.

Anahtar Kavram

Remediating drift for deleted and recreated resources via stack import
Bu soruyu puanla