A company runs a critical business application on a fleet of Amazon EC2 instances. The infrastructure is deployed and managed using AWS CloudFormation. The internal operating system configurations and application settings on these instances must strictly align with a configuration definition defined in an Ansible playbook. Recently, system administrators have performed manual updates to the configuration files on individual instances via SSH to troubleshoot issues, resulting in configuration drift that has caused application instability. A solutions architect needs to design a solution that will automatically detect these manual operating system-level changes and restore the instances to the desired state with minimal service disruption and operational overhead. Which solution should the solutions architect implement?
- AEnable drift detection on the AWS CloudFormation stack. Configure an Amazon EventBridge rule that triggers whenever the stack status changes to DRIFTED. Program the rule to invoke an AWS Lambda function that terminates the drifted EC2 instances, allowing the Auto Scaling group to launch new instances with the initial bootstrap configuration.
- BDeploy an AWS Config rule to monitor the configuration of the EC2 instances. When a configuration change is detected, trigger an AWS Systems Manager Automation document to download the Ansible playbook from a centralized DevOps account S3 bucket using the AWS-managed KMS key aws/ssm to decrypt the playbook.
- Configure AWS Systems Manager State Manager by creating an association that targets the EC2 instances. Specify the AWS-ApplyAnsiblePlaybooks document and point it to the Ansible playbook stored in an Amazon S3 bucket. Configure the association to run on a regular schedule to automatically reapply the playbook and correct any operating system-level configuration drift.Cevap
- DCreate a Service Control Policy (SCP) at the AWS Organizations level that denies access to modify files within the /etc directory on the EC2 instances. Use AWS Systems Manager Patch Manager to schedule daily runs that apply the Ansible playbook to verify instance compliance.