Question 724 of 724
DVA-C02 Security Practice Question
A company uses a customer managed AWS KMS key to encrypt sensitive data stored in DynamoDB. A Lambda function reads from the DynamoDB table and needs to decrypt the data. The Lambda function's execution role has an IAM policy that allows kms:Decrypt on the key. However, access is denied. What must the developer add to the KMS key policy to resolve the issue?
⚠ Common exam trap
Test-takers frequently assume IAM permissions alone are sufficient for KMS operations, forgetting that KMS key policies act as an additional layer of access control that must explicitly allow the principal.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Add a statement granting kms:Decrypt to the Lambda function's execution role.
KMS key policies are resource-based policies that control access to the key itself. Even if the Lambda execution role has an IAM policy granting kms:Decrypt, the KMS key policy must explicitly allow the role (or the user/account) to perform that action. Without this statement in the key policy, the IAM permission is ineffective, resulting in an access denied error.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Add a statement granting kms:Decrypt to the Lambda function's execution role.
Why this is correct
When a Lambda function needs to interact with a customer-managed AWS KMS key, the key policy associated with that KMS key must explicitly grant permissions to the entity making the request. The Lambda function assumes an IAM execution role, and it is this role that makes API calls to KMS. Therefore, the KMS key policy must include a statement allowing the kms:Decrypt action for the specific ARN of the Lambda function's execution role, ensuring direct access control and adherence to the principle of least privilege.
- ✗
Add a statement granting kms:Decrypt to the Lambda function's resource-based policy.
Why it's wrong here
Lambda functions themselves do not possess a resource-based policy that directly controls their outbound access to external KMS keys. While Lambda functions do have resource-based policies (also known as access policies) that control who can invoke the function, these policies do not govern the function's permissions to interact with other AWS services. The KMS key policy is the definitive resource policy for the KMS key, dictating which IAM principals can perform cryptographic operations on it.
- ✗
Add a statement granting kms:Decrypt to the Lambda service principal.
Why it's wrong here
Granting kms:Decrypt to the Lambda service principal (lambda.amazonaws.com) is incorrect because the service principal represents the AWS Lambda service itself, not the specific execution context of a user's Lambda function. When a Lambda function executes, it assumes the identity of its designated IAM execution role. This execution role is the actual principal that makes API calls to AWS KMS, and thus, the KMS key policy must grant permissions directly to this role, not the overarching service principal.
- ✗
Add a statement granting kms:Decrypt to the account root user with a condition for the Lambda function.
Why it's wrong here
Granting permissions directly to the account root user, even with a condition, is an insecure and indirect method for providing a Lambda function access to a KMS key. The root user possesses unrestricted administrative privileges across the entire AWS account and should be used sparingly, primarily for initial setup. Best practices dictate that specific IAM roles, like a Lambda execution role, should be granted only the necessary permissions directly via the KMS key policy, adhering to the principle of least privilege and avoiding broad root user access.
Visual reference
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 11, 2026
This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.