How to Host a Static Site on AWS S3 with CloudFront Integration

I'm Zin Lin Htet. Who love to learn and share about Linux, Cloud, Docker and K8s. Currently working as a DevOps Engineer at one of the famous Fintech Company in Myanmar.
Search for a command to run...

I'm Zin Lin Htet. Who love to learn and share about Linux, Cloud, Docker and K8s. Currently working as a DevOps Engineer at one of the famous Fintech Company in Myanmar.
No comments yet. Be the first to comment.
Today, I want to introduce Dozzle, a web-based tool for viewing container logs in real time. In this tutorial, I utilized AWS Lightsail with Ubuntu to host the Docker engine. I used a Cloudflare domai

Building a secure, scalable containerized application on AWS using ECS Fargate, RDS PostgreSQL, and GitHub Actions CI/CD

Today, I want to explain the difference between a task role and an execution role in AWS ECS. Yesterday, I set up AWS ECS for a UAT environment and defined both roles. Let me clarify what a task role

Today, we will learn how to set up a backend API container with PostgreSQL on Kubernetes. In this tutorial, you will learn how to write a multi-stage Docker file, install the MetalLB load balancer, set up the Rancher local path provisioner for storag...

Today I would like to share how to configure GitHub Actions OIDC with AWS. In this lab, you will learn why we use OIDC for AWS. Traditionally, we use an AWS Access Key ID and Secret Access Key as the authentication method to communicate with AWS serv...

One of my developers created a website for our company's landing page. After finishing it, he asked me how to host the website on AWS. I decided to help him with the hosting process. Since our company website is a static site, I chose to host it on S3 and integrate it with CloudFront for CDN and caching.
Let me explain. S3 is used to store static website files such as HTML, CSS, JS, images, and fonts. Another important factor to consider is the cost. S3 is cost-effective because you only pay for storage and requests. I used CloudFront in front of S3 for CDN (Content Delivery Network) and caching. In this setup, I used AWS Certificate Manager for my domain's SSL. ACM provides a free SSL certificate for your domain, and it doesn't require manual renewal. It also offers easy validation with Route 53 or Cloudflare domains.
| Component | Purpose |
| S3 | Static Data |
| CloudFront | CDN and caching |
| ACM | SSL certificate |
| Cloudflare | Domain |







I request for





















I linked the CNAME record to CloudFront's distribution domain name in Cloudflare.

After linking the domain, I uploaded the static website data to S3.





You can see that the SSL certificate is valid for one year and is issued by Amazon.

After completing this lab, remember to delete these cloud resources.




I hope you learn how to host a static website on S3 and integrate it with CloudFront and SSL using the AWS ACM service. And you will learn how to connect a domain in the Cloudflare dashboard. Thank you for taking the time to read this article. Stay tuned and learn together. If you find my article useful, please kindly like and share it.