Learn how to create, configure, and activate a static website hosted in an S3 bucket.
Requirements
- an S3 bucket with an ACL public-read
- your static resources (HTML, CSS, images, js, etc.)
Instructions
Step 1: Uploading website resources
In S3, a bucket is a flat container of objects. It does not provide any hierarchical organization as the file system on your computer does. However, you can create a logical hierarchy by using object key names that imply a folder structure.
Example:
-
index.html
: Object is the root of the bucket. -
doc/page1.html
: Object is in a subfolder.
- HTML pages must be uploaded with text/html as their ContentType.
- CSS files must be uploaded with text/css as their ContentType.
- Make your bucket content publicly available, i.e. all resources must have ACL "public-read".
Step 2: Setting the website configuration for a bucket
The bucket hosting the website and its contents must be publicly accessible, i.e. with READ permission set for all users.
Example:
Using the predefined PUBLIC-READ
ACL at the bucket level:
Applying the predefined PUBLIC-READ
ACL on all the objects:
Step 3: Setting the website configuration for a bucket
To activate website hosting, you will have to upload a website configuration.
Example:
Or
If you use the AWS low-level commands with website-conf.json:
Step 4: Testing the endpoint
Once the website configuration has been successfully uploaded, you can test the endpoint in your web browser. The default endpoint will depend on the region of your bucket.
http://{bucket-name}.s3-website.{region}.io.cloud.ovh.us
- Make sure the region you are hosting your bucket in supports the storage class you choose. You can check the list of supported storage classes by region here.
- By default, OVHcloud S3 Object Storage website endpoints do not support HTTPS. To enable HTTPS, you can use OVHcloud Load Balancer to proxy your website. For more information, see the "Go further" section of this guide.
Go further
For more information and tutorials, please see our other Object Storage support guides or explore the guides for other OVHcloud products and services.