DOP-C02 SDLC Automation Practice Question
A DevOps engineer needs to automate the creation of a new AWS CodeCommit repository when a new project starts. The engineer wants to use infrastructure as code. Which service should be used?
⚠ Common exam trap
Test-takers frequently confuse AWS CodeStar's project templates (which can include a CodeCommit repository) with the ability to define infrastructure as code, but CodeStar does not provide the same declarative, version-controlled infrastructure management that CloudFormation offers.
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
✓
AWS CloudFormation
AWS CloudFormation is the correct service because it allows you to define and provision AWS infrastructure as code using templates. You can declare an AWS::CodeCommit::Repository resource in a CloudFormation template, which will automatically create the CodeCommit repository when the stack is created, enabling fully automated and repeatable infrastructure deployment.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
AWS CloudFormation
Why this is correct
AWS CloudFormation is the correct choice because it is a declarative Infrastructure as Code (IaC) service that can directly model and provision AWS resources, including AWS CodeCommit repositories. You define a repository in a CloudFormation template using the AWS::CodeCommit::Repository resource type, specifying properties such as RepositoryName and Code, and CloudFormation will create, update, and delete the repository as part of stack lifecycle management, making it ideal for automating resource creation.
- ✗
AWS CodePipeline
Why it's wrong here
AWS CodePipeline is a continuous delivery service that orchestrates the build, test, and deploy phases of an application release process. While a pipeline can invoke a CloudFormation stack as a deployment action, CodePipeline itself does not directly define or create AWS resources like a CodeCommit repository; it is a workflow automation engine rather than an infrastructure provisioning tool, so using it for this task would require CloudFormation or another provisioning mechanism to be called from the pipeline.
- ✗
AWS CodeStar
Why it's wrong here
AWS CodeStar provides a unified project dashboard and pre-configured project templates that tie together development tools like CodeCommit, CodeBuild, and CodePipeline. However, CodeStar is not an Infrastructure as Code service; it is a project management and collaboration layer that may provision resources on your behalf when creating a project, but it does not give you the precise, repeatable, template-driven control needed to automate the creation of a specific CodeCommit repository as a standalone infrastructure resource.
- ✗
AWS CodeBuild
Why it's wrong here
AWS CodeBuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages. It has no inherent ability to define or provision AWS resources; it can only build and test code that is already available in a source repository. While you could script repository creation in a buildspec file using the AWS CLI, that would be a workaround, not a native capability, and CloudFormation is the intended service for declarative resource creation.
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 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.