SOA-C02 Deployment, Provisioning, and Automation Practice Question
A company uses AWS CodeCommit to store its source code and AWS CodeBuild to compile and test the code. The SysOps administrator is setting up a new build project that needs to access a private Amazon S3 bucket to download build dependencies. The build project runs in a VPC. The administrator has attached an IAM role to the build project with permissions to access the S3 bucket. However, the build fails with an access denied error when trying to download the dependencies. The S3 bucket is in the same region and account. What should the administrator do to resolve the issue?
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 Amazon S3 and associate it with the VPC where CodeBuild runs.
When CodeBuild runs in a VPC, it cannot access S3 endpoints over the internet by default. An S3 VPC endpoint allows CodeBuild to access S3 privately without needing an internet gateway or NAT. The IAM role already has the necessary permissions; the issue is network connectivity.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Attach an internet gateway to the VPC to provide internet access.
Why it's wrong here
Attaching an internet gateway (IGW) to the VPC will not automatically make S3 accessible to CodeBuild unless the VPC route table has a 0.0.0.0/0 route to the IGW and the CodeBuild subnets have public IPs or a NAT device—but even then, S3 traffic would traverse the public internet, introducing additional exposure and still requiring the bucket policy to permit access from that public path. The question indicates that CodeBuild is running in the VPC and failing to reach S3, and the correct architecture is to use a VPC endpoint for S3 to keep the traffic private. An IGW is not needed for S3 access because an S3 VPC endpoint provides the required connectivity without an internet route, and adding an IGW could actually create unintended internet egress for the build environment.
- ✗
Configure the security group for CodeBuild to allow outbound traffic to the S3 bucket.
Why it's wrong here
Security groups control traffic at the instance or elastic network interface level, but Amazon S3 is a regional service accessed through an HTTPS endpoint (like s3.amazonaws.com or a bucket-specific endpoint) and is not a resource that can be directly addressed by a security group rule. Even if the CodeBuild VPC security group already permits all outbound HTTPS traffic, the request cannot reach S3 because the VPC lacks a route to S3's public IP ranges—a security group rule does not create a network path. The issue is that CodeBuild in a VPC is not routing traffic to S3, so modifying the outbound security group rules cannot resolve the connectivity failure.
- ✓
Create a VPC endpoint for Amazon S3 and associate it with the VPC where CodeBuild runs.
Why this is correct
Creating a VPC endpoint for Amazon S3 (gateway or interface type) and associating it with the VPC where CodeBuild runs gives the build container a private, routable path to S3 without traversing the public internet. Because CodeBuild runs inside the VPC on elastic network interfaces, outbound traffic to S3 will only succeed if the VPC has a route to S3 via a gateway endpoint or a NAT/internet gateway. The gateway endpoint uses prefix lists to route S3 traffic within the AWS network, which resolves the access denied error caused by the lack of network connectivity. This is the intended fix because the root cause is a network routing problem, not missing IAM permissions or security group misconfiguration.
- ✗
Update the IAM role to include 's3:ListBucket' permission.
Why it's wrong here
Updating the IAM role to include 's3:ListBucket' is unnecessary because downloading a specific source artifact only requires s3:GetObject on the object key, and the existing role presumably already has that permission. The 's3:ListBucket' action allows the caller to enumerate the contents of a bucket, which is irrelevant when CodeBuild is fetching a known source zip from the CodeCommit-to-S3 pipeline. The reported access denied error is actually a network connectivity problem: CodeBuild running in a private VPC cannot reach S3 without a VPC endpoint or an internet route, regardless of IAM permissions. Adding this permission would not fix the failure because the request is being denied due to the network path, not an authorization policy.
Visual reference
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
Courseiva writes every SOA-C02 question from scratch — 247 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 SOA-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 SOA-C02 exam.