CodePipeline CodeBuild
LearningTree Β· AWS Β· DevOps

Other DevOps Services β€”
CodePipeline Β· CodeBuild Β· CodeDeploy Β· CodeArtifact Β· Proton

Five services that complete the AWS DevOps ecosystem: CodePipeline orchestrates CI/CD workflows, CodeBuild compiles and tests, CodeDeploy automates deployments, CodeArtifact manages packages, and Proton provides template-driven service deployment.

01
Chapter One Β· DevOps

AWS CodePipeline β€” CI/CD Orchestration

AWS CodePipeline is a fully managed continuous delivery service that orchestrates the steps needed to release software. It models your release process as a pipeline of stages β€” source, build, test, deploy β€” and executes them automatically every time code changes.

What CodePipeline Does Introductory
πŸ”„

Orchestration

  • Define stages: Source β†’ Build β†’ Test β†’ Deploy
  • Each stage has one or more actions
  • Automatic trigger on code push
  • Manual approval gates between stages
πŸ”—

Integrations

  • Source: CodeCommit, GitHub, S3, ECR
  • Build: CodeBuild, Jenkins
  • Test: CodeBuild, third-party tools
  • Deploy: CodeDeploy, ECS, CloudFormation, S3, Lambda, Elastic Beanstalk
βš™οΈ

Pipeline Features

  • Parallel actions within a stage
  • Cross-region deployments
  • Cross-account deployments
  • Variables passed between stages
  • EventBridge integration for notifications
Pipeline Architecture Core
CodePipeline β€” Typical CI/CD Pipeline Flow
SOURCE GitHub / CodeCommit S3 / ECR BUILD CodeBuild Compile + Unit test TEST Integration tests Quality gates APPROVE Manual gate (optional) DEPLOY CodeDeploy / ECS / CFN Lambda / S3 / EB Each stage auto-triggers on success β€” or stops on failure
CodePipeline orchestrates; CodeBuild builds; CodeDeploy deploys
Pipeline Types Core
FeatureV1 PipelineV2 Pipeline (default)
Pricing$1/active pipeline/month$0.002 per action execution minute
TriggerPolling or CloudWatch EventsEventBridge-based (push triggers)
Pipeline variablesLimitedFull variable support between stages
Best forSimple, low-frequency pipelinesHigh-frequency, modern CI/CD
🧠 Key Distinction

CodePipeline is the orchestrator β€” it doesn't build or deploy anything itself. It calls other services (CodeBuild, CodeDeploy, CloudFormation, Lambda) to do the actual work. Think of it as the conductor of the CI/CD orchestra.

CodePipeline vs Jenkins vs GitHub Actions Core
DimensionCodePipelineJenkinsGitHub Actions
HostingFully managed AWSSelf-hosted (EC2/EKS)GitHub-hosted or self-hosted
AWS integrationβœ… Native (IAM, EventBridge, CloudFormation)Via pluginsVia actions + OIDC
Multi-account deployβœ… Built-in cross-account rolesManual configVia OIDC + assume role
Cost modelPer pipeline or per action-minuteEC2 instance costFree tier + per minute
Best forAWS-native CI/CDComplex, multi-cloudGitHub-centric repos
Chapter 01 β€” Key Takeaway

CodePipeline is the orchestration layer for AWS-native CI/CD. It connects source, build, test, and deploy stages into an automated release workflow. It doesn't build or deploy itself β€” it calls CodeBuild, CodeDeploy, CloudFormation, and others. Use it when you want fully managed, AWS-integrated continuous delivery with cross-account and cross-region support.

02
Chapter Two Β· DevOps

AWS CodeBuild β€” Managed Build Runner

AWS CodeBuild is a fully managed build service that compiles source code, runs tests, and produces deployable artifacts. No build servers to provision or manage β€” you define a buildspec.yml, and CodeBuild spins up a fresh container for every build, then tears it down when done.

What CodeBuild Does Introductory
πŸ”¨

Build & Compile

  • Compile Java, Go, Python, Node, .NET, etc.
  • Build Docker images
  • Run webpack, Maven, Gradle, npm
  • Produce JAR, ZIP, Docker image artifacts
πŸ§ͺ

