Static website in Yandex Object Storage
To host a static website in Object Storage:
- Create a bucket with public access
- Configure the website's home page and the error page
- Configure use of your own domain
- Upload the website files
Creating a public bucket
To create a bucket for static website files:
Go to the Yandex.Cloud management console and select the folder where you want to perform the operations.
On the folder page, click Create resource and select Bucket.
In the Name field, enter the bucket name, for instance,
example.com. The bucket name will be used in the website domain name:
The name must meet the following requirements:
- The name length must be from 3 to 63 characters.
- The name may contain lowercase Latin letters, numbers, hyphens, and periods.
- The first and last characters must be letters or numbers.
- Characters to the right and left of the period must be letters or numbers.
- The name must not look like an IP address (for example, 10.1.3.9).
If you plan to use your own domain for the website, the bucket name must exactly match the name of your domain.
Specify the maximum bucket size in GB.
Select Public access to the bucket.
Click Create bucket.
Configuring your website's home page and error page
You should upload and configure the index page and error page. For that:
- Create the following files on your computer:
index.htmlwith the text
Hello world!. The file content will be displayed when accessing the website's home page.
error.htmlwith the text
Error!. The file content will appear in the website responses with
- On your bucket page's Objects tab, click Upload. In the window that opens, select the required files and click the confirmation button.
- Click Upload.
- Open the Website tab on your bucket page.
- Select Hosting.
- In the Home page field, specify
- In the Error page page, specify
- Click Save.
- Make sure the website's home page opens. For that, connect to the website through a browser via a link like
- Make sure the error page opens. For that, connect to the website through a browser via a link like
Configuring use of your own domain
To use your own domain for a website:
- Make sure the bucket name is exactly the same as the domain name.
- Create a CNAME (Canonical Name) record at your DNS provider or on your own DNS server.
If you use your own domain, the website will only be accessible over HTTP, for instance,
You can use HTTPS when accessing the website at Object Storage addresses, for instance,
The instructions below describe how to configure an external DNS service using as an example reg.ru for domain names
- On the bucket page's Website tab in the management console, find the website address.
- Log in to the control panel of the external DNS service. Go to the list of your domains and click on the required domain name.
- Follow the Zone management link in the Domain management section.
- Create a CNAME record with the following field values:
- Canonical name: website address with a dot at the end, for instance,
- Wait 15-20 minutes for DNS record changes to take effect. The waiting time may differ for your DNS service.
Uploading website files
After you configure and test the website's availability, upload to the bucket the remaining files necessary for website operation. Do that via themanagement console, API, or one of the available tools for working with Object Storage.