# AWS CodePipeline and CodeBuild

> Build AWS-native pipelines with CodePipeline, CodeBuild and CodeDeploy, useful in companies that keep all tooling inside AWS accounts. Free notes, key...

Canonical: https://www.internhack.in/roadmaps/tracks/cloud-engineer/codepipeline
Last updated: 2026-11-28

Build AWS-native pipelines with CodePipeline, CodeBuild and CodeDeploy, useful in companies that keep all tooling inside AWS accounts.

Intermediate · about 6 hours · difficulty 3/5

Learn first: [CI/CD Concepts and Pipeline Design](https://www.internhack.in/roadmaps/tracks/cloud-engineer/ci-cd-concepts), [STS, Assume Role and Federation](https://www.internhack.in/roadmaps/tracks/cloud-engineer/iam-roles-federation), [Docker and Container Images](https://www.internhack.in/roadmaps/tracks/cloud-engineer/docker)

Some enterprises keep their entire delivery toolchain inside AWS for compliance, private networking or billing reasons. The AWS-native stack covers the same ground as GitHub Actions. Azure Pipelines and Google Cloud Build are the equivalents.

### The services

- **CodePipeline**: orchestrates stages (source, build, test, deploy, approval). Sources include GitHub, Bitbucket and S3 via **CodeConnections**.
- **CodeBuild**: runs build commands defined in a buildspec.yml in managed containers. Can run inside your VPC to reach private resources.
- **CodeDeploy**: deploys to EC2, on-premises servers, Lambda and ECS with rolling, canary and blue/green strategies and automatic rollback on CloudWatch alarms.
- **CodeArtifact**: private package registry for npm, PyPI and Maven.

Note that AWS has stopped onboarding new customers to CodeCommit, so keep source code in GitHub or GitLab.

### How a pipeline flows

Source change triggers the pipeline, CodeBuild builds and pushes an image, a manual approval action waits for sign-off, and CodeDeploy runs a blue/green ECS deployment. Each stage uses its own IAM service role.

### Strengths and trade-offs

- Everything stays in your AWS accounts, uses IAM natively and integrates with CloudWatch Events.
- Cross-account deployments with roles are well supported.
- The developer experience and marketplace ecosystem are smaller than GitHub Actions.

### Pitfalls

- CodeBuild in a VPC without NAT or endpoints, so it cannot download dependencies.
- Overly broad service roles created by the console wizard.

You are ready to move on when you can build a pipeline that pulls from GitHub, builds with CodeBuild and deploys to ECS or Lambda with a manual approval.

## Key concepts

- **CodePipeline stages and actions**
- **CodeBuild and buildspec.yml**
- **CodeDeploy strategies**
- **CodeConnections to GitHub**
- **Manual approval actions**
- **Cross-account deployments**
- **CodeArtifact**

## Other options for this step

- [GitHub Actions to AWS](https://www.internhack.in/roadmaps/tracks/cloud-engineer/github-actions-aws): Build and deploy to AWS from GitHub Actions using OIDC roles, reusable workflows, environments with approvals and caching.

## Mini project

Create a CodePipeline that pulls your repo from GitHub, runs tests and builds an image in CodeBuild, waits for manual approval, and deploys a Lambda or ECS service. CodeBuild and CodePipeline have small free allowances; run a handful of executions only, then delete the pipeline, build project and artifact bucket.

## Check yourself

Your CodeBuild project runs inside a private subnet and fails to npm install. What is missing?

## Free resources

- [AWS CodePipeline documentation](https://docs.aws.amazon.com/codepipeline/) (AWS)
- [AWS CodeBuild documentation](https://docs.aws.amazon.com/codebuild/) (AWS)
- [AWS CodeDeploy documentation](https://docs.aws.amazon.com/codedeploy/) (AWS)

Previous: [GitHub Actions to AWS](https://www.internhack.in/roadmaps/tracks/cloud-engineer/github-actions-aws) · Next: [Deployment Strategies and Safe Releases](https://www.internhack.in/roadmaps/tracks/cloud-engineer/deployment-strategies)

## More in CI/CD for Cloud Workloads

- [CI/CD Concepts and Pipeline Design](https://www.internhack.in/roadmaps/tracks/cloud-engineer/ci-cd-concepts)
- [GitHub Actions to AWS](https://www.internhack.in/roadmaps/tracks/cloud-engineer/github-actions-aws)
- [AWS CodePipeline and CodeBuild](https://www.internhack.in/roadmaps/tracks/cloud-engineer/codepipeline)
- [Deployment Strategies and Safe Releases](https://www.internhack.in/roadmaps/tracks/cloud-engineer/deployment-strategies)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Cloud Engineer (AWS) Roadmap](https://www.internhack.in/roadmaps/tracks/cloud-engineer)
