A SysOps Administrator is configuring an Amazon SQS queue in AWS account `111122223333` to use server-side encryption with a customer managed KMS key. An application running on an Amazon EC2 instance in the same account must send messages to the queue. The administrator has attached an IAM policy to the EC2 instance profile's IAM role that grants `sqs:SendMessage`, `kms:GenerateDataKey`, and `kms:Decrypt` permissions. However, the application logs show an Access Denied error when attempting to send messages to the queue.
The customer managed KMS key's key policy is configured as follows:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Allow Key Administration",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:user/SecurityAdmin"
},
"Action": "kms:*",
"Resource": "*"
}
]
}
Which modification must the administrator make to resolve this access issue?
- AModify the resource element of the IAM policy attached to the EC2 instance profile's IAM role from the KMS key ARN to a wildcard (`*`) to bypass the key policy restrictions.
- Add a statement to the KMS key policy that grants the AWS account root principal (`arn:aws:iam::111122223333:root`) access to the key, thereby enabling the IAM policy attached to the EC2 instance profile's role to take effect.Cevap
- CUpdate the SQS queue policy to grant the necessary `kms:GenerateDataKey` and `kms:Decrypt` permissions to the EC2 instance profile's IAM role.
- DAttach a resource-based policy to the EC2 instance that explicitly allows the instance profile's IAM role to perform the required KMS actions.