A developer is implementing a microservice on Amazon ECS that needs to decrypt application configuration data using a customer managed key stored in AWS KMS. The developer attaches an IAM policy to the ECS Task Role that grants the `kms:Decrypt` permission for the specific KMS key. However, the microservice fails to decrypt the data and receives an `AccessDeniedException`. Which of the following is the most likely explanation for this authorization failure?
- The key policy associated with the customer managed key does not explicitly permit the ECS Task Role to perform the action, and it does not contain a statement allowing the AWS account to delegate permissions via IAM policies.Cevap
- BThe `kms:Decrypt` permission must be attached to the ECS Task Execution Role instead of the ECS Task Role to allow the containerized application to call the KMS API.
- CThe ECS Task Role is not permitted to call the AWS KMS API directly, so the developer must store the configuration as a SecureString in AWS Systems Manager Parameter Store.
- DThe customer managed key is a symmetric key, which restricts direct decryption API calls and requires the application to implement client-side envelope encryption.
Cevap
The key policy associated with the customer managed key does not explicitly permit the ECS Task Role to perform the action, and it does not contain a statement allowing the AWS account to delegate permissions via IAM policies.
The correct answer explains that for customer managed keys, the KMS key policy is the ultimate authority. An IAM policy cannot grant access to a KMS key unless the key policy explicitly allows the principal or delegates authority to the AWS account to allow IAM-based delegation. Without this key policy configuration, KMS calls will result in an AccessDeniedException.
Adım Adım Çözüm
Anahtar Kavram
AWS KMS Key Policies vs IAM Policies