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?
- 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
- BInitiate 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.
- CModify 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.
- DPerform 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
Anahtar Kavram
Remediating drift for deleted and recreated resources via stack import