Test

  • Unit tests, integration tests
  • Code coverage reports
  • SAST / security scanning
  • Test reports visible in console
πŸ“¦

Artifacts & Cache

  • Upload artifacts to S3 automatically
  • Push Docker images to ECR
  • Local + S3 caching for dependencies
  • Artifacts passed to CodePipeline deploy stage
How a Build Works Core
CodeBuild β€” Build Lifecycle
SOURCE S3 / GitHub CodeCommit / ECR INSTALL Dependencies npm install / mvn PRE_BUILD Login ECR Lint / validate BUILD Compile + test docker build POST_BUILD docker push β†’ ECR Upload artifacts β†’ S3 All phases defined in buildspec.yml β€” each runs in a fresh container
buildspec.yml β€” The Build Recipe Core

Every CodeBuild project needs a buildspec.yml at the root of your repository (or inline in the project config). It defines four phases:

PhasePurposeExample Commands
installInstall dependencies and runtimesnpm install, pip install -r requirements.txt
pre_buildPre-build steps (login, lint)aws ecr get-login-password, eslint .
buildMain compilation and testsmvn package, docker build -t app .
post_buildPush images, package artifactsdocker push, aws s3 cp
Build Environments Core
Compute TypevCPU / MemoryCost (Linux)Best For
Small3 GB / 2 vCPU$0.005/minSimple builds, Lambda packaging
Medium7 GB / 4 vCPU$0.010/minStandard Java/Node builds
Large15 GB / 8 vCPU$0.020/minDocker builds, large compilations
2XLarge145 GB / 72 vCPU$0.200/minMassive monorepos, parallel tests
LambdaUp to 10 GB$0.00375/minFastest start (< 3s), simple builds
🧠 Key Distinction

CodeBuild Lambda compute starts in under 3 seconds (vs 30-60s for container compute) β€” ideal for quick builds like Lambda packaging or simple compilation. But it can't run Docker commands or use elevated privileges.

CodeBuild vs Jenkins vs GitHub Actions Core
DimensionCodeBuildJenkinsGitHub Actions
InfrastructureFully managed, serverlessSelf-hosted (you manage agents)GitHub-hosted or self-hosted runners
ScalingAuto β€” unlimited concurrent buildsManual β€” add more agentsLimited concurrency on free tier
Docker supportβœ… Privileged modeβœ… Docker-in-Dockerβœ… Docker actions
VPC accessβœ… Native VPC integrationβœ… (agents in VPC)Self-hosted runners in VPC
PricingPer build-minute ($0.005–$0.20)EC2 instance costFree tier + per minute
Best forAWS-native, CodePipeline integrationComplex multi-tool pipelinesGitHub-centric workflows
Chapter 02 β€” Key Takeaway

CodeBuild is the serverless build engine of AWS. Define your build in a buildspec.yml, and CodeBuild handles compute, scaling, and cleanup. It's the default choice when you're already using CodePipeline β€” zero servers to manage, auto-scales to any concurrency, and integrates natively with S3, ECR, and IAM. Use Lambda compute for sub-3-second starts on simple builds.

03
Chapter Three Β· DevOps

AWS CodeDeploy β€” Deployment Automation

AWS CodeDeploy is a fully managed deployment service that automates code deployments to EC2 instances, on-premises servers, Lambda functions, and ECS services. It eliminates manual deployments and provides strategies like rolling, blue/green, and canary β€” with automatic rollback on failure.

Deployment Platforms Introductory
πŸ–₯️

EC2 / On-Premises

  • Install CodeDeploy agent on instances
  • Deploy application revisions from S3 or GitHub
  • In-place or blue/green deployment
  • Hook scripts: BeforeInstall, AfterInstall, ApplicationStart, ValidateService
🐳

Amazon ECS

  • Blue/green deployment via ECS + ALB
  • Traffic shifting: canary, linear, all-at-once
  • Automatic rollback on CloudWatch alarms
  • No agent needed β€” integrated with ECS
⚑

AWS Lambda

  • Shift traffic between Lambda versions
  • Canary: 10% for 5min, then 100%
  • Linear: 10% every 2min
  • Rollback if alias CloudWatch alarm fires
