Integrating an L7 load balancer with Cloud CDN and Object Storage using the management console
- Supported tools
- Get your cloud ready
- Create and configure a public DNS zone
- Add a certificate to Certificate Manager
- Create a cloud network and subnets
- Create a security group
- Create an Object Storage bucket
- Upload the file of your service to the bucket
- Create an Application Load Balancer backend group
- Create an HTTP router and a virtual host
- Create an L7 load balancer
- Create a CDN resource
- Create a CNAME resource record for the CDN resource
- Test the service
- How to delete the resources you created
Note
To implement this solution, you will need a domain. We will use the example.com domain name as an example.
To set up integration of an L7 load balancer with Yandex Cloud CDN and Yandex Object Storage using the management console
- Get your cloud ready.
- Create and configure a public DNS zone.
- Add a certificate to Certificate Manager.
- Create a cloud network and subnets.
- Create a security group.
- Create a bucket in Object Storage.
- Upload the file of your service to the bucket.
- Create an Application Load Balancer backend group.
- Create an HTTP router and a virtual host.
- Create an L7 load balancer.
- Create a CDN resource.
- Create a CNAME resource record for the CDN resource.
- Test the service.
If you no longer need the resources you created, delete them.
Supported tools
You can use various supported tools to perform these steps. You can complete most of the steps in this tutorial using any standard tool, such as the management console
Some steps do not support certain tools: currently, you cannot create an Application Load Balancer backend group with buckets as backends via the Yandex Cloud CLI.
Get your cloud ready
Sign up for Yandex Cloud and create a billing account:
- Navigate to the management console
and log in to Yandex Cloud or create a new account. - On the Yandex Cloud Billing
page, make sure you have a billing account linked and it has theACTIVEorTRIAL_ACTIVEstatus. If you do not have a billing account, create one and link a cloud to it.
If you have an active billing account, you can navigate to the cloud page
Learn more about clouds and folders here.
We will use a folder named example-folder in our example.
Required paid resources
The infrastructure support costs include:
- Fee for data storage in Object Storage, data operations, and outbound traffic (see Object Storage pricing).
- Fee for using the L7 load balancer’s computing resources (see Application Load Balancer pricing).
- A fee for outgoing traffic from CDN servers (see Cloud CDN pricing).
- Fee for public DNS requests and DNS zones if using Yandex Cloud DNS (see Cloud DNS pricing).
Create and configure a public DNS zone
Note
This guide describes a scenario where Yandex Cloud DNS handles domain management.
If you do not want to delegate management of your domain to Yandex Cloud, you can complete the required DNS setup using tools provided by your domain administrator. To create resource records, use your domain administrator’s tutorials or contact their support.
To configure a public DNS zone in the Yandex Cloud infrastructure:
-
Delegate your domain to Cloud DNS. To do this, in your domain registrar's account, specify the addresses of these DNS servers in your domain settings:
ns1.yandexcloud.netandns2.yandexcloud.net. -
Create a public DNS zone in Yandex Cloud DNS.
Management consoleYandex Cloud CLIAPI-
In the management console
, selectexample-folder. -
Go to Cloud DNS.
-
Click Create zone.
-
Specify the zone settings consistent with your domain:
- Zone: Domain zone. Its name must end with a trailing dot. For example,
example.com.matches theexample.comdomain. To create a domain name with non-Latin characters, use the Punycode encoding. - Type:
Public. - Name:
my-domain-zone.
- Zone: Domain zone. Its name must end with a trailing dot. For example,
-
Click Create.
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the
yc config set folder-id <folder_ID>command. You can also set a different folder for any specific command using the--folder-nameor--folder-idoptions.Run this command:
yc dns zone create \ --name my-domain-zone \ --zone <domain_name> \ --public-visibilityWhere
--zoneis your domain name, e.g.,example.com.. The--zoneparameter value must end with a trailing dot. For example,example.com.matches theexample.comdomain.Result:
id: dns6b0mdas5r******** folder_id: b1gt6g8ht345******** created_at: "2026-02-05T10:42:16.017Z" name: my-domain-zone zone: example.com. public_visibility: {}For more information about the
yc dns zone createcommand, see the CLI reference.To create a public DNS zone, use the create REST API method for the DnsZone resource or the DnsZoneService/Create gRPC API call.
-
Add a certificate to Certificate Manager
Certificates from Yandex Certificate Manager are supported. You can issue a new Let's Encrypt® certificate or upload one of your own.
The certificate must be located in the same folder as your CDN resource.
This guide describes a scenario where the CDN resource is issued a new Let's Encrypt® certificate.
-
Add a Let's Encrypt® certificate for your domain to Certificate Manager:
Management consoleYandex Cloud CLIAPI- In the management console
, selectexample-folder. - Go to Certificate Manager.
- Click Add certificate and select Let's Encrypt certificate.
- In the window that opens, specify
mymanagedcertin the Name field. - In the Domains field, enter a name for your domain, e.g.,
example.com. - Select the domain rights check type for
DNS. - Click Create.
Run this command:
yc certificate-manager certificate request \ --name mymanagedcert \ --challenge dns \ --domains <domain_name>Where
<domain_name>is your domain name, e.g.,example.com.Result:
id: fpq7t9dpi4o0******** folder_id: b1gt6g8ht345******** created_at: "2026-02-05T11:00:15.952968372Z" name: mymanagedcert type: MANAGED domains: - example.com status: VALIDATING updated_at: "2026-02-05T11:00:15.952968372Z"For more information about the
yc certificate-manager certificate requestcommand, see the CLI reference.Save the ID (
id) of the certificate you created, as you will need it when creating a CDN resource.To add a certificate, use the requestNew REST API method for the Certificate resource or the CertificateService/RequestNew gRPC API call.
A new certificate with the
Validatingstatus will appear in the certificate list. This status means that a Let's Encrypt® certificate was requested and you need to pass a domain rights check for it to be successfully processed. - In the management console
-
To successfully issue the certificate, pass a domain rights check:
Management consoleYandex Cloud CLIAPI- In the management console
, selectexample-folder. - Go to Certificate Manager.
- From the list of certificates, select
mymanagedcert. - In the window that opens, under Check rights for domains, select
CNAME recordand click Create record in the section with your domain below. - In the window that opens, confirm creating the resource record.
Checking rights for a domain may take from a few minutes to a few days. Wait until the check is complete. As a result, the certificate will be issued and get the
Issuedstatus.-
Get the values of the resource record required for validation:
yc certificate-manager certificate get \ --name mymanagedcert \ --fullResult:
id: fpq7t9dpi4o0******** folder_id: b1gt6g8ht345******** created_at: "2026-02-05T11:00:15.952Z" name: mymanagedcert type: MANAGED domains: - example.com status: VALIDATING updated_at: "2026-02-05T11:00:15.952Z" challenges: - domain: example.com type: DNS created_at: "2026-02-05T11:00:15.952968372Z" updated_at: "2026-02-05T11:00:19.659820021Z" status: PENDING message: Create a record in your DNS provider. dns_challenge: name: _acme-challenge.example.com. type: CNAME value: fpq7t9dpi4o0********.cm.yandexcloud.net. - domain: example.com type: DNS created_at: "2026-02-05T11:00:15.952968372Z" updated_at: "2026-02-05T11:00:19.659820021Z" status: PENDING message: Create a record in your DNS provider. dns_challenge: name: _acme-challenge.example.com. type: TXT value: 77LcWo8-Qx4sHJuFDoNCpptLZkyWVW5A2dY********For more information about the
yc certificate-manager certificate getcommand, see the CLI reference.Save the value of the
valuefield from theCNAMEtype section underchallenges.dns_challenge. You will need this value in the next step. -
Create a CNAME resource record to pass a domain rights check:
yc dns zone add-records \ --name my-domain-zone \ --record "_acme-challenge 600 CNAME <dns_challenge_value>"Where
<dns_challenge_value>is the value you saved in the previous step, required for the domain rights check using a CNAME record.Result:
+--------+------------------------------+-------+------------------------------------------+-----+ | ACTION | NAME | TYPE | DATA | TTL | +--------+------------------------------+-------+------------------------------------------+-----+ | + | _acme-challenge.example.com. | CNAME | fpq7t9dpi4o0********.cm.yandexcloud.net. | 600 | +--------+------------------------------+-------+------------------------------------------+-----+For more information about the
yc dns zone add-recordscommand, see the CLI reference.Checking rights for a domain may take from a few minutes to a few days. Wait until the check is complete. As a result, the certificate will be issued and get the
Issuedstatus. -
Make sure that the certificate status has switched to
Issued:yc certificate-manager certificate get \ --name mymanagedcertResult:
id: fpq7t9dpi4o0******** folder_id: b1gt6g8ht345******** created_at: "2026-02-05T11:00:15.952Z" name: mymanagedcert type: MANAGED domains: - example.com status: ISSUED issuer: CN=R12,O=Let's Encrypt,C=US subject: CN=example.com serial: 57bc7967996d73d63d9d52e337c******** updated_at: "2026-02-05T13:29:23.658Z" issued_at: "2026-02-05T13:29:23.658Z" not_after: "2026-05-06T12:30:49Z" not_before: "2026-02-05T12:30:50Z"Save the certificate ID you got as you will need it later to create the CDN resource.
To get the information required to pass the domain rights check, use the get REST API method for the Certificate resource or the CertificateService/Get gRPC API call with the
view=FULLparameter.To create a CNAME resource record in a DNS zone, use the updateRecordSets REST API method for the DnsZone resource or the DnsZoneService/UpdateRecordSets gRPC API call.
Note
For a successful DNS domain rights check based on a
CNAMErecord, make sure the_acme-challengesubdomain of the domain name you are checking has no other resource records exceptCNAME. For example, for the_acme-challenge.example.com.domain name, there should only be a CNAME record and no TXT record.If your domain is managed from outside Yandex Cloud, to create the resource record for the domain rights check, use tools provided by your domain administrator. For more information, see Domain rights check.
- In the management console
Create a cloud network and subnets
All resources will belong to the same cloud network.
- In the management console
, selectexample-folder. - Go to Virtual Private Cloud.
- At the top right, click Create network.
- In the Name field, specify
example-network. - In the Advanced field, select
Create subnets. - Click Create network.
-
Create a network named
example-network:yc vpc network create example-networkResult:
id: enpqm699f18v******** folder_id: b1gt6g8ht345******** created_at: "2026-02-05T11:57:02Z" name: example-network default_security_group_id: enp4qvbg2ri1********For more information about the
yc vpc network createcommand, see the CLI reference. -
Create subnets in all availability zones:
-
ru-central1-a:yc vpc subnet create example-subnet-ru-central1-a \ --zone ru-central1-a \ --network-name example-network \ --range 192.168.1.0/24Result:
id: e9b0fo0hvhpd******** folder_id: b1gt6g8ht345******** created_at: "2026-02-05T12:00:21Z" name: example-subnet-ru-central1-a network_id: enpqm699f18v******** zone_id: ru-central1-a v4_cidr_blocks: - 192.168.1.0/24Save the subnet ID you got as you will need it later to create an L7 load balancer.
-
ru-central1-b:yc vpc subnet create example-subnet-ru-central1-b \ --zone ru-central1-b \ --network-name example-network \ --range 192.168.2.0/24Result:
id: e2lo05oe9slo******** folder_id: b1gt6g8ht345******** created_at: "2026-02-05T12:02:02Z" name: example-subnet-ru-central1-b network_id: enpqm699f18v******** zone_id: ru-central1-b v4_cidr_blocks: - 192.168.2.0/24Save the subnet ID you got as you will need it later to create an L7 load balancer.
-
ru-central1-d:yc vpc subnet create example-subnet-ru-central1-d \ --zone ru-central1-d \ --network-name example-network \ --range 192.168.3.0/24Result:
id: fl8bpb6lnu80******** folder_id: b1gt6g8ht345******** created_at: "2026-02-05T12:03:23Z" name: example-subnet-ru-central1-d network_id: enpqm699f18v******** zone_id: ru-central1-d v4_cidr_blocks: - 192.168.3.0/24Save the subnet ID you got as you will need it later to create an L7 load balancer.
For more information about the
yc vpc subnet createcommand, see the CLI reference. -
- To create
example-network, use the create REST API method for the Network resource or the NetworkService/Create gRPC API call. - To create
example-subnet-ru-central1-a,example-subnet-ru-central1-b, andexample-subnet-ru-central1-din three availability zones, use the create REST API method for the Subnet resource or the SubnetService/Create gRPC API call.
Create a security group
Security groups contain rules that allow the L7 load balancer to receive incoming traffic and send it to backend buckets.
To create security groups:
-
In the management console
, selectexample-folder. -
Go to Virtual Private Cloud.
-
In the left-hand panel, select
Security groups. -
At the top right, click Create security group.
-
In the Name field, specify
example-sg. -
In the Network field, select
example-network. -
Under Rules, create the following rules using the instructions below:
Traffic
directionDescription Port range Protocol Source /
destinationCIDR blocks EgressanyAllAnyCIDR0.0.0.0/0Ingressext-http80TCPCIDR0.0.0.0/0Inboundext-https443TCPCIDR0.0.0.0/0Inboundhealthchecks30080TCPLoad balancer healthchecks— -
Click Create.
Run this command:
yc vpc security-group create example-sg \
--network-name example-network \
--rule "direction=egress,port=any,protocol=any,v4-cidrs=[0.0.0.0/0]" \
--rule "direction=ingress,port=80,protocol=tcp,v4-cidrs=[0.0.0.0/0]" \
--rule "direction=ingress,port=443,protocol=tcp,v4-cidrs=[0.0.0.0/0]" \
--rule "direction=ingress,port=30080,protocol=tcp,predefined=loadbalancer_healthchecks"
Result:
id: enp9dpfa774h********
folder_id: b1gt6g8ht345********
created_at: "2026-02-05T12:29:47Z"
name: example-sg
network_id: enpqm699f18v********
status: ACTIVE
rules:
- id: enpa11mk1r50********
direction: EGRESS
protocol_name: ANY
protocol_number: "-1"
cidr_blocks:
v4_cidr_blocks:
- 0.0.0.0/0
- id: enp4aob2uiam********
direction: INGRESS
ports:
from_port: "80"
to_port: "80"
protocol_name: TCP
protocol_number: "6"
cidr_blocks:
v4_cidr_blocks:
- 0.0.0.0/0
- id: enpn8onb4lda********
direction: INGRESS
ports:
from_port: "443"
to_port: "443"
protocol_name: TCP
protocol_number: "6"
cidr_blocks:
v4_cidr_blocks:
- 0.0.0.0/0
- id: enp6j82kiu2p********
direction: INGRESS
ports:
from_port: "30080"
to_port: "30080"
protocol_name: TCP
protocol_number: "6"
predefined_target: loadbalancer_healthchecks
Save the security group ID as you will need it later to create an L7 load balancer.
For more information about the yc vpc security-group create command, see the CLI reference.
Use the create REST API method for the SecurityGroup resource or the SecurityGroupService/Create gRPC API call.
To add a rule for load balancer health checks, use the loadbalancer_healthchecks parameter in under predefinedTarget for the REST API or under SecurityGroupRuleSpec.target.predefined_target for the gRPC API.
Create an Object Storage bucket
- In the management console
, selectexample-folder. - Go to Object Storage.
- At the top right, click Create bucket.
- In the ** Name** field, enter a unique name for the bucket.
- In the Read objects and Read object list fields, select
For all. - Click Create bucket.
Run this command, specifying the unique bucket name:
yc storage bucket create \
--name <bucket_name> \
--public-read \
--public-list
Result:
name: my-cdn-bucket
folder_id: b1gt6g8ht345********
anonymous_access_flags:
read: true
list: true
default_storage_class: STANDARD
versioning: VERSIONING_DISABLED
created_at: "2026-02-05T12:35:03.639102Z"
resource_id: e3e8qar9vrim********
Use the create REST API method for the Bucket resource or the BucketService/Create gRPC API call.
Upload the file of your service to the bucket
-
Create a file named
index.htmlwith the following contents:<!DOCTYPE html> <html> <head> <title>My service</title> </head> <body> <p>The service is working</p> </body> </html> -
Upload the file to the bucket:
Management consoleYandex Cloud CLIAPI- In the management console
, selectexample-folder. - Go to Object Storage.
- Select the previously created bucket.
- Click
Upload and select theindex.htmlfile for uploading. - In the window that opens, click Upload.
Upload the
index.htmlfile to the bucket:yc storage s3api put-object \ --bucket <bucket_name> \ --key index.html \ --content-type "text/html" \ --body <local_path_to_file>Where:
--bucket: Name of the bucket you created earlier.--body: Local path to the HTML file created earlier, e.g.,./index.html.
Result:
etag: '"2f613d0f35668e1d98fa9c6b********"' request_id: a809736f********For more information about the
yc storage s3api put-objectcommand, see the CLI reference.Use the upload REST API method.
- In the management console
Create an Application Load Balancer backend group
- In the management console
, selectexample-folder. - Go to Application Load Balancer.
- In the left-hand panel, select
Backend groups. - At the top right, click Create backend group.
- In the Name field, specify
example-bg. - In the Type field, select
HTTPas the backend group type. - Under Backends, click Add and set up the backend:
- In the Name field, specify
example-backend. - In the Weight field, specify
100. - In the Type field, select
Bucketas the backend type. - In the Bucket field, select the bucket you created earlier.
- In the Name field, specify
- Click Create.
If you are going to complete the next steps in the Yandex Cloud CLI, copy the ID of the example-bg backend group as you will need it later.
Currently, the Yandex Cloud CLI does not support creating a backend group with the bucket backend type. Use the management console or API to create the backend group.
Use the create REST API method for the BackendGroup resource or the BackendGroupService/Create gRPC API call.
Create an HTTP router and a virtual host
-
In the management console
, selectexample-folder. -
Go to Application Load Balancer.
-
In the left-hand panel, select
HTTP routers. -
At the top right, click Create HTTP router.
-
In the Name field, specify
example-router. -
Create a virtual host named
example-vh:- Under Virtual hosts, click Add virtual host.
- In the Name field, specify
example-vh. - In the Authority field, specify your domain name, e.g.,
example.com. - Click Add route.
- In the Name field, specify
example-route. - In the Path field, select
Starts withand specify the/path. - From the HTTP methods list, select
GET. - In the Action field, keep
Routing. - From the Backend group list, select
example-bg.
-
Do not change the other settings. Click Create.
-
Create an HTTP router
example-router:yc alb http-router create example-routerResult:
id: ds78i77j8lg0******** name: example-router folder_id: b1gt6g8ht345******** created_at: "2026-02-05T13:09:27.917359782Z"For more information about the
yc alb http-router createcommand, see the CLI reference. -
Create a virtual host named
example-vh:yc alb virtual-host create example-vh \ --http-router-name example-router \ --authority <domain_name>Where
<domain_name>is your domain name, e.g.,example.com.Result:
done (1s) name: example-vh authority: - example.comFor more information about the
yc alb virtual-host createcommand, see the CLI reference. -
Create a route named
example-routein theexample-vhvirtual host:yc alb virtual-host append-http-route example-route \ --http-router-name example-router \ --virtual-host-name example-vh \ --prefix-path-match "/" \ --backend-group-name example-bgResult:
done (1s) name: example-vh authority: - example.com routes: - name: example-route http: match: path: prefix_match: / route: backend_group_id: ds7glpil29lb********For more information about the
yc alb virtual-host append-http-routecommand, see the CLI reference.
- To create the
example-routerHTTP router, use the create REST API method for the HttpRouter resource or the HttpRouterService/Create gRPC API call. - To create the
example-vhvirtual host associated with the router, use the create REST API method for the VirtualHost resource or the VirtualHostService/Create gRPC API call.
Create an L7 load balancer
-
In the management console
, selectexample-folder. -
Go to Application Load Balancer.
-
At the top right, click Create L7 load balancer and select Manual.
-
In the Name field, specify
example-balancer. -
Under Network settings:
- In the Network field, select
example-network. - In the Security groups field, select
From listand then, from the list that opens, theexample-sgsecurity group you created earlier.
- In the Network field, select
-
Under Allocation, select the three subnets for the load balancer nodes (
example-subnet-ru-central1-a,example-subnet-ru-central1-b, andexample-subnet-ru-central1-d) and enable traffic to these subnets. -
Under Listeners, click Add listener and set up the listener:
- In the Name field, specify
example-listener. - Under Public IP address:
- In the Port field, specify
80. - In the Type field, select
Automatically.
- In the Port field, specify
- In the Name field, specify
-
In the HTTP router field, select
example-router. -
Click Create.
-
Create a load balancer named
example-balancer:yc alb load-balancer create example-balancer \ --network-name example-network \ --security-group-id <example-sg_security_group_ID> \ --location zone=ru-central1-a,subnet-id=<example-subnet-ru-central1-a_ID> \ --location zone=ru-central1-b,subnet-id=<example-subnet-ru-central1-b_ID> \ --location zone=ru-central1-d,subnet-id=<example-subnet-ru-central1-d_ID>Where:
--security-group-id: Security group ID you saved when creating the security group.subnet_id: Subnet IDs in three availability zones you saved when creating the subnets.
Result:
done (7m17s) id: ds790ardig7r******** name: example-balancer folder_id: b1gt6g8ht345******** status: ACTIVE region_id: ru-central1 network_id: enpqm699f18v******** allocation_policy: locations: - zone_id: ru-central1-a subnet_id: e9b0fo0hvhpd******** - zone_id: ru-central1-b subnet_id: e2lo05oe9slo******** - zone_id: ru-central1-d subnet_id: fl8bpb6lnu80******** security_group_ids: - enp9dpfa774h******** created_at: "2026-02-05T13:30:25.695763710Z"For more information about the
yc alb load-balancer createcommand, see the CLI reference. -
Add a listener to the load balancer:
yc alb load-balancer add-listener \ --name example-balancer \ --listener-name example-listener \ --external-ipv4-endpoint port=80 \ --http-router-name example-routerResult:
done (9m53s) id: ds790ardig7r******** name: example-balancer folder_id: b1gt6g8ht345******** status: ACTIVE region_id: ru-central1 network_id: enpqm699f18v******** listeners: - name: example-listener endpoints: - addresses: - external_ipv4_address: address: 158.160.***.*** ports: - "80" http: handler: http_router_id: ds78i77j8lg0******** allocation_policy: locations: - zone_id: ru-central1-a subnet_id: e9b0fo0hvhpd******** - zone_id: ru-central1-b subnet_id: e2lo05oe9slo******** - zone_id: ru-central1-d subnet_id: fl8bpb6lnu80******** security_group_ids: - enp9dpfa774h********Save the listener IP address (the
addressfield value), as you will need it later to create a CDN resource.For more information about the
yc alb load-balancer add-listenercommand, see the CLI reference.
To create an L7 load balancer, use the create REST API method for the LoadBalancer resource or the LoadBalancerService/Create gRPC API call.
Create a CDN resource
-
In the management console
, selectexample-folder. -
Go to Cloud CDN.
-
Click Create resource.
-
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
L7 load balancerand then, in the field that appears,example-balancer. -
In the IP address field, select the IP address assigned to the load balancer (the only one in the list).
-
In the Origin request protocol field, select
HTTP. -
In the Domain name field, specify your domain name, e.g.,
example.com.Alert
The specified domain name will become the primary one, and you will not be able to edit it after you create a CDN resource.
-
-
Under Additional settings:
- In the Redirect clients field, select
HTTP to HTTPS. - In the Certificate type field, specify
Use from Certificate Managerand select themymanagedcertcertificate you previously created for your domain name. - In the Host header field, select
Match client.
- In the Redirect clients field, select
-
-
Click Continue.
-
Keep the default settings for Caching, HTTP headers and methods, and Additional and click Continue.
-
Create an origin group named
example-origin-group, specifying the load balancer IP address you saved earlier:yc cdn origin-group create --name "example-origin-group" \ --origin source=<load_balancer_IP_address>:80,enabled=trueResult:
id: "12756795849********" folder_id: b1gt6g8ht345******** name: example-origin-group use_next: true origins: - id: "68784" origin_group_id: "12756795849********" source: 158.160.***.***:80 enabled: true provider_type: ourcdn provider_type: ourcdnSave the origin group ID (the
origin_group_idfield value), as you will need it later to create a CDN resource.For more information about the
yc cdn origin-group createcommand, see the CLI reference. -
Create a CDN resource:
yc cdn resource create \ --cname <domain_name> \ --origin-group-id <origin_group_ID> \ --origin-protocol http \ --cert-manager-ssl-cert-id <certificate_ID> \ --forward-host-headerWhere:
--cname: Your domain's name, e.g.,example.com.--origin-group-id: Origin group ID you got in the previous step.--cert-manager-ssl-cert-id: ID of themymanagedcertcertificate you created earlier.
Result:
id: bc8rpt67l6dl******** folder_id: b1gt6g8ht345******** cname: example.com created_at: "2026-02-05T14:05:24.913996Z" updated_at: "2026-02-05T14:05:24.913996Z" active: true options: edge_cache_settings: enabled: true default_value: "86400" browser_cache_settings: {} query_params_options: ignore_query_string: enabled: true value: true slice: {} host_options: forward_host_header: enabled: true value: true static_headers: enabled: true stale: {} allowed_http_methods: enabled: true value: - GET - HEAD - OPTIONS static_request_headers: enabled: true custom_server_name: {} ignore_cookie: enabled: true value: true secure_key: type: DISABLE_IP_SIGNING origin_group_id: "12756795849********" origin_group_name: example-origin-group origin_protocol: HTTP ssl_certificate: type: CM status: READY data: cm: id: fpq7t9dpi4o0******** provider_type: ourcdn provider_cname: d88c6ee6********.topology.gslb.yccdn.ruSave the new resource
idandprovider_cnameas you will need them later.For more information about the
yc cdn resource createcommand, see the CLI reference. -
Enable client redirects for the CDN resource, specifying the ID you saved in the previous step:
yc cdn resource update <CDN_resource_ID> \ --redirect-http-to-httpsFor more information about the
yc cdn resource updatecommand, see the CLI reference.
To create a CDN resource, use the create REST API method for the Resource resource or the ResourceService/Create gRPC API call.
Create a CNAME resource record for the CDN resource
-
Get the CDN provider domain name value.
-
In the management console
, selectexample-folder. -
Go to Cloud DNS and select the DNS zone you created earlier.
-
Click Create record.
-
Specify the record settings:
- In the Name field, select
Matches zone name (@). - In the Type field, select the
CNAMErecord type. - In the Data field, specify the domain name value of the CDN provider.
- In the Name field, select
-
Click Create.
-
Create a CNAME resource record in Cloud DNS:
yc dns zone add-records \ --name my-domain-zone \ --record "@ 600 CNAME <cname_value>"Where
<cname_value>is the CNAME provider value you got ealier.Result:
+--------+--------------+-------+-----------------------------------------+-----+ | ACTION | NAME | TYPE | DATA | TTL | +--------+--------------+-------+-----------------------------------------+-----+ | + | example.com. | CNAME | d88c6ee6********.topology.gslb.yccdn.ru | 600 | +--------+--------------+-------+-----------------------------------------+-----+For more information about the
yc dns zone add-recordscommand, see the CLI reference.
To get the CNAME record value for a CDN resource, use the getProviderCName REST API method for the Resource resource or the ResourceService/GetProviderCName gRPC API call.
To create a CNAME resource record in a DNS zone, use the updateRecordSets REST API method for the DnsZone resource or the DnsZoneService/UpdateRecordSets gRPC API call.
It may take a few hours to update DNS records on the DNS servers. After that, you can check the health of the service.
If your domain is managed from outside Yandex Cloud, to create the resource record for the CDN resource, use tools provided by your domain administrator. For more information, see Domain rights check.
Test the service
To test the service, open https://example.com/index.html in your browser (with your domain name in place of example.com). If everything is configured correctly, you should see a page with the following content:
<!DOCTYPE html>
<html>
<head>
<title>My service</title>
</head>
<body>
<p>The service is working</p>
</body>
</html>
How to delete the resources you created
To shut down the infrastructure and stop paying for the resources you created:
- If you set up CNAME records in Cloud DNS, delete
example-dns-zone. - Delete the CDN resource with
example.comas its primary domain name. - Delete the
example-balancerL7 load balancer. - Delete all objects from the bucket.
- Delete the bucket.
- Delete the
example-subnet-ru-central1-a,example-subnet-ru-central1-b, andexample-subnet-ru-central1-dsubnets. - Delete the
example-sgsecurity group. - Delete
example-network. - Delete the
mymanagedcertcertificate if you no longer need it.