A retail company uses AWS Systems Manager State Manager to continuously apply and enforce software configuration templates on a fleet of Amazon EC2 instances deployed across multiple member accounts in an AWS Organization. Some of these configuration templates contain database connection strings that must be decrypted locally using an AWS Key Management Service (KMS) key hosted in a centralized security account. The Operations team discovers that local administrators in some member accounts have manually modified the configuration files directly on the EC2 instances, introducing operational drift. Which of the following is the most secure and operationally efficient solution to automatically remediate this drift while allowing the instances to decrypt the connection strings?
- AConfigure the State Manager association to execute periodically on a schedule to re-apply the configuration document. Encrypt the credentials using the default AWS-managed KMS key for Systems Manager (aws/ssm), and attach an IAM policy to the EC2 instance profile roles in the member accounts allowing cross-account decryption.
- BImplement an AWS Config rule to monitor the configuration files on the EC2 instances. When configuration drift is detected, configure an AWS Config remediation action to trigger an AWS Lambda function that uses SSH to connect to the EC2 instances and restore the configuration files from an Amazon S3 bucket.
- Configure the State Manager association to execute periodically on a schedule to re-apply the configuration document. Encrypt the credentials using a Customer Managed Key (CMK) in the central security account, updating the key policy to delegate decrypt permissions to the member accounts' IAM roles, and grant the corresponding decryption permissions in the local IAM policies.Answer
- DConfigure the State Manager association to execute periodically on a schedule to re-apply the configuration document. Attach a Service Control Policy (SCP) at the root of the AWS Organization that explicitly grants kms:Decrypt permissions for the KMS key to the EC2 instance profile roles in all member accounts.