- A
Add s3:ListBucket to the task role policy and ensure the S3 bucket policy allows the task role ARN
Why wrong: ListBucket is not required for reading objects, and the bucket policy uses aws:SourceIp, not principal.
- B
Attach a NAT gateway to the private subnet and update the S3 bucket policy to allow the NAT gateway's public IP
Why wrong: NAT gateway provides outbound internet but the bucket policy would need to allow that IP, and it's less secure than VPC endpoint.
- C
Modify the task role policy to restrict resource ARNs to the specific S3 bucket and DynamoDB table
Why wrong: Scoping resources does not fix the IP condition or VPC endpoint requirement.
- D
Create a VPC endpoint for S3 and modify the S3 bucket policy to allow access from the VPC endpoint
VPC endpoint for S3 bypasses the need for public IP; bucket policy can use aws:sourceVpce condition.
DVA-C02 Security Practice Question
This DVA-C02 practice question tests your understanding of security. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
A company runs a containerized application on Amazon ECS using Fargate. The application needs to access an S3 bucket to read configuration files and a DynamoDB table to store session state. The ECS task role is configured with the following IAM policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:GetObject", "dynamodb:PutItem", "dynamodb:GetItem"
],
"Resource": "*"
}
]
}The application fails to read from the S3 bucket and write to DynamoDB. The error messages indicate AccessDenied. The S3 bucket has a bucket policy that denies all access unless the request includes a specific aws:SourceIp condition. The DynamoDB table has a resource-based policy that allows access only from the VPC endpoint. The ECS tasks are running in a private subnet with a VPC endpoint for DynamoDB but no VPC endpoint for S3. Which action should be taken to resolve the errors?
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 VPC endpoint for S3 and modify the S3 bucket policy to allow access from the VPC endpoint
The application fails because the S3 bucket policy denies access unless the request includes a specific `aws:SourceIp` condition, but the ECS tasks in a private subnet have no public IP and no VPC endpoint for S3. Without a VPC endpoint, traffic to S3 traverses the internet via a NAT gateway, but the bucket policy explicitly requires a specific source IP, which the NAT gateway's public IP does not match (or is not allowed). Option D resolves this by creating a VPC endpoint for S3 and modifying the bucket policy to allow access from the VPC endpoint, bypassing the IP condition and enabling private connectivity.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
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 s3:ListBucket to the task role policy and ensure the S3 bucket policy allows the task role ARN
Why it's wrong here
ListBucket is not required for reading objects, and the bucket policy uses aws:SourceIp, not principal.
- ✗
Attach a NAT gateway to the private subnet and update the S3 bucket policy to allow the NAT gateway's public IP
- ✗
Modify the task role policy to restrict resource ARNs to the specific S3 bucket and DynamoDB table
Why it's wrong here
Scoping resources does not fix the IP condition or VPC endpoint requirement.
- ✓
Create a VPC endpoint for S3 and modify the S3 bucket policy to allow access from the VPC endpoint
Why this is correct
VPC endpoint for S3 bypasses the need for public IP; bucket policy can use aws:sourceVpce condition.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates may focus on the task role policy (Option C) or NAT gateway (Option B) without recognizing that the S3 bucket policy's `aws:SourceIp` condition explicitly blocks traffic from private subnets without a VPC endpoint, and that the DynamoDB table policy already requires a VPC endpoint, which is present for DynamoDB but missing for S3.
Detailed technical explanation
How to think about this question
VPC endpoints for S3 use AWS PrivateLink to route traffic privately, avoiding the public internet and allowing bucket policies to use `aws:SourceVpce` or `aws:SourceVpc` conditions instead of `aws:SourceIp`. The DynamoDB VPC endpoint already exists, so the DynamoDB table policy's condition is satisfied; the missing S3 VPC endpoint is the sole cause of the S3 access failure. In real-world scenarios, mixing IP-based and VPC endpoint-based conditions across services requires careful alignment of network paths to avoid asymmetric routing or policy conflicts.
KKey Concepts to Remember
- Read the scenario before looking for a memorised answer.
- Find the constraint that changes the correct option.
- Eliminate answers that are true in general but not in this case.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A media company stores terabytes of video archives that are accessed once a year for audit purposes. Moving these objects to a cold storage tier (Azure Archive, S3 Glacier, or Google Nearline) costs a fraction of hot storage. Questions like this test whether you understand storage tiers, access frequency tradeoffs, and retrieval latency requirements.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
- →
Security — study guide chapter
Learn the concepts, then practise the questions
- →
Security practice questions
Targeted practice on this topic area only
- →
All DVA-C02 questions
1,616 questions across all exam domains
- →
AWS Certified Developer Associate DVA-C02 study guide
Full concept coverage aligned to exam objectives
- →
DVA-C02 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related DVA-C02 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Development with AWS Services practice questions
Practise DVA-C02 questions linked to Development with AWS Services.
Security practice questions
Practise DVA-C02 questions linked to Security.
Deployment practice questions
Practise DVA-C02 questions linked to Deployment.
Troubleshooting and Optimization practice questions
Practise DVA-C02 questions linked to Troubleshooting and Optimization.
DVA-C02 fundamentals practice questions
Practise DVA-C02 questions linked to DVA-C02 fundamentals.
DVA-C02 scenario practice questions
Practise DVA-C02 questions linked to DVA-C02 scenario.
DVA-C02 troubleshooting practice questions
Practise DVA-C02 questions linked to DVA-C02 troubleshooting.
Practice this exam
Start a free DVA-C02 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this DVA-C02 question test?
Security — This question tests Security — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Create a VPC endpoint for S3 and modify the S3 bucket policy to allow access from the VPC endpoint — The application fails because the S3 bucket policy denies access unless the request includes a specific `aws:SourceIp` condition, but the ECS tasks in a private subnet have no public IP and no VPC endpoint for S3. Without a VPC endpoint, traffic to S3 traverses the internet via a NAT gateway, but the bucket policy explicitly requires a specific source IP, which the NAT gateway's public IP does not match (or is not allowed). Option D resolves this by creating a VPC endpoint for S3 and modifying the bucket policy to allow access from the VPC endpoint, bypassing the IP condition and enabling private connectivity.
What should I do if I get this DVA-C02 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
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 24, 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.