Static website in Yandex Object Storage
To host a static website in Object Storage:
- Before you start.
- Create a bucket with public access.
- Configure the website homepage and error page.
- Set up using your own domain.
- Upload the website files.
- Check that the website is running.
If you no longer need the website, delete its files from storage.
Before you start
Before using Yandex Object Storage, sign up for Yandex.Cloud and create a billing account:
- Go to the management console. Then log in to Yandex.Cloud or sign up if don't already have an account.
- On the billing page, make sure you linked a billing account, and it has the
TRIAL_ACTIVEstatus. If you don't have a billing account, create one.
If you have an active billing account, you can create or select a folder to place your bucket in. Go to the Yandex.Cloud homepage and select or create a folder where you want to create a bucket. Learn more about the resource hierarchy in Yandex.Cloud.
Required paid resources
The cost of hosting a static website includes:
- A fee for storing static website data (see Yandex Object Storage pricing).
- A fee for data operations (see Yandex Object Storage pricing).
- The cost of outgoing traffic from Yandex.Cloud to the internet (see Yandex Object Storage pricing).
Create 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 a name for the bucket (for instance,
www.example.com). The bucket name will be used in the website domain name:
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).
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.
Specify the maximum size of the bucket in GB.
Choose Public access to the bucket.
Click Create bucket.
Configure the website homepage and error page
You should upload and configure the index page and error page. To do this:
- Create the following files on your computer:
index.htmlwith the text
The file content gets displayed when accessing the home page of the website.
error.htmlwith the text
The file content appears in website responses with
- 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.
- Click Upload.
- Open the Website tab on your bucket page.
- Select Hosting.
- In the Home page field, specify
- In the Error page field, specify
- Click Save.
- Make sure the website's home page opens. To do this, access the website from a browser via a link like
- Make sure the error page opens. To do this, access the website from a browser via a link like
Set up using 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,
- Create a CNAME (Canonical Name) record at your DNS provider or on your own DNS server.
By default, the website is accessible only over HTTP, for instance,
http://www.example.com.website.yandexcloud.net. To provide HTTPS support for your website, upload your own security certificate to Object Storage.
The instructions below describe how to configure an external DNS service using reg.com for the
www.example.com domain names:
- Find the website address on the Website tab of the bucket page in the management console.
- 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.
Upload the website files
After you configure and test the website's availability, upload the remaining files that are necessary for website operation. To do this, use the management console, API, or one of the available tools for working with Object Storage.
Check that the website is running
To make sure the website is running, open the following address in your browser
How to delete created resources
To stop paying for file storage, delete the uploaded files.