π Amazon S3 β Static Website Hosting
π Overview
S3 can host static websites (HTML, CSS, JS, images) and make them accessible over the internet.
No server needed β S3 serves the files directly.
π Website URL Format
Depends on the AWS region:
Format | Example |
|---|---|
Dash format |
|
Dot format |
|
Both work the same way β only difference is a dash vs a dot before the region.
No need to memorize which one; just recognize both are valid. β
βοΈ How It Works
πͺ£ Create an S3 bucket, upload your website files (HTML, images, etc.)
π§ Enable Static Website Hosting on the bucket
π Access the site via the generated URL (e.g.,
demo-bucketinus-west-2)
π« Important: Public Access Required
Static website hosting will not work unless the bucket allows public reads.
β οΈ If you get a 403 Forbidden error β the bucket is not public yet.
β Fix: Attach an S3 Bucket Policy that allows public
GetObjectaccess.
π― Key Takeaway
Enabling static website hosting alone isn't enough β you must also attach a bucket policy allowing public reads, or visitors will get a 403 error. π