A retail company, OmniStore, is setting up a centralized auditing pipeline. AWS CloudTrail logs from the main production account (Account A) must be delivered to a centralized Amazon S3 bucket located in the security operations account (Account B). The S3 bucket is encrypted using an AWS KMS Customer Managed Key (CMK) managed in Account B. The security architect must configure the access policies to allow CloudTrail to write the log files to Account B while enforcing least-privilege access. Which configuration strategy will allow CloudTrail to successfully deliver the logs to the encrypted S3 bucket in Account B?
- Configure the S3 bucket policy in Account B to allow the CloudTrail service principal (cloudtrail.amazonaws.com) to perform the s3:PutObject and s3:GetBucketAcl actions. Configure the key policy of the CMK in Account B to allow the CloudTrail service principal to perform the kms:GenerateDataKey action, using policy conditions to restrict access to the ARN of the CloudTrail in Account A.Answer
- BConfigure the S3 bucket in Account B to use the default AWS-managed KMS key (aws/s3) for encryption. Configure the S3 bucket policy in Account B to allow the CloudTrail service principal (cloudtrail.amazonaws.com) to perform the s3:PutObject action.
- CAttach a Service Control Policy (SCP) to the organizational unit containing Account A that allows the kms:GenerateDataKey and s3:PutObject actions for the CloudTrail service principal. Omit updates to the KMS key policy and S3 bucket policy in Account B.
- DConfigure the S3 bucket policy in Account B to allow the AWS account ID of Account A as the Principal for the s3:PutObject action, omitting the CloudTrail service principal (cloudtrail.amazonaws.com), and rely on Account A's local IAM policies to delegate write permissions to CloudTrail.
Answer
Configure the S3 bucket policy in Account B to allow the CloudTrail service principal (cloudtrail.amazonaws.com) to perform the s3:PutObject and s3:GetBucketAcl actions. Configure the key policy of the CMK in Account B to allow the CloudTrail service principal to perform the kms:GenerateDataKey action, using policy conditions to restrict access to the ARN of the CloudTrail in Account A.
The correct configuration requires granting permissions directly to the CloudTrail service principal (cloudtrail.amazonaws.com) in both the S3 bucket policy and the KMS key policy in Account B. Because this is a cross-account scenario, the S3 bucket policy must allow the service principal to write objects (s3:PutObject) and read bucket ACLs (s3:GetBucketAcl), and the Customer Managed Key (CMK) policy must grant the service principal permission to generate data keys (kms:GenerateDataKey) to encrypt the logs. Adding conditions ensures only logs from the specific production CloudTrail are accepted.
Step-by-Step Solution
Key Concept
Cross-account AWS CloudTrail log delivery using KMS Customer Managed Keys (CMKs)