Static Website Hosting & Lifecycle Rules

Harry · 14 Sep 2026 · 1 views
Advertisement
Advertisement

Host a static site for pennies

Every bucket can serve a static website. Enable Properties → Static website hosting, set the index and error documents, then make objects readable:

aws s3api put-bucket-website --bucket groovygrails-books \
  --website-configuration '{"IndexDocument":{"Suffix":"index.html"},
                          "ErrorDocument":{"Key":"404.html"}}'

# plus a bucket policy allowing public reads:
#   "Action":"s3:GetObject", "Resource":"arn:aws:s3:::groovygrails-books/*"

You now have a free static site (a React/Vue build, an SPA, docs) served over HTTPS if you put CloudFront in front — a classic low-cost deployment.

Lifecycle rules keep it cheap

aws s3api put-bucket-lifecycle-configuration --bucket groovygrails-books \
  --lifecycle-configuration '{
    "Rules": [{
      "ID": "move-noncurrent-to-glacier",
      "Status": "Enabled",
      "Filter": {},
      "NoncurrentVersionTransitions": [{
        "NoncurrentDays": 30, "StorageClass": "GLACIER"
      }],
      "NoncurrentVersionExpiration": { "NoncurrentDays": 365 }
    }]
  }'

Non-current versions move to cheap GLACIER after a month and expire after a year — versioning safety without the storage bill. That closes the AWS S3 story: buckets → objects → SDK → presigned URLs → static hosting + lifecycle.

Share this post:

Comments (0)

Please login or register to comment.