An organization uses an AWS CloudFormation stack to manage its network infrastructure. A SysOps Administrator runs drift detection on the stack and identifies that a security group has a status of MODIFIED because a developer manually added an inbound rule allowing TCP port 3389. The administrator wants to resolve this drift so that the security group's actual configuration matches the expected configuration defined in the CloudFormation template.
Which action should the administrator take to remediate the drift?
- Manually delete the inbound rule allowing TCP port 3389 from the security group using the Amazon EC2 console or the AWS CLI.Answer
- BSelect the drifted security group in the AWS CloudFormation console and execute the automatic drift remediation action.
- CPerform a stack update using the original template and enable the Force Redeploy option to overwrite the drift.
- DRun the aws cloudformation sync-stack-drift CLI command to automatically import the drifted state into the template.
Answer
Manually delete the inbound rule allowing TCP port 3389 from the security group using the Amazon EC2 console or the AWS CLI.
To resolve drift and align the resource back to the template's expected state, the out-of-band changes must be manually reverted (e.g., deleting the manually added security group rule). CloudFormation does not provide an automated tool to revert drifted configurations back to their template-defined state.
Step-by-Step Solution
Key Concept
AWS CloudFormation Drift Remediation
Estimated Time:1m 30s