CDN resource
A resource is the main logical entity in Yandex Cloud CDN that lets you configure and manage content distribution from origins over a CDN.
To start distributing content over a CDN, create a resource by following the instructions and specify the following in it:
- The origin or origin group that hosts your content.
- Domain names for content distribution.
- Basic settings for exchanging data between clients and the CDN and between the CDN and origins.
After creating a resource, you can also configure for it:
- Caching.
- HTTP headers and methods (see the instructions).
- Processing of cross-domain queries (CORS).
- Compression and segmentation of content.
You can restrict access to the resource with secure tokens and an IP-based access policy.
You can configure redirection of requests from a CDN resource to an origin by changing the request URIRewrite
rule.
For a resource in Cloud CDN, you can specify additional settings provided by EdgeCenter, a CDN provider. For a complete description of its features, see the CDN provider's API documentation
Resource settings apply a short while after you create or update the resource.
Domain names for content distribution
Domain names for content distribution are used in client requests to CDN servers. For example, to make the styles/common.css
file available at cdn.example.com/styles/common.css
, you need to enter cdn.example.com
as a domain name.
Cloud CDN supports any domain names, including IDNsпример.рф
) or convert them to Punycodexn--
(xn--e1afmkfd.xn--p1ai
) prefixes added. In the management console
When creating a resource, you must enter at least one domain name. The first name you enter is the primary domain name which cannot be changed after you create the resource.
For the resource to run properly, you must have:
-
Rights to all the domain names you entered.
-
Access to DNS settings for domain names.
For each name, in the settings of your DNS hosting, create a CNAME record linking this name with the domain name of the CDN load balancer in
cl-********.edgecdn.ru
format. It is displayed when creating a resource, as well as in the management console (on the page of an existing resource). Here is an example of a record for thecdn.example.com
domain name:cdn.example.com. CNAME cl-********.edgecdn.ru
Note
You cannot have both a CDN resource and a mail server on the same second-level domain. We recommend creating two domains:
- For content distributed over a CDN. Please note that you should only use Cloud CDN with CNAME resource records, because if using an ANAME record, end users will be getting responses unrelated to their geolocation. For more information about CNAME records and their limitations
, see RFC-1035 . - For lightweight content and your mail server. In this case, you can use ANAME and MX resource records.
Time needed for the settings to apply
A CDN resource start working correctly in a while after you create or update it.
-
The new resource will start running properly after the CNAME record that you created on your DNS hosting (see the section about domain names used for content distribution) is propagated across DNS servers. This might take a few hours.
-
It may take up to 15 minutes for the new settings of the existing resource to apply to CDN servers. After that, we recommend purging the resource cache.
Resource statuses
A Cloud CDN resource can have one of the following statuses:
Active
if the content is available to all (or will be available after you apply the settings).Not active
if the content is not available to anybody.
To switch between them, use the End-user access to content option in the basic resource settings.
If the resource does not receive any user requests for 90 days, its status changes to Not active
.
Resource usage statistics
Cloud CDN provides resource usage metrics for the last 30 days:
- Upstream from origins: Amount of traffic loaded by CDN servers from origins.
- Sent: Amount of traffic sent from CDN servers to clients.
- All traffic: Sum of Upstream from origins and Sent metrics.
- Requests: Number of client requests to the CDN.
- Responses hit: Number of client requests to which CDN servers responded by sending cached copies of files without requesting them from origins (if caching is enabled for CDN servers).
- Response miss: Number of client requests to which CDN servers failed to respond by sending cached copies of files (e.g., caching disabled, file not yet cached by the server, or cache lifetime expired) and had to access origins to load files.
- Cache hit ratio: Ratio of traffic sent from CDN servers to clients without accessing origins. It is calculated using the following formula:
(1 − (Upstream from origins / Sent)) × 100%
. - Loaded by Origin shielding: Amount of traffic loaded from origins by the shielding server (if shielding is enabled).
- Responses with 2xx codes, 3xx, 4xx, and 5xx: Number of responses with the respective HTTP status codes sent by CDN servers to clients.
You can view statistics on the resource page in the management console
Monitoring metrics
Cloud CDN automatically sends resource performance metrics to Yandex Monitoring.
You can view performance statistics on the resource page or in the Monitoring interface.
On average, Cloud CDN metrics are updated every 3 minutes.
Note
For technical reasons, metrics from the EdgeCenter CDN provider are exported from Yandex Monitoring in Prometheus format with a delay, and their time values are 10-15 minutes ahead of the actual time. For example, for a metric exported in Prometheus format, the actual time for 01:00 would be between 00:45 and 00:50.
If you view the metrics in the Monitoring interface
For a list of metrics delivered to Monitoring, see the reference.