aws-s3-website
Deploy static website to AWS S3
TLDR
Configure a bucket as a static website
Configure an error page for the website
SYNOPSIS
aws s3 website s3://bucket [--index-document document] [--error-document document] [--delete]
PARAMETERS
--index-document document
Name of index document (e.g., index.html) served as default page.
--error-document document
Name of error document (e.g., error.html) for failed requests.
--delete
Deletes the website configuration from the bucket.
DESCRIPTION
The aws s3 website command (often invoked as part of AWS CLI) enables static website hosting on an Amazon S3 bucket. It sets the bucket's website configuration, specifying an index document served as the default page (e.g., index.html) and an optional error document for 404 responses (e.g., error.html). This turns the bucket into a simple web server accessible via an S3 website endpoint like http://bucket-name.s3-website-region.amazonaws.com.
Use the --delete flag to remove the configuration, disabling website hosting. The command requires AWS credentials with s3:PutBucketWebsite and s3:DeleteBucketWebsite permissions. It uploads no files but configures metadata only.
Ideal for hosting static sites, SPAs, or documentation without servers. Note: public read access must be set separately via bucket policy. In AWS CLI v2, high-level S3 commands like this remain supported, though low-level s3api equivalents exist for advanced control.
After configuration, access your site at the regional endpoint; HTTPS requires CloudFront.
CAVEATS
Requires AWS CLI v1/v2, valid credentials, and S3 permissions. Bucket must exist; does not set public access. Website endpoint is HTTP-only (use CloudFront for HTTPS). Deprecated in favor of s3api in some contexts.
EXAMPLES
Set website: aws s3 website s3://mybucket --index-document index.html --error-document error.html
Delete: aws s3 website s3://mybucket --delete
ENDPOINT
Access via http://<bucket>.s3-website-<region>.amazonaws.com after config.
HISTORY
Introduced in AWS CLI v1 (2013) as high-level S3 command. Persists in v2 (2020+). Reflects S3 static hosting feature launched 2012.


