An enterprise uses AWS CloudFormation StackSets to deploy a baseline security configuration—consisting of an Amazon S3 bucket for security logging and AWS Systems Manager State Manager associations to enforce security agent installation on EC2 instances—across all member accounts in an AWS Organization. The baseline StackSet is deployed from a delegated administrator DevOps account. The S3 logging bucket in each member account must be encrypted using a Customer Managed Key (CMK) managed by the central security team in a dedicated Security account.
During an audit, the security team identifies that some member accounts have configuration drift: local administrators have detached the State Manager associations or manually altered the S3 bucket policies to allow external access, which went undetected. Additionally, recent deployments of the baseline StackSet to new member accounts are failing during the S3 bucket creation step with an Access Denied error.
Which two actions should a Solutions Architect take to resolve the deployment failure and automatically detect and remediate the configuration drift? (Select TWO.)
- In the central Security account, update the key policy of the Customer Managed Key to grant the member accounts' StackSet execution roles (AWSCloudFormationStackSetExecutionRole) permissions for kms:DescribeKey, kms:GenerateDataKey*, and kms:Decrypt operations. In the member accounts, ensure the StackSet execution role has IAM permissions to access the Security account's KMS key ARN.Answer
- BIn the central Security account, update the key policy of the default AWS-managed KMS key for Amazon S3 (aws/s3) to grant access to the member accounts' StackSet execution roles, and use AWS Resource Access Manager (RAM) to share the key with the Organization's member accounts.
- Enable drift detection on the CloudFormation StackSet. Create an Amazon EventBridge rule in the delegated administrator DevOps account that triggers when a StackSet drift status changes to DRIFTED, and invokes an AWS Systems Manager Automation workflow to execute the UpdateStackInstances API targeting the drifted account and region to redeploy the baseline template.Answer
- DConfigure a Service Control Policy (SCP) at the Organization root that denies s3:PutBucketPolicy, s3:DeleteBucketPolicy, and ssm:DeleteAssociation for all IAM principals except the AWSCloudFormationStackSetExecutionRole role. Rely on CloudFormation's automatic baseline synchronization feature to overwrite any local changes.
- EEnable CloudFormation drift detection in each member account. Configure AWS Config to trigger a custom remediation action that deletes the drifted S3 buckets and SSM associations, then runs a local script to re-execute the local CloudFormation stack creation using the default AWS-managed KMS key.
- FCreate a daily AWS Systems Manager State Manager association in the delegated administrator DevOps account. Configure the association to run the AWS-UpdateCloudFormationStack Automation document across all instances in the organization to check for and remediate StackSet drift.