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
Bucket
Create an S3 bucket in your Region; keep Block Public Access ON.
- 2
Upload
aws s3 sync ./site s3://your-bucket --delete.
- 3
CloudFront
Create a distribution with the bucket as origin and Origin Access Control so only CloudFront can read the bucket.
- 4
Default page and errors
Set index.html as the default root object; map 403/404 to a custom error page.
- 5
Deploy script
sync, then aws cloudfront create-invalidation --paths "/*" (or version file names to avoid invalidations).
- 6
Budget alarm
Create an AWS Budget alert so you are emailed before you spend money.
- 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