An enterprise uses AWS CloudFormation StackSets with service-managed permissions to deploy a standardized security baseline—consisting of IAM roles, AWS Config rules, and Amazon VPC security groups—across all member accounts within an AWS Organization. The templates are stored in a centralized Amazon S3 bucket in a dedicated administration account. Over time, developers in member accounts have manually modified security groups and IAM roles, introducing configuration drift. The Solutions Architect must establish a fully automated solution to detect stack drift across all accounts and remediate the drifted resources to align with the StackSet template. The remediation must not disrupt the stack management lifecycle or cause subsequent stack updates to fail. Which combination of actions will meet these requirements while adhering to the principle of least privilege?
- Enable CloudFormation StackSets drift detection on a scheduled basis. Create an Amazon EventBridge rule in the administration account that filters for the CloudFormation StackSet Drift Detection Status Change event indicating a drifted state. Configure the rule to target an AWS Lambda function that initiates a StackSet update targeting the specific drifted accounts and regions using the baseline template. Encrypt the centralized S3 bucket using a Customer Managed Key (CMK) and update the KMS key policy to grant the cross-account AWSCloudFormationStackSetExecutionRole permissions to decrypt the template.Cevap
- BEnable CloudFormation StackSets drift detection on a scheduled basis. Create an Amazon EventBridge rule in the administration account that filters for CloudFormation StackSet Drift Detection Status Change events. Set the target to an AWS Lambda function that initiates a StackSet update using the baseline template to remediate drift. Encrypt the centralized S3 bucket using the default AWS managed key for S3 (aws/s3) and update the key policy to grant the cross-account AWSCloudFormationStackSetExecutionRole permissions to decrypt the template.
- CConfigure an AWS Config rule in each member account to detect configuration changes. When a drifted resource is identified, trigger an AWS Systems Manager Automation runbook that assumes a local administrator role, deletes the drifted IAM roles and security groups, and recreates them using AWS CLI commands to match the baseline. Encrypt the centralized S3 bucket using a Customer Managed Key (CMK) and grant the Systems Manager execution role cross-account decrypt permissions.
- DApply a Service Control Policy (SCP) to the organization root that denies cloudformation:UpdateStack and cloudformation:DeleteStack actions to all users except the StackSets execution role to prevent manual drift. Set up an AWS Config rule to monitor the resources and trigger an AWS Systems Manager Automation runbook in the management account that uses the admin role to run DetectStackDrift and automatically apply the baseline template. Encrypt the S3 bucket using a Customer Managed Key (CMK) with cross-account access.