An enterprise is designing a cross-account data ingestion pipeline. Applications running on Amazon EC2 instances in Account A () must retrieve sensitive log files from an Amazon S3 bucket located in Account B (). The EC2 instances run inside an IAM instance profile associated with the IAM role `AppRole`. The S3 bucket in Account B is encrypted with a Customer Managed Key (CMK) in AWS KMS. The company's security policy requires that all cross-account access must utilize temporary credentials, enforce the principle of least privilege, and ensure all data remains encrypted.
Which configuration should the Solutions Architect implement to meet these requirements?
- ACreate a new IAM user in Account B with permissions to read from the S3 bucket and decrypt using the KMS key. Generate long-term access keys for this IAM user, and configure the application on the EC2 instances in Account A to use these credentials.
- BGenerate access keys for Account B's AWS account root user. Store these credentials in Systems Manager Parameter Store as a standard String parameter, and configure the applications on the EC2 instances in Account A to retrieve these credentials at runtime to perform S3 operations.
- Configure the S3 bucket policy in Account B to grant s3:GetObject permissions to the IAM role AppRole in Account A. Attach an IAM policy to AppRole in Account A that allows s3:GetObject on the Account B S3 bucket. Configure the KMS key policy in Account B to allow AppRole the kms:Decrypt action, and enable automatic annual key rotation on the KMS key.Answer
- DConfigure the EC2 instances' AppRole in Account A to assume a role in Account B. Enable KMS automatic key rotation in Account B, and perform a manual re-encryption of all historical log files in S3 because rotating the Customer Managed Key disables the ability to decrypt historical logs encrypted under the previous key version.
Answer
Configure the S3 bucket policy in Account B to grant s3:GetObject permissions to the IAM role AppRole in Account A, attach an IAM policy to AppRole in Account A allowing s3:GetObject, configure the KMS key policy in Account B to allow AppRole the kms:Decrypt action, and enable automatic annual key rotation on the KMS key.
The correct configuration establishes cross-account access using resource-based policies (S3 bucket policy and KMS key policy) to trust the IAM role AppRole in Account A. This allows the application running on the EC2 instances to directly access the bucket using temporary security credentials managed by the EC2 instance profile, conforming to security best practices. Enabling automatic KMS key rotation satisfies the encryption requirement without disrupting access to older objects.
Step-by-Step Solution
Key Concept
Cross-account resource access using resource-based policies (S3 and KMS) in combination with identity-based IAM policies, while adhering to temporary credential security policies and KMS rotation behaviors.
Estimated Time:2m 30s