Building a CI/CD Pipeline with AWS CodeCommit & CodePipeline to Deploy a Static Website on S3
- Siddhesh Kadam

- 3 minutes ago
- 2 min read

AWS CodePipeline provides a native AWS continuous deployment pipeline to manage web application deployments from the source code repository to the deployment of our web application.
In this blog, we will walk through setting up AWS CodePipeline to continuously deploy our web application to S3. We will walk through the prerequisites to set up our pipeline by setting up our source code repository with AWS CodeCommit and creating an S3 bucket to host static web applications. Finally, we will set up our continuous code pipeline with AWS CodePipeline and deploy our web application to S3.
AWS CodeCommit – Source control
AWS CodePipeline – Automation engine
Amazon S3 – Static website hosting
By the end, every commit will be automatically deployed to your live website.
Architecture Overview

Step 1 – Create an S3 Bucket for Website Hosting
Create a bucket that will host your static website.
Bucket name: builddevops-sample-test
Region: us-east-1
Disable Block all public access
Enable Static website hosting
Index document: index.html
📸 Screenshot: S3 Bucket Created

Step 2 – Configure Public Access with Bucket Policy
To allow public access, add the following bucket policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Statement1",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::builddevops-sample-test/*"
}
]
}
📸 Screenshot: AWS Policy Generator


Step 3 – Create CodeCommit Repository
Now create a repository to store your website files.
Repository name: builddevops-static-site
Files added:
index.html
mount.jpg
📸 Screenshot: CodeCommit Repository


Step 4 – Create a New CodePipeline
Navigate to:Developer Tools → CodePipeline → Create pipeline
📸 Screenshot: Pipeline Settings Page

Pipeline name
Execution mode
Service role creation
Step 5 – Add Source Stage (CodeCommit)
Configure the source stage:
Source provider: AWS CodeCommit
Repository: builddevops-static-site
Branch: main
Enable:
EventBridge trigger
Output artifact:
CodePipeline default
📸 Screenshot: Add Source Stage

Step 6 – Skip Build Stage
Since this is a static website, no build step is required.
Click Skip build stage.
This keeps the pipeline simple and fast.
Step 7 – Add Deploy Stage (Amazon S3)
Configure deployment:
Deploy provider: Amazon S3
Bucket name: builddevops-sample-test
Extract files before deploy: Yes
This copies your website files directly into S3.
Step 8 – Pipeline Created Successfully
Once saved, your pipeline will look like this:
Source (CodeCommit) → Deploy (S3)📸 Screenshot: CodePipeline Success View

Green check on Source
Green check on Deploy
This confirms the CI/CD pipeline is live.
Step 9 – Verify the Live Website
Open your S3 website endpoint:
📸 Screenshot: Live Website

Your page confirms the pipeline is working end-to-end.
Conclusion
With just CodeCommit + CodePipeline + S3, you’ve built a clean, production-ready CI/CD pipeline for static websites.




















Comments