DVA-C02 Security Practice Question
A company has a DynamoDB table that stores personally identifiable information (PII). A developer needs to allow a Lambda function to read and write to this table. What is the MOST secure way to grant the Lambda function 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 an IAM role with a policy that allows DynamoDB read/write access and attach it to the Lambda function.
An IAM role with an attached policy granting the necessary permissions is the most secure and best practice. Option B is wrong because resource-based policies on DynamoDB are not supported. Option C is wrong because IAM users should not be used for applications. Option D is wrong because temporary credentials from STS are not needed when using a role.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Create an IAM role with a policy that allows DynamoDB read/write access and attach it to the Lambda function.
Why this is correct
IAM roles are the correct way to grant permissions to Lambda.
- ✗
Use a resource-based policy on the DynamoDB table to allow the Lambda function's IAM role.
Why it's wrong here
DynamoDB does not support resource-based policies.
- ✗
Create an IAM user with programmatic access and embed the credentials in the Lambda environment variables.
Why it's wrong here
Embedding IAM user credentials in Lambda environment variables violates the principle of least privilege because static long-term access keys cannot be automatically rotated and remain exposed in plaintext, whereas the correct approach uses an IAM role with a trust policy that grants the Lambda function temporary credentials via the AWS Security Token Service. This option is tempting because IAM users with programmatic access are the standard method for granting API access to external applications, and environment variables are a convenient way to inject configuration; in a scenario where a non-AWS service or an on-premises application must authenticate to DynamoDB, an IAM user with embedded credentials would be the correct choice.
- ✗
Have the Lambda function assume a role using AWS STS each time it runs.
Why it's wrong here
Unnecessary; the execution role already provides permissions.
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 |
Go deeper
Related to this question
About these practice questions
This DVA-C02 question is part of Courseiva's 724-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
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.