Static website in Yandex Object Storage

To host a static website in Object Storage:

  1. Create a bucket with public access
  2. Configure the website's home page and the error page
  3. Configure use of your own domain
  4. Upload the website files

1. Create a public bucket

To create a bucket for static website files:

  1. Go to the Yandex.Cloud management console and select the folder where you want to perform the operations.

  2. On the folder page, click Create resource and select Bucket.

  3. In the Name field, enter the bucket name (for instance, www.example.com). The bucket name will be used in the website domain name: https://www.example.com.website.yandexcloud.net.

    The name must meet the following requirements:

    • The length of the name 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).

    Note

    If you plan to use your own domain for the website, the bucket name must exactly match the name of your domain, and this must be a third-level or higher domain.

  4. Specify the maximum size of the bucket in GB.

  5. Choose Public access to the bucket.

  6. Click Create bucket.

2. Configure the website's home page and the error page

You should upload and configure the index page and error page. To do this:

  1. Create the following files on your computer:
    • index.html with the text Hello world!. The file content will be displayed when accessing the website's home page.
    • error.html with the text Error!. The file content will appear in the website responses with 4ххх errors.
  2. Go to your bucket's page, open the Objects tab, and click Upload. In the window that opens, select the created files and click the confirmation button.
  3. Click Upload.
  4. Open the Website tab on your bucket page.
  5. Select Hosting.
  6. In the Home page field, specify index.html.
  7. In the Error page field, specify error.html.
  8. Click Save.
  9. Make sure the website's home page opens. To do this, connect to the website through a browser via a link like https://{bucket-name}.website.yandexcloud.net.
  10. Make sure the error page opens. To do this, connect to the website through a browser via a link like https://{bucket-name}.website.yandexcloud.net/error-check.

3. Configure 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. This must be a third-level or higher domain (for example, www.example.com).
  • Create a CNAME (Canonical Name) record at your DNS provider or on your own DNS server.

Note

The website is accessible only over HTTP, for instance, http://www.example.com or http://www.example.com.website.yandexcloud.net.

The instructions below describe how to configure an external DNS service using as an example reg.ru for domain names www.example.com.website.yandexcloud.net and www.example.com:

  1. Go to the bucket page and open the Website tab in the management console and find the website address.
  2. 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.
  3. Follow the Zone management link in the Domain management section.
  4. Create a CNAME record with the following field values:
    • Subdomain: www.
    • Canonical name: website address with a dot at the end (for instance, www.example.com).website.yandexcloud.net..
  5. Wait 15-20 minutes for DNS record changes to take effect. The waiting time may differ for your DNS service.

4. Upload the website files to the bucket

After you configure and test the website's availability, upload the remaining files that are necessary for website operation. Do that via the management console, API, or one of the available tools for working with Object Storage.