Deployment Strategies Core
StrategyHow It WorksDowntimeBest For
In-Place (Rolling)Stop app, deploy new version, restart β€” one batch at a timeBrief per instanceEC2 fleets, cost-sensitive
Blue/Green (EC2)Launch new ASG with new version β†’ shift ALB traffic β†’ terminate old ASGZeroProduction EC2, instant rollback
Blue/Green (ECS)New task set behind same ALB β†’ shift traffic β†’ drain old tasksZeroContainerised services
CanarySmall % of traffic to new version β†’ wait β†’ shift remainingZeroRisk-averse production releases
LinearIncrementally shift traffic in equal steps (e.g., 10% every 2min)ZeroGradual rollout with monitoring
All-at-OnceDeploy to all instances simultaneouslyBriefNon-production, fast iteration
AppSpec File Core

The appspec.yml (or appspec.json) is CodeDeploy's deployment recipe β€” similar to CodeBuild's buildspec.yml:

PlatformAppSpec DefinesKey Fields
EC2 / On-PremFiles to copy + lifecycle hook scriptsfiles, hooks (BeforeInstall, AfterInstall, ApplicationStart, ValidateService)
ECSTask definition + container/port for traffic shiftingTaskDefinition, ContainerName, ContainerPort
LambdaFunction name + versions for traffic shiftingName, CurrentVersion, TargetVersion
🧠 Key Distinction

CodeDeploy β‰  infrastructure provisioning. It deploys application code to existing compute. For provisioning infrastructure, use CloudFormation or CDK. CodeDeploy handles the "put new code on running servers/containers/functions" step β€” often as the last stage in a CodePipeline.

Rollback & Alarms Core
βͺ

Automatic Rollback

  • Rolls back if deployment fails
  • Rolls back if CloudWatch alarm triggers
  • Blue/green: just repoint traffic to old version
  • In-place: re-deploy previous revision
πŸ””

CloudWatch Alarms

  • Attach alarms to deployment group
  • Monitor error rate, latency, 5xx count
  • If alarm fires during deploy β†’ auto-rollback
  • Critical for canary/linear strategies
Chapter 03 β€” Key Takeaway

CodeDeploy automates the "put new code on compute" step β€” supporting EC2, ECS, and Lambda with zero-downtime strategies (blue/green, canary, linear). Define your deployment in appspec.yml, attach CloudWatch alarms for automatic rollback, and let CodePipeline trigger it. It deploys code, not infrastructure.

04
Chapter Four Β· DevOps

AWS CodeArtifact β€” Package Repository

AWS CodeArtifact is a fully managed artifact repository for storing, publishing, and sharing software packages. It works with npm, pip, Maven, Gradle, NuGet, and Swift β€” providing a secure, private package store that sits between your developers and public registries like npmjs.com or PyPI.

What CodeArtifact Does Introductory
πŸ“¦

Private Packages

  • Host internal/proprietary packages
  • Publish from CI/CD pipelines
  • Version control for all artifacts
  • Scoped access via IAM policies
πŸ”—

Upstream Proxy

  • Proxy public registries (npm, PyPI, Maven Central)
  • Cache external packages in your domain
  • Single source of truth for all dependencies
  • Block unapproved external packages
πŸ›‘οΈ

Security & Governance

  • IAM-based access control
  • Cross-account sharing via resource policies
  • Audit with CloudTrail
  • KMS encryption at rest
Key Concepts Core
ConceptWhat It IsAnalogy
DomainTop-level container β€” groups all repositories in an orgLike a GitHub organisation
RepositoryA package store (e.g., "my-npm-repo")Like a GitHub repository
UpstreamLinked repo; fallback if package not found locallyLike a proxy cache to npmjs.com
PackageA named artifact with versions (e.g., lodash@4.17.21)npm/pip package
Auth tokenTemporary token from aws codeartifact get-authorization-tokenLike npm login but via IAM
🧠 Key Distinction

CodeArtifact is for software packages (npm, pip, Maven) β€” not deployment artifacts. For storing build outputs (ZIP, JAR, Docker images), use S3 or ECR. CodeArtifact replaces private Nexus/Artifactory servers for package management.

