DEV Community

Cover image for 🌐DevOps and Cloud Project: Static Website Hosting with AWS S3 + CloudFront + CI/CD
Ritesh Singh
Ritesh Singh

Posted on

🌐DevOps and Cloud Project: Static Website Hosting with AWS S3 + CloudFront + CI/CD

PROJECT OVERVIEW

This project demonstrates how to host a static website on Amazon S3, deliver it globally with CloudFront CDN, and automate deployments using GitHub Actions.


πŸš€ Features

  • βœ… Static website hosting on Amazon S3
  • βœ… CloudFront CDN for global fast delivery + HTTPS
  • βœ… CI/CD pipeline with GitHub Actions (auto-deploy on push)
  • βœ… Cache invalidation so updates are live instantly
  • βœ… Secure Origin Access Control (OAC) β†’ S3 is private, only CloudFront can access

πŸ—οΈ Architecture Workflow

πŸ”Ή Request Flow

User β†’ CloudFront (Edge Cache) β†’ [If cache miss] β†’ S3 Bucket β†’ CloudFront β†’ User

πŸ”Ή Deployment Flow

Developer β†’ GitHub Repo β†’ GitHub Actions β†’ S3 Bucket β†’ CloudFront β†’ End User


βš™οΈ Setup Instructions

1️⃣ Create S3 Bucket

  • Go to AWS S3 Console
  • Create a bucket (region example: ap-south-1)
  • Keep Block Public Access = ON
  • Upload your static website files (index.html, CSS, JS, images, etc.)


2️⃣ Create CloudFront Distribution

  • Open CloudFront Console β†’ Create Distribution
  • Origin = your S3 bucket
  • Use Origin Access Control (OAC) (so only CloudFront can read from S3)
  • Copy the CloudFront domain (e.g., d1234abcd.cloudfront.net)




3️⃣ Configure GitHub Actions


πŸ”‘ Secrets Setup in GitHub

Go to GitHub Repo β†’ Settings β†’ Secrets and variables β†’ Actions β†’ New repository secret

Add:

  • AWS_ACCESS_KEY_ID

  • AWS_SECRET_ACCESS_KEY


🌍 Access Your Website

Default β†’ (your CloudFront domain)

Optional β†’ Add Route 53 + ACM SSL to use a custom domain

πŸ“Œ Future Improvements

Add CloudWatch monitoring & logging

Add Route 53 + SSL certificate for a custom domain

Extend pipeline with tests before deployment

πŸ† Learning Outcome

By completing this project, I learned:

How to use AWS S3 for static hosting

How CloudFront works as a CDN with OAC

How to build a CI/CD pipeline with GitHub Actions

How to automate deployments and cache invalidations


πŸ”— Keywords: AWS, S3, CloudFront, GitHub Actions, CI/CD, DevOps, Cloud
πŸš€Github

⚑ Now, every time I push code to GitHub, my website auto-deploys to AWS with CloudFront CDN πŸš€

Top comments (0)