Courseiva
Question 855 of 724
SecuritymediumMultiple ChoiceObjective-mapped

DVA-C02 Security Practice Question

A developer is building a serverless application using AWS Lambda and API Gateway. The Lambda function needs to access a DynamoDB table that stores sensitive customer data. The developer wants to follow the principle of least privilege. Which IAM role configuration should be used?

⚠ Common exam trap

Many candidates confuse resource-based policies (used for granting invoke permissions to Lambda) with execution role policies (used for granting the Lambda function access to other AWS services), leading them to pick Option A, which does not control DynamoDB 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

Create a custom IAM policy with specific DynamoDB actions (e.g., GetItem, PutItem) on the specific table and attach it to the Lambda execution role.

It adheres to the principle of least privilege by granting only the specific DynamoDB actions (e.g., GetItem, PutItem) required by the Lambda function, scoped to the exact table. The Lambda execution role is an IAM role that the Lambda service assumes, and attaching a custom policy with fine-grained permissions ensures minimal access. This approach avoids over-permissioning and follows AWS security best practices for serverless applications.

Answer analysis

Option-by-option breakdown

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

  • Configure a resource-based policy on the Lambda function to allow DynamoDB access.

    Why it's wrong here

    Configuring a resource-based policy on the Lambda function is incorrect because these policies define who can invoke the Lambda function or access its own resources, not what external AWS services the Lambda function itself can access. To grant a Lambda function permissions to interact with other services like DynamoDB, an identity-based policy must be attached to the function's IAM execution role, which dictates the permissions the function assumes during execution.

  • Attach the AmazonDynamoDBFullAccess managed policy to the Lambda execution role.

    Why it's wrong here

    Attaching the AmazonDynamoDBFullAccess managed policy to the Lambda execution role is a poor security practice as it grants permissions to perform all DynamoDB actions on all DynamoDB tables within the entire AWS account. While this would technically allow access, it severely violates the principle of least privilege, which mandates granting only the minimum necessary permissions required for the function's specific task, increasing the risk surface.

  • Use an S3 bucket policy to grant the Lambda function access to the DynamoDB table.

    Why it's wrong here

    Using an S3 bucket policy to grant the Lambda function access to a DynamoDB table is fundamentally incorrect because S3 bucket policies are exclusively designed to control access to objects and operations within a specific Amazon S3 bucket. These policies are service-specific and possess no authority or mechanism to grant permissions for accessing resources in a completely different AWS service like Amazon DynamoDB. Permissions for DynamoDB must be managed through IAM policies relevant to DynamoDB.

  • Create a custom IAM policy with specific DynamoDB actions (e.g., GetItem, PutItem) on the specific table and attach it to the Lambda execution role.

    Why this is correct

    Creating a custom IAM policy with specific DynamoDB actions (e.g., GetItem, PutItem) on the specific table and attaching it to the Lambda execution role is the correct and most secure approach. This method strictly adheres to the principle of least privilege by granting only the precise actions required (e.g., `dynamodb:GetItem`, `dynamodb:PutItem`) on the exact DynamoDB table resource (specified by its ARN), minimizing potential security risks and ensuring the function has only necessary 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

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 →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 24, 2026

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.

Loading comments…

Sign in to join the discussion.

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.