AWS CodePipeline and Developer Tools

AWS Developer Tools is a suite of services that helps teams build, test, and deploy applications automatically. At the center of this suite is AWS CodePipeline — a continuous delivery service that automates the release process from code commit to production deployment. Together, these tools implement CI/CD (Continuous Integration and Continuous Delivery) practices entirely within AWS.

What Is CI/CD?

Continuous Integration (CI): Every time a developer pushes code to a shared repository, an automated process builds the code and runs tests. Problems are caught immediately — not weeks later.

Continuous Delivery (CD): After code passes all tests, the deployment process automatically prepares and (optionally) pushes the release to production. Deployments become routine, predictable events rather than stressful manual processes.

Developer pushes code
         |
[CI: Build + Test automatically]
         |
    Tests pass?
    /         \
  YES          NO → alert developer, stop pipeline
   |
[CD: Deploy to staging → approve → deploy to production]

AWS Developer Tools Overview

ServicePurposeEquivalent Outside AWS
CodeCommitManaged Git repository hostingGitHub, GitLab, Bitbucket
CodeBuildCompile code, run tests, produce build artifactsJenkins, CircleCI, GitHub Actions
CodeDeployAutomate deployments to EC2, Lambda, ECS, on-premises serversSpinnaker, Octopus Deploy
CodePipelineOrchestrate the full CI/CD workflow end-to-endJenkins Pipelines, GitHub Actions Workflows
CodeArtifactStore and share software packages (npm, Maven, PyPI)JFrog Artifactory, Nexus Repository
Cloud9Browser-based IDE with AWS integrationVS Code Remote, Gitpod

AWS CodeCommit

CodeCommit is a fully managed private Git repository service hosted within AWS. It supports standard Git commands and workflows. Repositories are encrypted at rest and in transit. Access is controlled through IAM policies — the same credentials used for all other AWS services.

Note: Many teams use GitHub or GitLab as the source repository and integrate them directly with CodePipeline instead of using CodeCommit.

AWS CodeBuild

CodeBuild is a fully managed build service. It pulls source code from a repository, runs the commands defined in a buildspec.yml file, and produces output artifacts (compiled binaries, container images, deployment packages). CodeBuild scales automatically — no build servers to manage or maintain.

buildspec.yml

The buildspec.yml file lives in the root of the code repository and defines the build commands in phases:

version: 0.2

phases:
  install:
    commands:
      - echo Installing dependencies
      - npm install

  pre_build:
    commands:
      - echo Running tests
      - npm test

  build:
    commands:
      - echo Building the application
      - npm run build

  post_build:
    commands:
      - echo Build complete

artifacts:
  files:
    - '**/*'
  base-directory: build

Phases execute in order. If any command fails, the build fails and the pipeline stops.

AWS CodeDeploy

CodeDeploy automates deployments to various compute targets. It handles deployment to EC2 instances, Lambda functions, ECS services, and even on-premises servers — using a unified process.

CodeDeploy Deployment Strategies

StrategyDescriptionDowntime
In-Place (EC2)Deploy new version on existing instances one batch at a timePartial — depends on batch size
Blue/Green (EC2)Launch new instances with new code, switch traffic, terminate oldNone
Canary (Lambda/ECS)Shift small % of traffic to new version first, monitor, then shift allNone
Linear (Lambda/ECS)Gradually shift traffic in equal increments over timeNone
All-at-Once (Lambda/ECS)Shift all traffic immediatelyRisk of full outage if new version has bugs

appspec.yml

CodeDeploy uses an appspec.yml file in the root of the deployment package to define lifecycle event hooks — scripts to run before and after deployment steps.

version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/myapp

hooks:
  BeforeInstall:
    - location: scripts/stop_server.sh
  AfterInstall:
    - location: scripts/install_dependencies.sh
  ApplicationStart:
    - location: scripts/start_server.sh
  ValidateService:
    - location: scripts/health_check.sh

AWS CodePipeline

CodePipeline orchestrates the entire CI/CD flow. It connects the source repository, CodeBuild, CodeDeploy, and any manual approval steps into a sequential automated pipeline. Every time code is pushed, the pipeline runs automatically from start to finish.

Pipeline Stages and Actions

A pipeline consists of stages. Each stage has one or more actions. Actions can be sequential or parallel within a stage.

+-------------------------------------------------------------------+
|                        CodePipeline                               |
|                                                                   |
| [SOURCE]         [BUILD]          [TEST]       [DEPLOY]          |
|   |                 |                |              |             |
| GitHub          CodeBuild        CodeBuild      CodeDeploy        |
| (on push)     (compile+lint)    (run tests)    (to production)   |
|                                                     |             |
|                                          [Manual Approval]        |
|                                          (optional gate)         |
+-------------------------------------------------------------------+

Supported Source Providers

  • AWS CodeCommit
  • GitHub (via OAuth or CodeStar connection)
  • GitHub Enterprise
  • GitLab
  • Bitbucket
  • Amazon S3 (for artifact-triggered pipelines)

Manual Approval Actions

A manual approval action pauses the pipeline and sends an SNS notification (email or SMS) to a reviewer. The pipeline resumes only after an authorized person approves it in the console or via CLI. This is commonly added before production deployments to require human sign-off.

Complete CI/CD Pipeline Example — Node.js API to ECS

1. Developer pushes code to GitHub (feature → main branch)
           |
2. CodePipeline SOURCE stage triggered
           |
3. CodeBuild BUILD stage:
   - npm install
   - npm test (unit tests)
   - docker build
   - docker push to ECR
           |
4. Manual Approval notification → tech lead reviews and approves
           |
5. CodeDeploy DEPLOY stage:
   - Blue/Green deployment to ECS Fargate
   - Canary: 10% traffic to new version
   - CloudWatch alarms monitored
   - If healthy after 5 min → 100% traffic switched
   - If alarm fires → automatic rollback to old version

AWS CodeArtifact

CodeArtifact is a managed artifact repository for software packages. It stores packages used as dependencies in builds — npm packages for JavaScript projects, Maven packages for Java, pip packages for Python, and others. CodeBuild pulls dependencies from CodeArtifact instead of the public internet — improving build speed, security, and reliability.

Summary

  • AWS Developer Tools (CodeCommit, CodeBuild, CodeDeploy, CodePipeline) implement CI/CD entirely within AWS.
  • CodeBuild compiles code, runs tests, and produces build artifacts based on buildspec.yml commands.
  • CodeDeploy automates deployments to EC2, Lambda, and ECS with strategies including In-Place, Blue/Green, Canary, and Linear.
  • CodePipeline orchestrates the full release workflow — from source code push to production deployment — with optional manual approval gates.
  • GitHub, GitLab, and Bitbucket integrate directly with CodePipeline as source providers — CodeCommit is not required.

Leave a Comment