You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
In the previous lessons we covered CodeCommit (source), CodeBuild (build/test), and CodeDeploy (deploy). Each service is useful on its own, but the real power emerges when you chain them together into an automated pipeline that takes code from commit to production with no manual intervention. AWS CodePipeline is the orchestration service that makes this possible.
AWS CodePipeline is a fully managed continuous delivery service that models and automates the stages of your release process. A pipeline is a series of stages, each containing one or more actions. When source code changes, the pipeline is triggered automatically and flows through every stage in sequence.
The top-level resource. A pipeline defines the stages and actions that make up your release process. Each pipeline has exactly one source stage.
A stage is a logical grouping of actions. Common stages include:
| Stage | Purpose |
|---|---|
| Source | Pull code from a repository |
| Build | Compile, test, and package |
| Test | Run integration or end-to-end tests |
| Staging | Deploy to a staging environment |
| Approval | Manual approval gate |
| Production | Deploy to production |
Stages run in order. Within a stage, actions can run in parallel or sequentially.
An action is a task within a stage. Every action has a category, a provider, and input/output artefacts.
| Category | Example Providers |
|---|---|
| Source | CodeCommit, GitHub, S3, Bitbucket, ECR |
| Build | CodeBuild, Jenkins |
| Test | CodeBuild, Device Farm, third-party tools |
| Deploy | CodeDeploy, CloudFormation, ECS, S3, Elastic Beanstalk |
| Approval | Manual approval (SNS notification) |
| Invoke | Lambda, Step Functions |
Actions pass data to each other through artefacts stored in an S3 bucket. For example:
Let's walk through creating a pipeline with Source, Build, and Deploy stages.
Stage 1 — Source (CodeCommit)
The pipeline watches a CodeCommit repository's main branch. When a push is detected, the source code is packaged as an artefact and passed to the next stage.
Stage 2 — Build (CodeBuild)
CodeBuild receives the source artefact, runs the buildspec (install dependencies, lint, test, compile), and outputs a build artefact (e.g. a ZIP file in S3).
Stage 3 — Deploy (CodeDeploy)
CodeDeploy takes the build artefact and deploys it to an EC2 deployment group using the AppSpec file and lifecycle hooks.
Real-world pipelines often have more stages:
Within a single stage, you can run actions in parallel. For example, in a Test stage you might run unit tests and security scans simultaneously. Parallel actions share the same run order number.
Subscribe to continue reading
Get full access to this lesson and all 10 lessons in this course.