A SysOps Administrator is configuring an AWS CodeBuild project to decrypt sensitive environment variables retrieved from AWS Systems Manager Parameter Store. The parameters are encrypted with a customer managed KMS key in AWS Account `111122223333`. The administrator has already added `kms:Decrypt` and `kms:DescribeKey` permissions to the CodeBuild service role's IAM policy.
The customer managed KMS key has the following key policy:
{
"Version": "2012-10-17",
"Id": "key-policy-1",
"Statement": [
{
"Sid": "Allow direct access to key administrators",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:role/KMSAdminRole"
},
"Action": [
"kms:Create*",
"kms:Describe*",
"kms:Enable*",
"kms:List*",
"kms:Put*",
"kms:Update*",
"kms:Revoke*",
"kms:Disable*",
"kms:Get*",
"kms:Delete*",
"kms:TagResource",
"kms:UntagResource",
"kms:ScheduleKeyDeletion",
"kms:CancelKeyDeletion"
],
"Resource": "*"
}
]
}
When CodeBuild attempts to decrypt the parameters, the build fails with an Access Denied error.
Which of the following modifications will resolve this issue?
- AModify the CodeBuild service role's IAM policy to grant KMS permissions on all resources (*) instead of specifying the KMS key ARN.
- BAdd iam:PassRole permissions for the KMS key to the CodeBuild service role's IAM policy to allow the build container to assume the key's permissions.
- CAdd a resource-based policy to the Systems Manager parameter that explicitly grants kms:Decrypt permission to the CodeBuild service role.
- Add a statement to the KMS key policy that grants the AWS account root principal (arn:aws:iam::111122223333:root) permission to perform kms:* actions, which allows IAM policies in the account to delegate key permissions.Cevap