A telemetry collection system running on Amazon EC2 instances in Account A needs to publish environment alerts to an Amazon SNS topic in Account B. To meet internal security and compliance policies, the SNS topic must be encrypted at rest. The Solutions Architect needs to design a secure, least-privilege configuration to allow the instances in Account A to publish to the topic in Account B. Which configuration will allow the EC2 instances in Account A to publish to the SNS topic in Account B while maintaining encryption?
- Configure the SNS topic in Account B to use a Customer Managed Key (CMK). Update the KMS key policy in Account B to grant the EC2 instance profile role in Account A permissions for the kms:GenerateDataKey and kms:Decrypt actions. Update the SNS topic policy in Account B to allow the sns:Publish action for the EC2 instance profile role in Account A.Cevap
- BConfigure the SNS topic in Account B to use the default AWS-managed KMS key for Amazon SNS (aws/sns). Update the IAM policy of the EC2 instance profile role in Account A to allow the sns:Publish action on the topic and the kms:GenerateDataKey action on the aws/sns key.
- CConfigure the SNS topic in Account B to use a Customer Managed Key (CMK). Create a Service Control Policy (SCP) at the organizational unit (OU) level containing both accounts that allows the kms:GenerateDataKey and kms:Decrypt actions for Account A's root user principal, and rely on this SCP to delegate access without modifying the KMS key policy.
- DConfigure the EC2 instance profile in Account A to assume a cross-account IAM role in Account B to publish to the SNS topic. In Account B, configure the IAM role trust policy using sts:AssumeRoleWithWebIdentity but specify Account A's account root as the principal instead of an OIDC provider.
Cevap
Configure the SNS topic in Account B to use a Customer Managed Key (CMK), update the KMS key policy in Account B to grant the EC2 instance profile role in Account A permissions for the kms:GenerateDataKey and kms:Decrypt actions, and update the SNS topic policy in Account B to allow the sns:Publish action for the EC2 instance profile role in Account A.
The correct configuration uses a Customer Managed Key (CMK) in the target account (Account B) and updates its key policy to allow the publishing role in Account A to perform kms:GenerateDataKey and kms:Decrypt. Combined with updating the SNS topic policy to permit sns:Publish from the Account A role, this satisfies least-privilege and security requirements.
Adım Adım Çözüm
Anahtar Kavram
Cross-account encryption permissions using KMS Customer Managed Keys