A developer uses AWS CloudFormation to manage an application's infrastructure. An administrator manually modified the inbound rules of a security group associated with an Amazon EC2 instance using the AWS Management Console to resolve a temporary connection issue. The developer runs a drift detection status check on the stack, and the security group is flagged as DRIFTED. Which action should the developer take to resolve the drift and ensure the resource configuration is correctly aligned with the CloudFormation template?
- Revert the manual changes in the security group directly via the Amazon EC2 console to match the template, or update the template to include the modified rules and run a stack update.Cevap
- BExecute the aws cloudformation update-stack command with the --resolve-drift parameter to automatically sync the live configuration back to the template's specification.
- CDelete the drifted security group resource from the AWS Management Console, and trigger a stack update with rollback disabled to force CloudFormation to recreate it.
- DCreate a new AWS Secrets Manager secret containing the updated security group rules, and reference the secret using a dynamic reference in the CloudFormation template.
Cevap
Revert the manual changes in the security group directly via the Amazon EC2 console to match the template, or update the template to include the modified rules and run a stack update.
To resolve drift on a resource managed by CloudFormation, you must either revert the manual out-of-band changes directly in the resource's service console (or via CLI) so it matches the template configuration, or update the CloudFormation template to match the drifted state and perform a stack update to sync the stack status.
Adım Adım Çözüm
Anahtar Kavram
CloudFormation Drift Detection and Resolution