DOP-C02 SDLC Automation Practice Question
A DevOps team uses AWS CodePipeline to deploy a static website to an Amazon S3 bucket. The pipeline has a source stage (CodeCommit), a build stage (CodeBuild that runs a build tool), and a deploy stage (S3). After a recent code change, the build stage succeeded but the deploy stage failed with the error: 'Access Denied' when uploading artifacts to the S3 bucket. What should the team do to fix the issue?
⚠ Common exam trap
Many exam-takers confuse the CodeBuild service role with the CodePipeline service role; candidates often mistakenly add permissions to the CodeBuild role instead of the pipeline role, which does not resolve the deploy-stage access denied error.
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 's3:PutObject' permission to the CodePipeline service role
The deploy stage in CodePipeline uses the CodePipeline service role to upload artifacts to the S3 bucket. The error 'Access Denied' indicates that this role lacks the necessary permissions. Adding 's3:PutObject' to the CodePipeline service role grants it the required write access to the S3 bucket, resolving the issue.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Configure the S3 bucket to allow public access
Why it's wrong here
Configuring the S3 bucket for public access does not address the pipeline's inability to upload artifacts because the deploy stage uses the pipeline service role's identity, not bucket-level ACLs. Even if the bucket becomes publicly readable, the CodePipeline service role still lacks the required s3:PutObject permission to write deployment output. Additionally, enabling public access is a security risk, especially when the bucket may contain intermediate artifacts or unprocessed content, and it does not fix the underlying IAM authorization failure.
- ✓
Add 's3:PutObject' permission to the CodePipeline service role
Why this is correct
The deploy stage of CodePipeline assumes the CodePipeline service role when it interacts with S3, so that role must have an IAM policy allowing s3:PutObject on the target bucket. This permission enables the pipeline to upload the artifact archive and any extracted files to the bucket that hosts the static website. Without it, the deploy action fails with a permissions error even if other roles, such as CodeBuild's, happen to have access to the same bucket.
- ✗
Add an S3 bucket policy that grants the CodeBuild service role s3:PutObject access
Why it's wrong here
CodeBuild's service role is used during the build stage to run commands and produce output artifacts, but the subsequent deploy stage is executed by the CodePipeline service role, not by CodeBuild. Adding an S3 bucket policy that grants s3:PutObject to the CodeBuild role has no effect on the deployment because CodeBuild does not make the deploy-time call to S3. The failure occurs because the CodePipeline role lacks the required permission, so the bucket policy should instead be written to authorize the pipeline role or, more commonly, an IAM policy should be attached to the pipeline role.
- ✗
Verify that the CodeCommit repository has the correct permissions for the pipeline
Why it's wrong here
Since the source stage succeeded and pulled the code from CodeCommit, the pipeline already has the necessary CodeCommit read permissions, and any repository-level access controls are satisfied. The error is occurring in the deploy stage, where the pipeline attempts to write to S3, so checking CodeCommit permissions is a misdiagnosis. Verifying CodeCommit would only be relevant if the source stage had failed, but the pipeline has already moved past it, indicating the issue lies squarely with S3 write access.
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 DOP-C02 question from scratch — 1,298 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 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.