A multinational retail company uses a centralized CI/CD pipeline in a Tooling AWS account to deploy and update infrastructure across multiple target accounts in an AWS Organization. The pipeline uses AWS CloudFormation StackSets to deploy standard Amazon EC2 instances and associated security groups. Recently, developers in target accounts have manually modified security group ingress rules to troubleshoot connectivity issues. These manual changes have created security vulnerabilities and caused subsequent CI/CD pipeline updates to fail due to undetected configuration drift. The company needs a solution that prevents manual modifications to resources managed by CloudFormation, ensures that deployment templates are securely shared and accessible cross-account, and automatically alerts the DevOps team if drift is detected. Which solution should the solutions architect implement to meet these requirements?
- Store the CloudFormation templates in an S3 bucket in the Tooling account encrypted with a Customer Managed Key (CMK). Configure the CMK key policy and S3 bucket policy to allow read access from the target accounts. Implement a Service Control Policy (SCP) that denies all IAM users and roles in target accounts from modifying resources containing the tag 'aws:cloudformation:stack-name', unless the caller is the CloudFormation service role or the CI/CD pipeline role. Configure AWS Config in the target accounts to run the 'cloudformation-stack-drift-detection-check' rule and send alerts via Amazon SNS.Cevap
- BStore the CloudFormation templates in an S3 bucket in the Tooling account encrypted with the default AWS-managed KMS key ('aws/s3'). Configure the S3 bucket policy and the target accounts' IAM policies to allow cross-account access to read the templates. Configure AWS Config in the target accounts to monitor security groups and automatically delete any drifted resources to force them back to the template state.
- CStore the CloudFormation templates in an S3 bucket in the Tooling account encrypted with a Customer Managed Key (CMK). Attach a Service Control Policy (SCP) to the target OUs that explicitly grants read and write permissions to the CI/CD pipeline role and denies modification of security groups for all other roles. Rely on this SCP to grant the necessary deployment permissions in the target accounts without configuring local IAM policies.
- DStore the CloudFormation templates in an S3 bucket in the Tooling account. Allow developers to modify security groups manually. Configure AWS Config rules in target accounts to detect drift. When drift is detected, trigger an AWS Systems Manager State Manager association to run a script that uses the AWS CLI to force the CloudFormation stack status to 'UPDATE_COMPLETE' in the target account, and then manually run 'aws ec2 authorize-security-group-ingress' to align the configuration.