DOP-C02 Configuration Management and IaC Practice Question
A company uses AWS CodeBuild to build a Java application. The buildspec.yml file includes a post_build phase that runs a script to package the application and upload it to an Amazon S3 bucket. The build is failing with an error indicating that the S3 bucket is not accessible. The CodeBuild service role has the AmazonS3FullAccess managed policy attached. The S3 bucket is in a different AWS account. Which action should the DevOps engineer take to resolve the issue?
⚠ Common exam trap
The trap here is assuming that attaching AmazonS3FullAccess to the CodeBuild service role is sufficient for cross-account access, but it only grants permissions within the same account.
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
✓
Add a bucket policy to the S3 bucket that grants the CodeBuild service role permissions to PutObject.
Cross-account access to S3 requires a bucket policy that explicitly grants permissions to the external IAM role. The CodeBuild service role already has S3 permissions in its own account, but the bucket policy in the target account must allow the role to perform PutObject. Therefore, adding a bucket policy is the correct resolution.
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 a bucket policy to the S3 bucket that grants the CodeBuild service role permissions to PutObject.
Why this is correct
When the S3 bucket is in a different account, the CodeBuild service role needs explicit permission from the bucket owner. The AmazonS3FullAccess policy grants permissions within the same account, but cross-account access requires a bucket policy that allows the role to perform actions. Adding a bucket policy that grants PutObject to the CodeBuild service role resolves the access issue.
- ✗
Configure the S3 bucket to allow public write access.
Why it's wrong here
Allowing public write access would grant permissions to anyone, not just the CodeBuild service role. This is a security risk and not a recommended practice. It does not specifically grant the required permissions to the CodeBuild role and could lead to data breaches.
- ✗
Enable cross-account access in the CodeBuild project settings.
Why it's wrong here
CodeBuild does not have a specific setting to enable cross-account access to S3. Cross-account access is managed through IAM policies and S3 bucket policies. This option is not a valid feature and would not resolve the permission issue.
- ✗
Modify the CodeBuild service role to include the s3:PutObject permission for the specific bucket ARN.
Why it's wrong here
The service role already has AmazonS3FullAccess, which includes s3:PutObject. However, cross-account access requires permissions on both sides. Adding a more specific IAM policy on the role does not grant the bucket owner's account permission to allow the action. The bucket policy is the missing piece.
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
This DOP-C02 question is part of Courseiva's 1,298-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 and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint
This DOP-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 DOP-C02 exam.