CodeArtifact vs Alternatives Core
FeatureCodeArtifactNexus / ArtifactoryGitHub Packages
HostingFully managed AWSSelf-hosted (EC2/EKS)GitHub-hosted
Package typesnpm, pip, Maven, NuGet, SwiftAll + Docker, Helm, Gonpm, Maven, NuGet, Docker
Upstream proxyβœ… Built-in (npm, PyPI, Maven Central)βœ… Advanced proxy + caching❌ Limited
AuthIAM-based (temp tokens)Username/password, LDAPGitHub token
Cross-accountβœ… Resource policiesManual configGitHub org-level
Best forAWS-native teams, CodePipelineMulti-cloud, advanced featuresGitHub-centric teams
Chapter 04 β€” Key Takeaway

CodeArtifact is a managed Nexus/Artifactory replacement for AWS. It hosts private packages, proxies public registries, and controls access via IAM. Use it when you want a single, secure source of truth for npm/pip/Maven dependencies without managing artifact servers. Authenticate via temporary IAM tokens, not long-lived credentials.

05
Chapter Five Β· DevOps

AWS Proton β€” Template-Driven Service Deployment

AWS Proton is a managed service for platform teams to define, share, and manage infrastructure templates. Platform engineers create environment and service templates (using CloudFormation or Terraform); developers pick a template and deploy β€” without needing to understand the underlying infrastructure.

The Problem Proton Solves Introductory
⚠️

Without Proton

  • Every team writes their own CloudFormation / Terraform
  • Inconsistent infrastructure across services
  • Security and compliance drift
  • Platform team can't enforce standards
  • Developers blocked on infra knowledge
βœ…

With Proton

  • Platform team publishes approved templates
  • Developers self-service deploy from catalog
  • Consistent, compliant infrastructure
  • Template updates roll out to all services
  • Separation of concerns: infra vs. app code
Key Concepts Core
ConceptWho Creates ItWhat It Is
Environment TemplatePlatform teamShared infra: VPC, cluster, database, networking
Service TemplatePlatform teamPer-service infra: ECS task, Lambda, ALB, pipeline
EnvironmentPlatform teamAn instance of an environment template (e.g. "prod-us-east-1")
ServiceDeveloperAn instance of a service template deployed into an environment
Service InstanceDeveloperA service running in a specific environment (e.g. "payments in prod")
How It Works Core
AWS Proton β€” Platform Team β†’ Developer Self-Service
PLATFORM TEAM Creates templates CFN / Terraform Versioned & approved Publishes to Proton AWS PROTON Template catalog Environment mgmt Version tracking Self-service portal DEVELOPER Picks template Provides app config Deploys service No infra knowledge needed AWS RESOURCES VPC Β· ECS Β· ALB Lambda Β· RDS CodePipeline Provisioned by CFN/TF Platform team defines guardrails β†’ Developers self-serve β†’ Consistent infrastructure
Proton vs Alternatives Core
FeatureProtonService CatalogRaw CloudFormation
PurposeTemplate-driven microservice deploymentPre-approved resource portfoliosInfrastructure as code
AudiencePlatform teams + developersIT admins + end usersDevOps engineers
Template updatesβœ… Auto-detect outdated services, push updatesVersion constraintsManual stack updates
CI/CD integrationβœ… Creates pipeline per service❌ Not built-inVia CodePipeline separately
Terraform supportβœ… Terraform templates❌ CFN only❌ CFN only
Best forMicroservices at scale with platform teamGoverned resource provisioningDirect infrastructure management
Chapter 05 β€” Key Takeaway

Proton is for organisations with a platform team. It separates concerns: platform engineers create versioned, compliant infrastructure templates (CFN or Terraform); developers pick a template and deploy without infra knowledge. Use it when you have many microservices and need consistent, governed infrastructure with self-service developer deployment.

DevOps Services β€” Quick Decision Guide Core
If You Need…Use…
Orchestrate a CI/CD pipeline (source β†’ build β†’ test β†’ deploy)CodePipeline
Compile code, run tests, produce artifactsCodeBuild
Deploy code to EC2, ECS, or Lambda with rollbackCodeDeploy
Host private npm/pip/Maven packagesCodeArtifact
Template-driven microservice deployment with platform teamProton
Store source code (Git)CodeCommit (or GitHub)
Infrastructure as codeCloudFormation / CDK
Store Docker imagesECR