Creating a CDN resource with an origin server in Yandex Cloud
Note
For details on creating an origin group and a CDN resource with other origin types, see these guides:
Set up content distribution over a CDN with a Yandex Compute Cloud VM instance or Yandex BareMetal server as the origin:
Getting started
-
Make sure you have a domain name and can access the DNS settings on your DNS hosting provider’s website. This is usually the company that registered your domain.
-
Navigate to the management console
and log in to Yandex Cloud or sign up if not signed up yet. -
If you do not have a folder yet, create one.
Learn more about creating a folder
-
In the management console
, in the top panel, click or and select the cloud. -
To the right of the cloud name, click
. -
Select
Create folder.
-
Give your folder a name. The naming requirements are as follows:
- Length: between 3 and 63 characters.
- It can only contain lowercase Latin letters, numbers, and hyphens.
- It must start with a letter and cannot end with a hyphen.
-
Optionally, specify the description for your folder.
-
Select Create a default network. This will create a network with subnets in each availability zone. Within this network, you will also have a default security group, within which all network traffic will be allowed.
-
Click Create.

-
Create a web server
If you do not have a web server yet:
-
Install a web server on the new server or VM instance, e.g., Apache
or nginx .When installing the web server on a VM instance, remember to associate it with a security group that allows incoming and outgoing network traffic on the appropriate ports, e.g.,
80and443. For more information, see Creating a security group. -
Upload content to your web server.
-
Make sure your web server is available from the internet.
To check the availability of a web server created on a Compute Cloud VM instance or BareMetal server, enter the public IP address of the instance or server in the address bar, e.g.,
http://198.51.100.27/As a result, you should see the main page of the application deployed on the server in your browser window.
Learn more about creating a website based on a Compute Cloud VM instance here.
Create a CDN resource
-
Go to Cloud CDN.
-
In the
CDN resources tab, click Create resource. -
Under Main settings, configure the basic CDN resource settings:
-
Under Content:
-
Enable Enable access to content.
-
In the Content query field, select
From one origin. -
In the Origin type field, select
Server. -
In the Origin domain name field, specify the public IP address of your VM instance or BareMetal server with a web server.
-
In the Origin request protocol field, select
HTTP. -
In the Domain name field, specify the primary domain name you will use in your website links to CDN-hosted content, e.g.,
cdn.example.com.Alert
You cannot change the primary domain name used for content distribution after creating a CDN resource.
-
-
Under Additional settings:
-
In the Redirect clients field, select
Don't use. -
In the Certificate type field, select
Don't use. -
In the Host header field, select
Primary domain name.The Host header field value must match the name of the virtual host configured on the origin server.
-
-
-
Click Continue.
-
Under Caching, HTTP headers and methods, and Advanced, leave the default settings, then click Continue. You can configure these settings later, if required.
Wait until the resource is created. It may take up to 15 minutes.
Tip
We recommend prefetching large files (over 200 MB) into the CDN server cache. This is an optional step. If skipped, such content will be automatically cached on CDN servers when first accessed by the end user.
Configure a CNAME for your domain
-
In the
Overview tab on the CDN resource page, under DNS settings, copy the generated domain name ine1b83ae3********.topology.gslb.yccdn.ruformat. -
Navigate to your domain’s DNS settings on your DNS hosting provider’s website.
-
Edit the relevant CNAME record so that it points to the previously copied URL in the
.topology.gslb.yccdn.rudomain. For example, if the content delivery domain name you specified when creating your CDN resource iscdn.example.com, you need to create the following CNAME record or use it to replace the current record forcdn:cdn CNAME e1b83ae3********.topology.gslb.yccdn.ru.Note
Do not use an ANAME resource record with domain names for content distribution; otherwise, the end user will get a response from a CDN server not linked to the user geolocation. The response will always be the same for all users.
Test the CDN
-
Wait for the DNS records to update. This may take a few hours.
-
Make sure the
cdnCNAME record in the DNS server's cache points to the generated URL, e.g.,e1b83ae3********.topology.gslb.yccdn.ru. -
Open the website in your browser to make sure it is working. Here is an example:
http://cdn.example.com/index.html