A complete CI/CD pipeline implementation using AWS CodePipeline, demonstrating automated deployment from GitHub to AWS S3 with CloudFront CDN.
- Overview
- Architecture
- Technologies Used
- CI/CD Pipeline
- Project Structure
- Setup Instructions
- Screenshots
- Key Learnings
This project demonstrates a complete CI/CD pipeline implementation using AWS services. It showcases the entire software development lifecycle from code commit to production deployment, featuring:
- β Automated builds on every commit
- β Continuous deployment to AWS S3
- β Global content delivery via CloudFront CDN
- β Infrastructure as Code with buildspec.yml
- β Docker containerization support
Live Demo: [http://daily-drive-cicd.s3-website.ap-south-1.amazonaws.com/]
βββββββββββββββ ββββββββββββββββ βββββββββββββββ ββββββββββββ
β GitHub βββββββΆβ CodePipeline βββββββΆβ CodeBuild βββββββΆβ S3 β
β Repository β β (Source) β β (Build) β β (Deploy) β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ ββββββββββββ
β
βΌ
βββββββββββββββ
β CloudFront β
β (CDN) β
βββββββββββββββ
β
βΌ
End Users
- Source Stage: Triggered on push to
mainbranch - Build Stage: CodeBuild compiles React app using Vite
- Deploy Stage: Static files deployed to S3 bucket
- Distribution: CloudFront serves content globally with HTTPS
- React 18.3.1 - UI library
- Vite 7.2.7 - Build tool and dev server
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Reusable component library
- CodePipeline - CI/CD orchestration
- CodeBuild - Build automation
- S3 - Static website hosting
- CloudFront - Content delivery network
- IAM - Access management
- Docker - Containerization
- Git/GitHub - Version control
- buildspec.yml - Build configuration
- Trigger: Push to GitHub
mainbranch - Provider: GitHub (OAuth connection)
- Output: Source code artifact
- Provider: AWS CodeBuild
- Runtime: Amazon Linux 2, Node.js 20
- Process:
npm ci # Install dependencies npm run build # Build production bundle
- Output: Optimized static files in
dist/
- Provider: Amazon S3
- Action: Upload static files to S3 bucket
- Configuration: Extract files before deploy
- Result: Website accessible via S3 endpoint
version: 0.2
phases:
install:
runtime-versions:
nodejs: 20
commands:
- npm ci
build:
commands:
- npm run build
post_build:
commands:
- ls -la dist/
artifacts:
files:
- '**/*'
base-directory: dist
cache:
paths:
- 'node_modules/**/*'daily-drive/
βββ src/ # React source code
βββ public/ # Static assets
βββ buildspec.yml # CodeBuild configuration
βββ Dockerfile # Docker container config
βββ package.json # Dependencies
βββ vite.config.ts # Vite configuration
βββ tailwind.config.ts # Tailwind CSS config
βββ README.md # This file
- AWS Account with appropriate permissions
- GitHub account
- Node.js 20+ installed locally
# Clone repository
git clone https://github.com/SREEGEETHES/daily-drive.git
cd daily-drive
# Install dependencies
npm install
# Run development server
npm run dev
# Build for production
npm run buildBucket name: daily-drive-website-[unique-id]
Region: Your preferred region
Block public access: OFF
Static website hosting: ENABLED
Index document: index.html
Error document: index.html
Origin: S3 bucket website endpoint
Viewer protocol: Redirect HTTP to HTTPS
Default root object: index.html
Custom error response: 404 β /index.html (200)
Project name: daily-drive-build
Source: GitHub repository
Environment: Amazon Linux 2, Node.js 20
Buildspec: buildspec.yml
Artifacts: S3 bucket
Pipeline name: daily-drive-pipeline
Source: GitHub (OAuth)
Build: CodeBuild project
Deploy: S3 bucket
- β Configured multi-stage CI/CD pipeline with CodePipeline
- β Automated builds using CodeBuild with custom buildspec
- β Deployed static websites to S3 with proper permissions
- β Set up CloudFront for global CDN distribution
- β Managed IAM roles and policies for service integration
- β Implemented Infrastructure as Code (buildspec.yml)
- β Automated deployment on every commit
- β Configured build caching for faster builds
- β Set up proper artifact management
- β Implemented SPA routing with S3 error documents
- β Debugged S3 deployment path issues
- β Configured proper S3 static website hosting
- β Resolved CloudFront caching and routing issues
- β Fixed CodePipeline artifact extraction settings
Every push to the main branch automatically:
- Triggers CodePipeline
- Pulls latest code from GitHub
- Builds production bundle with Vite
- Deploys to S3
- Invalidates CloudFront cache (if configured)
- Makes changes live in ~2-3 minutes
Demo: Make a change, push to GitHub, and watch it deploy automatically!
The project includes a multi-stage Dockerfile for containerized deployment:
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
# Production stage
FROM nginx:alpine
COPY --from=builder /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]Build and run:
docker build -t daily-drive .
docker run -p 8080:80 daily-drive- Build Time: ~1-2 minutes
- Deployment Time: ~30 seconds
- Total Pipeline Duration: ~2-3 minutes
- CloudFront Edge Locations: 400+ globally
- Cost: ~$1-5/month (AWS Free Tier eligible)
- GitHub Repository: https://github.com/SREEGEETHES/daily-drive
- Live Demo: http://daily-drive-cicd.s3-website.ap-south-1.amazonaws.com/
Jasprit Sree
- GitHub: @SREEGEETHES
This project is for educational and portfolio demonstration purposes.
- AWS Documentation for comprehensive guides
- React and Vite communities for excellent tooling
- shadcn/ui for beautiful component library
β If you found this project helpful, please consider giving it a star!
