CI/CD stands for Continuous Integration and Continuous Delivery (or Deployment). It solves the major problem of manually moving software from a developer's laptop to a live server, which is slow, error-prone, and frustrating. For the DVA-C02 exam, you need to understand how AWS services like CodeCommit, CodeBuild, and CodePipeline automate this entire process, turning a chaotic manual job into a reliable, repeatable machine.
Jump to a section
A simple way to picture CI/CD Pipelines with CodeCommit, CodeBuild, and CodePipeline
A wedding reception is a carefully orchestrated chain of events, not a single spontaneous party. The host (the software developer) doesn't just show up and hope for the best. Instead, they use a 'recipe' or plan to ensure everything happens in the right order, every time. This plan is the wedding planner's checklist.
First, the host writes down the final guest list and menu. This is the source code, stored in a secure, central location called the 'Guest Book' (CodeCommit). Every change to the menu or seating chart is tracked with a timestamp and the name of the person who made the change.
Next, the wedding planner (CodeBuild) takes that final guest list and menu. She doesn't just run with it; she checks it meticulously. She ensures the caterer can handle the dietary restrictions, that the venue has enough chairs, and that the playlist (dependencies) is correct. She 'builds' the final event schedule, running tests to make sure the cake isn't supposed to be delivered to the wrong hall.
Finally, the planner hands the verified schedule to the event manager (CodePipeline). The manager automates the actual flow: 'At 3 PM, play the entrance music. At 3:15, serve appetisers. At 4 PM, cut the cake.' This automated sequence is the delivery pipeline. If the schedule passes all checks, the party (the application) goes live flawlessly. If the cake is late, the pipeline stops and notifies the host. This entire system—from the guest book to the automated manager—is a CI/CD pipeline.
CI/CD is the automation of moving software from a developer's local machine to a production environment where users can access it. Think of it as a factory assembly line for your code. Instead of a person manually carrying each part to the next station, you have a conveyor belt and robots that do it automatically, checking quality at every step.
Before CI/CD, software development was often a painful cycle. Developers would write code on their own machines for weeks or months. They would then try to 'merge' all their changes together, which often caused conflicts (code that had changed in incompatible ways). This was called 'integration hell.' After finally merging, they would manually run tests to find bugs. If bugs were found, they would have to fix them and start the whole painful merge process again. Finally, they would manually copy files to a server, a process called deployment, which was prone to human error (forgetting a file, using the wrong configuration).
CI/CD solves this by breaking the process into three core concepts:
Continuous Integration (CI) CI is the practice of merging all developers' working copies of code into a shared mainline several times a day. The key is automation. Every time a developer uploads (pushes) code to a central repository, an automated system immediately builds the code (compiles it into runnable software) and runs a suite of tests. If the build or tests fail, the system alerts the team immediately, so the problem is fixed while it's still small and fresh in the developer's mind. This prevents 'integration hell' because you integrate frequently, not once at the end.
Continuous Delivery (CD) Continuous Delivery takes the next step. After the CI process has verified that the code is good (it builds and passes tests), CD automates the release of that verified code to a repository where it can be deployed to production at any time. The key here is that the deployment to production is still a manual decision. A team member clicks a button to release the approved build. This ensures that the software is always in a deployable state, reducing the risk and stress of releases.
Continuous Deployment (CD) This is an extension of Continuous Delivery. In Continuous Deployment, every change that passes all stages of the production pipeline is automatically released to users. There is no human intervention. If the code passes automated tests and quality checks, it goes live. This is common in companies like Netflix or Amazon where thousands of updates happen daily.
The AWS Services for CI/CD
AWS provides three main services to build a CI/CD pipeline, each handling a specific part of the process.
CodeCommit CodeCommit is a fully managed source control service. 'Source control' (or version control) is a system that tracks changes to a file or set of files over time. Git is the most popular version control system. CodeCommit is essentially a private, secure Git repository hosted by AWS. Instead of hosting your own Git server (like GitHub or GitLab), you use CodeCommit. It stores your code, keeps a history of every change, and allows multiple developers to collaborate without stepping on each other's toes. It replaces the need to set up and maintain your own Git server.
CodeBuild CodeBuild is a fully managed build service. 'Building' is the process of converting source code into a runnable application. For example, if you write Java code, CodeBuild will compile it into a .jar file. If you have JavaScript code, CodeBuild might run 'npm install' to get dependencies and then run a build tool like Webpack. It also runs tests. CodeBuild is serverless, meaning you don't need to provision or manage a server to run your builds. You simply define a 'build specification' (a buildspec.yml file) that tells CodeBuild what commands to run, and CodeBuild executes them in an isolated container. It scales automatically and only charges you for the compute time you use.
CodePipeline CodePipeline is a fully managed continuous delivery service. It orchestrates the entire CI/CD workflow. You define a pipeline as a series of stages. For example, a typical pipeline might have these stages:
Source (CodeCommit): The pipeline watches your CodeCommit repository for new changes. When a new code change is pushed, it triggers the next stage.
Build (CodeBuild): The pipeline runs CodeBuild to compile your code and run tests.
Deploy (e.g., CodeDeploy, Elastic Beanstalk, or ECS): If the build succeeds, the pipeline automatically deploys the application to an environment (like a staging or production environment).
CodePipeline automates the transitions between these stages. If a stage fails, the pipeline stops and notifies you. You can also manually approve a stage in the pipeline, for example, requiring a manager to click 'Approve' before code goes to production. This gives you fine-grained control over the release process.
How They Work Together
Here is a typical workflow:
A developer writes code and pushes it to a CodeCommit repository.
A CodePipeline is configured to watch that repository. It detects the new code and automatically triggers a CodeBuild project (the 'Build' stage).
CodeBuild reads the buildspec.yml file, compiles the code, runs unit tests, and packages the application (e.g., creates a Docker image or a .zip file).
If the CodeBuild step is successful, CodePipeline moves the built artifact to the next stage, which could be 'Staging Deploy'. This might use CodeDeploy to deploy the application to a test server.
The pipeline might have a manual approval step. A test engineer checks the application on the staging server. If it looks good, they approve the step in CodePipeline.
Once approved, CodePipeline triggers a final deployment action, pushing the application to the production environment (e.g., using CodeDeploy or Elastic Beanstalk).
If any step fails, the pipeline stops, and an Amazon SNS notification is sent to the developer.
This entire process happens automatically, consistently, and quickly, allowing developers to release new features, fixes, and updates to users in a safe and reliable way.
Push Code to CodeCommit
A developer uploads new code to a CodeCommit repository. This is the starting point of the pipeline. CodeCommit securely stores the code and tracks every single commit, providing a full history of changes. The pipeline is configured to watch this specific repository and branch for new commits.
Pipeline Triggered by CloudWatch Events
An Amazon CloudWatch Events rule (or EventBridge rule) detects the new code commit in CodeCommit. This rule is your pipeline's alarm clock. When the rule matches the event (a new commit), it triggers the CodePipeline execution. The pipeline does not poll or check periodically; it is event-driven, which makes it instantaneous and efficient.
Source Stage Downloads Artifact
The CodePipeline 'Source' stage fetches the latest code from the CodeCommit repository and creates an output artifact. This artifact is a .zip file of the source code, which CodePipeline stores in a pre-configured Amazon S3 bucket. This artifact is then passed as input to the next stage in the pipeline.
Build Stage with CodeBuild
The pipeline moves to the 'Build' stage, where it runs a CodeBuild project. CodeBuild reads the buildspec.yml file from the source artifact. It spins up a new container, installs dependencies (e.g., Python packages, Node.js modules), runs unit tests, and compiles the code. If all commands succeed, it packages the final application (e.g., a .war file or Docker image) and uploads this new artifact back to the S3 bucket.
Manual Approval Step
After a successful build, the pipeline enters a 'Manual Approval' stage. The pipeline pauses here and waits for a person (like a QA lead or DevOps engineer) to review the build. This person logs into the AWS Console, sees the pending approval, and inspects test results or deploys to a staging environment. They click 'Approve' or 'Reject'. This step enforces a quality gate before code reaches production.
Deploy Stage with CodeDeploy
Once approved, the pipeline moves to the 'Deploy' stage. This stage uses CodeDeploy (or Elastic Beanstalk, ECS, etc.) to deploy the build artifact to the target environment, such as a production fleet of EC2 instances. CodeDeploy reads an appspec.yml file to know exactly which files to copy and which scripts to run, ensuring a consistent and repeatable deployment process.
Imagine you work as a developer for an e-commerce company called 'ShopFast'. Your team of five developers is responsible for the product catalogue page. The previous system was a nightmare: developers would code on their laptops for a week, then manually merge their changes during a stressful Friday afternoon meeting that often broke the site for hours.
Your team decides to implement a full CI/CD pipeline using AWS. Here is the step-by-step scenario of how you would use it.
First, you create a CodeCommit repository called 'shopfast-catalogue'. Each developer clones this repository to their local machine. They work on their own 'branches' (a copy of the code) to add features. For example, Dev A works on a new search filter, while Dev B fixes a bug with image loading. When Dev A finishes the search filter, she pushes her branch to CodeCommit and then creates a 'pull request'. Another team member reviews the code, and once approved, the code is merged into the 'main' branch of the repository.
The moment the code is merged into the 'main' branch, your CodePipeline triggers. You have set up a pipeline called 'ShopFast-Production-Pipeline'. The first stage is 'Source', which is configured to watch the 'main' branch of your CodeCommit repository. It detects the new commit and automatically passes the source code to the next stage.
The second stage is 'Build'. This stage launches a CodeBuild project. The project reads a buildspec.yml file from the root of your repository. The file contains instructions like: - 'npm install' to install JavaScript libraries - 'npm run lint' to check for code style issues - 'npm test' to run unit tests - 'npm run build' to package the code into a ready-to-deploy folder
CodeBuild runs these commands in a temporary container. If the linter finds a formatting error, the build fails immediately. CodePipeline sees the failure and stops. An Amazon SNS notification is sent to Dev A's phone: 'Build Failed: shopfast-catalogue main branch Lint Error'. Dev A fixes the issue, pushes her fix, and the pipeline runs again.
If the build succeeds, CodeBuild packages the code and uploads the output (a 'build artifact') to an Amazon S3 bucket. The next stage in the pipeline is 'Staging Deploy'. This stage uses CodeDeploy to deploy the application to a test environment that mimics production. The pipeline then waits for a manual approval.
The QA team logs into the AWS Management Console and sees a pending approval. They test the new search filter on the staging site. If they find a bug, they reject the approval, and the pipeline stops. They notify the developer. If everything looks good, they click 'Approve'.
The final stage is 'Production Deploy'. CodePipeline automatically triggers a CodeDeploy deployment to the production servers running on Amazon EC2 instances. CodeDeploy rolls out the new version gradually to minimise downtime. The new search filter is now live for all customers, automatically and without anyone having to manually copy files or restart servers.
The entire process, from merging code to live deployment, takes less than 15 minutes. This speed and reliability allows ShopFast to release new features multiple times a day, confidently, instead of once a month with high anxiety.
The DVA-C02 exam tests your understanding of how these services connect and what the default behaviours are. Here are the core topics and common traps.
Integration with Other Services The exam loves to test how CodePipeline integrates with other AWS services. Expect questions that ask, 'Which service should be used to trigger a pipeline automatically?' The answer is almost always Amazon CloudWatch Events (or EventBridge). CodePipeline watches your source repository, but it is CloudWatch Events that actually detects the change in CodeCommit and kicks off the pipeline. Another common integration is with Amazon SNS (Simple Notification Service) for sending notifications when a pipeline stage fails or succeeds.
Action Types in CodePipeline You need to memorise the different action categories that a pipeline can contain. They are:
Source (e.g., CodeCommit, S3, GitHub via a webhook)
Build (e.g., CodeBuild, Jenkins)
Test (e.g., CodeBuild, a third-party tool like BlazeMeter)
Deploy (e.g., CodeDeploy, Elastic Beanstalk, ECS, CloudFormation)
Approval (A manual step requiring a user to approve or reject)
Invoke (e.g., AWS Lambda)
A typical exam question will describe a pipeline with a manual approval step and ask you which action type it is. The answer is 'Approval'.
buildspec.yml vs. appspec.yml This is a major source of confusion. buildspec.yml is used by CodeBuild to define build commands (e.g., compile, test, package). appspec.yml is used by CodeDeploy to define how to deploy an application to EC2 instances, Lambda, or ECS (e.g., which files to install, which scripts to run before/after installation). The exam will test that you know which configuration file belongs to which service.
Trap: Artifact Storage A common trap is where build artifacts are stored. The correct answer is Amazon S3. CodeBuild automatically uploads the output of a successful build to an S3 bucket that CodePipeline can then fetch for the next stage. CodePipeline does not store artifacts itself.
Trap: Pipeline Stages and Parallel Actions The exam may present a scenario where you want to run two builds in parallel (e.g., one for Windows and one for Linux). CodePipeline supports parallel actions within a single stage. You create two 'Build' actions within the same stage, and they run concurrently. If both succeed, the pipeline moves to the next stage. If one fails, the pipeline fails.
Trap: CodeCommit Authentication When connecting CodeCommit to CodePipeline, you do not need to store SSH keys or HTTPS credentials in CodePipeline. CodePipeline uses an IAM role (a set of permissions) to access the CodeCommit repository on your behalf. The exam will test that you understand the relationship between IAM roles and cross-service permissions.
Key Definitions to Memorise - Artifact: The output of a build step, stored in S3. - Stage: A logical group of actions in a pipeline (e.g., Source, Build). - Action: An individual task within a stage (e.g., a specific CodeBuild project). - Transition: The movement from one stage to the next, which can be enabled or disabled. - Pipeline Execution: A specific run of the pipeline, representing a single version of code being processed.
CI/CD automates the process of integrating code changes, running tests, and deploying software, replacing slow and error-prone manual steps.
CodeCommit stores source code as a private Git repository; it is the 'source of truth' for your application code in a pipeline.
CodeBuild compiles, tests, and packages your code based on a buildspec.yml file, running in a temporary, serverless compute environment.
CodePipeline orchestrates the entire CI/CD workflow, connecting stages like Source (CodeCommit), Build (CodeBuild), and Deploy (CodeDeploy).
A pipeline can include a manual approval stage, which pauses the pipeline and requires a human to approve before proceeding to deployment.
Artifacts (the output of a build) are stored in an Amazon S3 bucket and passed between stages by CodePipeline.
CodePipeline and CodeBuild use IAM roles to securely access other AWS services; you never store credentials in code.
The DVA-C02 exam frequently tests the difference between buildspec.yml (CodeBuild) and appspec.yml (CodeDeploy).
These come up on the exam all the time. Here's how to tell them apart.
Continuous Delivery
Code is automatically built, tested, and prepared for release.
The actual deployment to production requires a manual approval step.
Teams control exactly when a release happens, reducing risk.
Continuous Deployment
Every code change that passes all tests is automatically deployed to production.
There is no human intervention in the deployment process.
Faster releases but requires a high level of confidence in automated testing.
CodeCommit
Fully managed AWS service; no servers to manage.
Integrates natively with other AWS services like CodeBuild and CodePipeline.
IAM users and roles control access using AWS policies.
GitHub
Third-party service owned by Microsoft.
Provides a rich web UI, issue tracking, and a large community.
Access is managed via GitHub accounts, SSH keys, or personal access tokens.
buildspec.yml
Used by CodeBuild to define build commands and output.
Defines phases like install, pre_build, build, and post_build.
Specifies how to compile, test, and package the application.
appspec.yml
Used by CodeDeploy to define deployment instructions.
Defines lifecycle hooks like BeforeInstall, AfterInstall, and ApplicationStart.
Specifies which files to copy and which scripts to run during deployment.
Pipeline Stage
A logical grouping of related tasks in a pipeline (e.g., Build, Deploy).
Stages run sequentially; the next stage starts only after the previous one completes.
A stage can contain multiple actions that run in parallel.
Pipeline Action
An individual task within a stage (e.g., a specific CodeBuild project or a deploy action).
Actions within a stage can run in parallel or sequentially depending on configuration.
Each action has a provider (e.g., CodeBuild, CodeDeploy) and input/output artifacts.
Mistake
CodeCommit is a full replacement for GitHub or GitLab, meaning it has all the same features like pull request templates and GitHub Actions.
Correct
CodeCommit is a managed Git repository. It handles the core version control (branches, commits, merges, pull requests), but it does not have a built-in CI/CD engine like GitHub Actions or GitLab CI. For automation, you must use CodeBuild and CodePipeline.
People often assume because AWS is so comprehensive, CodeCommit must include everything a competitor does. The reality is that AWS prefers a modular 'do one thing well' approach, so each function has its own service.
Mistake
CodeBuild runs on a dedicated server that I must provision and manage.
Correct
CodeBuild is fully serverless. It automatically spins up a fresh, temporary container for each build and terminates it after the build is complete. You never manage the underlying operating system or instance.
The term 'build server' is common in traditional IT, leading people to think it requires a physical or virtual machine they have to maintain. AWS abstracts this entirely.
Mistake
CodePipeline automatically deploys to production as soon as the build succeeds; there is no way to pause it for manual testing.
Correct
CodePipeline supports a manual approval action. You can add an 'Approval' stage in the pipeline that pauses execution and requires a designated user or group to approve or reject the release before it moves to the deploy stage.
Beginners confuse 'continuous delivery' (requires manual approval) with 'continuous deployment' (fully automatic). The exam tests this distinction.
Mistake
If I use CodePipeline with CodeCommit, I must store my AWS credentials in the CodeCommit repository or in the code itself.
Correct
CodePipeline uses IAM roles to obtain temporary credentials for accessing CodeCommit. Never store credentials in code. The IAM role assigned to the pipeline gives it permission to read the source repository.
This stems from a lack of understanding about how AWS handles cross-service authentication. People think about SSH keys or passwords because that is how they access Git on their local machine.
Mistake
The buildspec.yml and appspec.yml files are interchangeable; I can use either one for a build or a deploy.
Correct
buildspec.yml is specific to CodeBuild and defines build commands (test, compile, package). appspec.yml is specific to CodeDeploy and defines deployment instructions (where to copy files, which lifecycle hooks to run). They are not interchangeable.
Both files have 'spec' in the name and are YAML formatted, so beginners assume they do the same thing. The exam deliberately tests this confusion.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
CodeCommit is where you store your code (a Git repository). CodePipeline is the automation tool that moves that code from the repository through build and deploy stages. CodeCommit is the source; CodePipeline is the delivery process.
You can use GitHub, Bitbucket, or Amazon S3 as a source provider for CodePipeline, not just CodeCommit. The exam will test that CodePipeline supports multiple source types, including version 2 of CodeCommit and connections to GitHub via a webhook.
If CodeBuild fails (e.g., a test fails or the build command returns a non-zero exit code), the entire pipeline execution stops. CodePipeline marks that stage as 'Failed', and it does not proceed to the next stage. You can configure Amazon SNS to email you or your team when a failure occurs.
Build artifacts are stored in an Amazon S3 bucket. You configure a default bucket for your pipeline, and CodeBuild uploads the output there. The pipeline then downloads that artifact from S3 and passes it to the next stage.
Yes. Within a single stage of a CodePipeline, you can add multiple actions that run in parallel. For example, you could have two CodeBuild actions in the same stage to build your application for a Windows target and a Linux target simultaneously.
A buildspec.yml file is a collection of build commands and related settings, in YAML format, that CodeBuild uses to run a build. It defines phases like install, pre_build, build, and post_build, and specifies what commands to run in each phase.
You've just covered CI/CD Pipelines with CodeCommit, CodeBuild, and CodePipeline — now see how well it sticks with free DVA-C02 practice questions. Full explanations included, no account needed.
Done with this chapter?