DVA-C02 Security Practice Question
A company uses an AWS Lambda function to process files uploaded to an S3 bucket. The Lambda function needs to read the files and write results to a DynamoDB table. The Lambda function is configured with an IAM role that has policies allowing s3:GetObject on the bucket and dynamodb:PutItem on the table. Despite correct permissions, the function fails with an AccessDenied error when trying to put items. What is the most likely cause?
⚠ Common exam trap
A common mix-up: candidates assume IAM role permissions alone guarantee access, forgetting that resource-based policies on DynamoDB tables can explicitly deny access, which overrides any allow in identity-based policies.
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 DynamoDB table has a resource-based policy that explicitly denies access to the Lambda function's IAM role.
DynamoDB tables can have resource-based policies that explicitly deny access even if the IAM role has the necessary permissions. Since explicit denies in resource-based policies override any allow in identity-based policies, the Lambda function's IAM role with dynamodb:PutItem permission is still blocked, causing the AccessDenied 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.
- ✗
The Lambda function is in a VPC without a VPC endpoint for DynamoDB.
Why it's wrong here
If a Lambda function is configured within a VPC and attempts to access DynamoDB without a VPC endpoint, it must route traffic through a NAT Gateway to reach the public DynamoDB endpoint. Failure to configure a NAT Gateway or proper routing would result in network connectivity issues, typically manifesting as a timeout error, not an "AccessDenied" error. An "AccessDenied" error specifically indicates an authorization failure, not a network reachability problem.
- ✓
The DynamoDB table has a resource-based policy that explicitly denies access to the Lambda function's IAM role.
Why this is correct
AWS evaluates both identity-based policies (attached to the Lambda function's IAM role) and resource-based policies (attached directly to the DynamoDB table) to determine access. An explicit "Deny" statement in *any* applicable policy, including a resource-based policy, always takes precedence over any "Allow" statements. Therefore, even if the Lambda role has an "Allow" policy, an explicit "Deny" on the DynamoDB table itself will result in an "AccessDenied" error.
- ✗
The S3 bucket is in a different region, causing cross-region access issues.
Why it's wrong here
The region of the S3 bucket that triggers the Lambda function is largely independent of the Lambda function's ability to access a DynamoDB table. While S3 event notifications can be configured cross-region, the Lambda function's subsequent attempt to interact with DynamoDB is governed by its own network configuration and IAM permissions relative to the DynamoDB table's region. An "AccessDenied" error for DynamoDB operations would not stem from the S3 bucket's regional location.
- ✗
The DynamoDB table is encrypted with a customer managed KMS key, and the Lambda role does not have kms:Decrypt permission.
Why it's wrong here
If a DynamoDB table is encrypted using a Customer Managed Key (CMK) in AWS KMS, the IAM role assumed by the Lambda function must have explicit `kms:Decrypt` permission on that specific KMS key to read or write data. Without this permission, any attempt to interact with the encrypted data would result in an "AccessDenied" error from KMS, which would propagate as a DynamoDB access failure. While this is a valid cause for an "AccessDenied" error, a direct resource-based policy denial on DynamoDB itself is often a more direct and explicit configuration for preventing access.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
One of 724 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 →
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.