Soru

Zorluk: OrtaAWS CloudFormation

A developer deployed an Amazon EC2 instance and an associated security group using an AWS CloudFormation stack. During a troubleshooting session, the developer manually added a new ingress rule to the security group using the AWS Management Console. The developer now wants to synchronize the CloudFormation stack with these changes to ensure future stack updates do not overwrite or fail due to this modification. Which action should the developer take to resolve this discrepancy?

  1. Run drift detection on the stack to identify the modifications, update the CloudFormation template to include the new ingress rule, and then perform a stack update.Cevap
  2. B
    Perform a stack update using the original template, expecting AWS CloudFormation to automatically detect the manual configuration and merge it into the stack state.
  3. C
    Store the modified security group rules in AWS Systems Manager Parameter Store, and reference them via a dynamic reference in the template to bypass future drift detection.
  4. D
    Trigger a stack rollback operation to force the CloudFormation stack to import the manual out-of-band changes into its current state.

Cevap

Run drift detection on the stack to identify the modifications, update the CloudFormation template to include the new ingress rule, and then perform a stack update.
The correct action is to first identify the drift using the drift detection feature of CloudFormation. Once the drift details are known, the developer must update the template to include the manual modifications and run a stack update. This synchronizes the template definition with the actual resource state without interrupting the service or overwriting the rule.

Adım Adım Çözüm

1
Detect drift
Detailed drift status showing that the security group resource has drifted from its template definition due to the manually added ingress rule.
Before making changes, the exact differences between the template and the live resources must be identified.
2
Modify template
The CloudFormation template now contains the new ingress rule in the security group resource definition.
To resolve drift, the template must be updated to align with the desired live state of the resources.
3
Perform stack update
The stack state is updated, and the resource is marked as in-sync.
Running the stack update applying the updated template reconciles the template state with the physical resource state.

Anahtar Kavram

CloudFormation Drift Detection and Reconciliation
Tahmini Süre:1m 30s
Bu soruyu puanla