Courseiva

DVA-C02 Development with AWS Services Practice Question

Exhibit

Refer to the exhibit.
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "dynamodb:GetItem",
        "dynamodb:PutItem"
      ],
      "Resource": "arn:aws:dynamodb:us-east-1:123456789012:table/MyTable"
    },
    {
      "Effect": "Allow",
      "Action": [
        "kms:Decrypt"
      ],
      "Resource": "*"
    }
  ]
}

Refer to the exhibit. A developer attached the IAM policy to a Lambda function's execution role. The function reads items from a DynamoDB table that uses AWS KMS customer managed key (CMK) for encryption at rest. When the function tries to read an item, it receives an access denied error. What is the cause?

⚠ Common exam trap

A common mix-up: candidates assume an IAM policy allowing kms:Decrypt on all resources is sufficient, forgetting that KMS customer managed keys have their own key policies that must also grant access.

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

✓

The policy allows kms:Decrypt on all resources but the CMK key policy may not grant access.

The IAM policy grants kms:Decrypt on all resources, but DynamoDB uses AWS KMS customer managed keys (CMKs) for encryption at rest. Even if the IAM policy allows the action, the CMK's key policy must also grant the Lambda execution role access to use the key. If the key policy does not include a statement allowing the Lambda role to perform kms:Decrypt, the request fails with an access denied error, regardless of the IAM policy.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    The DynamoDB table is not encrypted with a KMS key.

    Why it's wrong here

    If the DynamoDB table were not encrypted with a KMS key, or if it used an AWS owned key, a `KMSAccessDeniedException` would not be the specific error encountered. DynamoDB tables are always encrypted at rest, and this error explicitly points to a permission issue with a Customer Managed Key (CMK) during the decryption process required to retrieve data. The presence of a KMS-specific error indicates a CMK is actively in use.

  • ✓

    The policy allows kms:Decrypt on all resources but the CMK key policy may not grant access.

    Why this is correct

    AWS KMS employs a two-layer authorization model for Customer Managed Keys (CMKs), requiring both an IAM policy and the KMS key policy to grant access. While the provided IAM policy explicitly allows `kms:Decrypt` on all resources (`*`), the specific CMK's key policy might not include the calling principal or its account in its statement, thereby denying the final decryption permission required to access the DynamoDB data.

  • ✗

    The policy does not allow dynamodb:GetItem on the table.

    Why it's wrong here

    The error message specifically indicates a `KMSAccessDeniedException`, not an access denied error for DynamoDB itself. If the IAM policy did not permit `dynamodb:GetItem`, the error would instead be a `DynamoDB:AccessDeniedException` or similar, preventing the operation from even reaching the KMS decryption stage. Therefore, the policy must allow `dynamodb:GetItem` for the KMS error to occur.

  • ✗

    The DynamoDB table does not exist.

    Why it's wrong here

    If the specified DynamoDB table did not exist, the API call would result in a `ResourceNotFoundException` from DynamoDB, not an access denied error related to KMS. The occurrence of a `KMSAccessDeniedException` implies that the table was successfully located and identified as being encrypted with a Customer Managed Key, but the subsequent attempt to decrypt its data failed due to insufficient KMS permissions.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

One of 1,135 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.