A retail company manages its multi-account environment using AWS Organizations. The central DevOps account hosts a CI/CD pipeline using AWS CodePipeline to package applications and store the deployment artifacts in a central Amazon S3 bucket. The artifacts are encrypted using the default AWS-managed KMS key (aws/s3). An AWS CodeDeploy deployment group in a target production account retrieves these artifacts to update an Application Load Balancer-backed Auto Scaling group (ASG) of Amazon EC2 instances. Recently, deployments have been failing because target production accounts cannot decrypt and retrieve the deployment artifacts. Additionally, local engineers have manually modified target ASG configurations (such as desired capacity and launch templates), causing configuration drift from the source AWS CloudFormation templates. The company wants to automatically detect and remediate this drift while restoring the deployment pipeline functionality. Which combination of steps should a solutions architect implement to resolve the deployment failure and automate drift remediation?
- Configure the S3 bucket in the central DevOps account to use an AWS KMS Customer Managed Key (CMK). Update the CMK policy to grant the target production account's IAM execution role kms:Decrypt and kms:GenerateDataKey permissions, and grant read access via the S3 bucket policy. In the target account, use an AWS Config rule to monitor CloudFormation stack drift and configure an AWS Systems Manager Automation remediation action using the AWS-UpdateCloudFormationStack document to synchronize the resources with the template.Cevap
- BRetain the default AWS-managed KMS key (aws/s3) encryption on the central S3 bucket. Create and attach a Service Control Policy (SCP) at the root of the AWS Organization that grants the target production account's IAM execution role permission to perform kms:Decrypt on the default key and read the S3 bucket. In the target account, configure an AWS Config rule to detect drift and trigger an AWS Systems Manager State Manager association to directly run CLI scripts that reconfigure the ASG parameters.
- CConfigure the S3 bucket in the central DevOps account to use an AWS KMS Customer Managed Key (CMK). Update the CMK policy to grant the target production account's IAM execution role kms:Decrypt and kms:GenerateDataKey permissions. In the target account, configure an AWS Config rule to monitor stack drift, and configure a remediation action that triggers an AWS Lambda function to directly modify the ASG's launch template and desired capacity using the AWS CLI to match the expected values.
- DConfigure the S3 bucket in the central DevOps account to use an AWS KMS Customer Managed Key (CMK). Update the CMK policy to grant the target production account's IAM execution role kms:Decrypt and kms:GenerateDataKey permissions. In the target account, configure a CodeDeploy lifecycle hook to monitor ASG configuration compliance during deployments. If any configuration drift is detected, configure CodeDeploy to automatically trigger a linear rollback of the deployment without updating the underlying CloudFormation stack.