🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101

Host a website on AWS (S3 + CloudFront)

Deploy your portfolio as a fast, HTTPS, globally cached site on AWS and automate updates.

Beginner⏱ 4–6 hoursđŸĒœ 7 stepsAWS S3CloudFrontAWS CLI

What you'll learn

  • ◆Object storage and CDNs
  • ◆Least-privilege access (Origin Access Control)
  • ◆Cache invalidation and costs

What you'll build

  • ✓Private S3 bucket served only via CloudFront
  • ✓HTTPS
  • ✓One-command deploy script
  • ✓Cost under free-tier limits for small sites

Step-by-step guide

  1. 1

    Bucket

    Create an S3 bucket in your Region; keep Block Public Access ON.

  2. 2

    Upload

    aws s3 sync ./site s3://your-bucket --delete.

  3. 3

    CloudFront

    Create a distribution with the bucket as origin and Origin Access Control so only CloudFront can read the bucket.

  4. 4

    Default page and errors

    Set index.html as the default root object; map 403/404 to a custom error page.

  5. 5

    Deploy script

    sync, then aws cloudfront create-invalidation --paths "/*" (or version file names to avoid invalidations).

  6. 6

    Budget alarm

    Create an AWS Budget alert so you are emailed before you spend money.

  7. 7

    Clean up

    Know how to delete the distribution and bucket when you no longer need them.

🚀 Make it stand out

  • +Custom domain with a certificate
  • +Deploy from GitHub Actions
  • +Security headers with a CloudFront response headers policy