Deploying My Portfolio with AWS S3 & CloudFront

A complete journey of deploying my static portfolio using S3, adding CDN with CloudFront, connecting a custom domain from Namecheap, and enabling HTTPS.

After building my portfolio website, I wanted to deploy it in a way that reflects real-world DevOps practices. Instead of using shared hosting, I chose AWS to host and scale my static site.

In this blog, I’ll walk through how I deployed my portfolio using S3, connected it to CloudFront for CDN, and linked it with my custom domain.

Why I Chose S3 for Hosting

My portfolio is a static website (HTML, CSS, JS), so I didn’t need a backend server. S3 is perfect for this type of application.

  • Very low cost
  • No server maintenance
  • Highly scalable
S3 static hosting is one of the simplest and cheapest ways to deploy a website in AWS.

Step 1: Upload Website to S3

I created an S3 bucket and uploaded all my files:

  • index.html
  • blog pages
  • css, js, images folders

Then I enabled static website hosting and made the files public.

http://bucket-name.s3-website-region.amazonaws.com

At this point, my website was live, but it had two problems:

  • No HTTPS
  • No CDN (slow for global users)

Step 2: Add CloudFront CDN

To improve performance and security, I created a CloudFront distribution and connected it to my S3 bucket.

User → CloudFront → S3

This allowed:

  • Global caching (faster loading)
  • HTTPS support
  • Better reliability

Important Lesson

At first, my site wasn’t loading correctly through CloudFront. The issue was that I forgot to set the default root object.

Default Root Object = index.html

Without this, CloudFront didn’t know what to serve when accessing the root URL.

Step 3: Add Custom Domain (Namecheap)

I purchased a domain from Namecheap and configured DNS to point to CloudFront.

www → d3ue5nkap6qeu1.cloudfront.net

Since root domains don’t support CNAME in Namecheap, I redirected:

mhkhan.site → www.mhkhan.site

Step 4: Enable HTTPS with ACM

I used AWS Certificate Manager (ACM) to create a free SSL certificate.

  • Requested certificate in us-east-1
  • Validated via DNS
  • Attached to CloudFront

After deployment, my site became fully secure:

https://www.mhkhan.site

Final Architecture

User → Domain (Namecheap) → CloudFront (CDN + HTTPS) → S3 (static website)

What I Learned

  • How static hosting works in S3
  • How CloudFront improves performance
  • How DNS connects domain to infrastructure
  • Importance of HTTPS and certificates

This project helped me understand how real-world frontend deployment works in cloud environments.

Final Thoughts

Deploying a website using S3 and CloudFront is simple once you understand the flow, but it also teaches important DevOps concepts like CDN, DNS, and security.

This setup is not just for portfolios — it’s used in production for many large-scale applications.


← Back to Blogs