An application running on Amazon EC2 instances in a private subnet needs to retrieve database credentials stored as a SecureString parameter in AWS Systems Manager Parameter Store. The parameter is encrypted with an AWS KMS customer managed key (CMK). The SysOps administrator has attached an IAM policy to the EC2 instance profile's IAM role that allows both ssm:GetParameter and kms:Decrypt on the respective resource ARNs. However, when the application runs, it fails to retrieve the parameter and receives an AccessDeniedException from AWS KMS. Which action will resolve this issue?
- AAdd the iam:PassRole permission to the EC2 instance profile's IAM role, specifying the AWS KMS key ARN as the resource.
- Update the KMS key policy of the customer managed key to allow the EC2 instance profile's IAM role to perform the kms:Decrypt action.Cevap
- CConfigure a gateway VPC endpoint for AWS KMS and associate it with the route table of the private subnet.
- DChange the parameter tier from Standard to Advanced to enable cross-service AWS KMS decryption delegation.
Cevap
Update the KMS key policy of the customer managed key to allow the EC2 instance profile's IAM role to perform the kms:Decrypt action.
The correct action is to update the key policy of the KMS customer managed key (CMK). Unlike AWS managed keys (where permissions are managed automatically), customer managed keys require their key policy to explicitly authorize the caller or authorize the account to use IAM policies for permission delegation. Without this authorization in the key policy, the EC2 instance's IAM role will receive an AccessDeniedException despite having the correct IAM policy.
Adım Adım Çözüm
Anahtar Kavram
KMS Key Policy Precedence
Tahmini Süre:1m 30s