Skip to content

sundeep-dayalan/AWS-CodePipeline-ContinuesIntegration

Repository files navigation

AWS CodePipeline — Continuous Integration

Automated CI/CD pipeline from GitHub to AWS EC2

Zero-downtime Node.js deployments with CodePipeline, CodeDeploy, and shell lifecycle hooks

AWS CodePipeline CodeDeploy Node.js Shell


Overview

A production-ready CI/CD pipeline that automatically deploys a Node.js/Express API from GitHub to AWS EC2 using AWS CodePipeline and CodeDeploy. Includes lifecycle hooks for graceful stop/start, enabling zero-downtime deployments.


Pipeline Architecture

flowchart LR
    GH[GitHub\nSource Push] --> CP[AWS CodePipeline\nOrchestrator]
    CP --> CB[AWS CodeBuild\nBuild and Test]
    CB --> CD[AWS CodeDeploy\nDeployment Agent]
    CD --> S1[before_install.sh\nPrep environment]
    S1 --> S2[application_stop.sh\nStop old process]
    S2 --> S3[application_start.sh\nStart new version]
    S3 --> EC2[AWS EC2\nNode.js Server Live]

    style GH fill:#24292e,color:#fff,stroke:none
    style CP fill:#FF9900,color:#fff,stroke:none
    style CD fill:#FF9900,color:#fff,stroke:none
    style EC2 fill:#232F3E,color:#fff,stroke:none
Loading

Tech Stack

AWS CodePipeline AWS CodeDeploy AWS EC2 Node.js Express Bash


Repository Structure

├── app.js                        # Express API entry point
├── package.json
├── appspec.yml                   # CodeDeploy lifecycle config
└── scripts/
    ├── before_install.sh         # Install dependencies, prep environment
    ├── application_stop.sh       # Gracefully stop running process
    └── application_start.sh      # Start new application version

Deployment Flow

  1. Push to GitHub — triggers CodePipeline automatically
  2. CodeBuild — installs dependencies and runs tests
  3. CodeDeploy — pulls the build artifact to the EC2 instance
  4. before_install.sh — prepares the server environment
  5. application_stop.sh — gracefully stops the current process
  6. application_start.sh — starts the new version

Key Concepts Demonstrated

  • AWS CodePipeline — multi-stage CI/CD orchestration
  • AWS CodeDeploy — in-place deployment to EC2 with appspec.yml
  • Lifecycle hooksBeforeInstall, ApplicationStop, ApplicationStart
  • Zero-downtime deploys — graceful process management
  • Infrastructure as Code — all deployment config version-controlled in Git

Getting Started

  1. Fork or clone this repo
  2. Set up an EC2 instance with the CodeDeploy agent installed
  3. Create a CodePipeline connected to your GitHub repo
  4. Push a commit — the pipeline triggers automatically

Author

Sundeep Dayalan · Portfolio · LinkedIn

About

CI/CD from Github to AWS EC2 Backend API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors