Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Cloud CDN
  • Getting started
    • All guides
    • Connecting to a Cloud CDN provider
      • Creating an origin group
      • Editing an origin group
      • Connecting an origin group to a resource
      • Getting information about origins
      • Deleting an origin group
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • Troubleshooting

In this article:

  • Connecting an origin group when creating a resource
  • Connecting an origin group when editing resource settings
  1. Step-by-step guides
  2. Origin groups
  3. Connecting an origin group to a resource

Connecting an origin group to a resource

Written by
Yandex Cloud
Updated at May 13, 2025
  • Connecting an origin group when creating a resource
  • Connecting an origin group when editing resource settings

To connect an origin group to a resource, under Content, select the appropriate Origin group when creating or updating resource settings.

Connecting an origin group when creating a resource

Management console
CLI
Terraform
API
  1. In the management console, select the folder where you want to create a resource.

  2. Select Cloud CDN.

  3. Click Create resource.

  4. Under Content, select From origin group in the Content query field.

  5. Select an origin group.

  6. Specify the other resource settings. For more information, see Creating a resource.

  7. Click Create.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View a description of the CLI create resource command:

    yc cdn resource create --help
    
  2. Get a list of all origin groups in the default folder:

    yc cdn origin-group list --format yaml
    

    Result:

    - id: "90209"
      folder_id: b1g86q4m5vej********
      name: test-group-1
      use_next: true
      origins:
      - id: "561547"
        origin_group_id: "90209"
        source: www.example2.com
        enabled: true
        backup: true
      - id: "561546"
        origin_group_id: "90209"
        source: www.example1.com
        enabled: true
    - id: "90208"
      folder_id: b1g86q4m5vej********
      name: test-group
      use_next: true
      origins:
      - id: "561545"
        origin_group_id: "90208"
        source: www.a2.com
        enabled: true
        backup: true
      - id: "561544"
        origin_group_id: "90208"
        source: www.a1.com
        enabled: true
    
  3. Create a resource with the connected origin group:

    yc cdn resource create --cname <resource_domain_name> \
      --origin-group-id <origin_group_ID> \
      --origin-protocol https
    

    Where:

    • --origin-group-id: Origin group ID.
    • --origin-protocol: Protocol for origins.

    Result:

    id: bc855oumelrq********
    folder_id: b1g86q4m5vej********
    cname: res1.example.com
    created_at: "2022-01-15T15:13:42.827643Z"
    updated_at: "2022-01-15T15:13:42.827671Z"
    active: true
    options:
      edge_cache_settings:
        enabled: true
        default_value: "345600"
      cache_http_headers:
        value:
        - accept-ranges
        - cache-control
        - connection
        - content-encoding
        - content-length
        - content-type
        - date
        - etag
        - expires
        - keep-alive
        - last-modified
        - server
        - vary
      stale:
        enabled: true
        value:
        - error
        - updating
      allowed_http_methods:
        value:
        - GET
        - POST
        - HEAD
        - OPTIONS
    origin_group_id: "90208"
    origin_group_name: test-group-22
    origin_protocol: HTTPS
    ssl_certificate:
      type: DONT_USE
      status: READY
    

    For more information about the yc cdn resource create command, see the CLI reference.

If you do not have Terraform yet, install it and configure its Yandex Cloud provider.

  1. Describe the parameters of the yandex_cdn_resource resource in the configuration file:

    Here is an example of the configuration file structure:

    provider "yandex" {
      token     = "<OAuth_token>"
      cloud_id  = "<cloud_ID>"
      folder_id = "<folder_ID>"
      zone      = "<default_availability_zone>"
    }
    
    resource "yandex_cdn_resource" "my_resource" {
      cname = "<resource_domain_name>"
      active = true
      origin_protocol = "https"
       origin_group_id = <origin_group_ID>
    }
    

    For more information about the resources you can create with Terraform, see the provider documentation.

  2. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  3. Create an origin group.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

To add an origin group when creating a resource, use the create REST API method for the Resource resource or the ResourceService/Create gRPC API call.

Connecting an origin group when editing resource settings

Management console
CLI
API
  1. In the management console, select the folder where your resource is located.

  2. Select Cloud CDN.

  3. Click the resource name.

  4. In the top-right corner, click Edit.

  5. Select an origin group.

  6. Enter the other resource settings if needed. For more information, see Editing the basic settings of a resource.

  7. Click Save.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. View a description of the CLI update resource command:

    yc cdn resource update --help
    
  2. Get a list of all resources in the default folder:

    yc cdn resource list --format yaml
    

    Result:

    - id: bc82xll34xuc********
      folder_id: b1g86q4m5vej********
      cname: res1.example.com
      created_at: "2022-01-21T08:17:48.850086Z"
      updated_at: "2022-01-21T08:17:48.850125Z"
      active: true
      options:
        edge_cache_settings:
          enabled: true
          default_value: "345600"
        cache_http_headers:
          value:
          - accept-ranges
          - cache-control
          - connection
          - content-encoding
          - content-length
          - content-type
          - date
          - etag
          - expires
          - keep-alive
          - last-modified
          - server
          - vary
        stale:
          enabled: true
          value:
          - error
          - updating
        allowed_http_methods:
          value:
          - GET
          - POST
          - HEAD
          - OPTIONS
      origin_group_id: "90208"
      origin_group_name: test-group
      origin_protocol: HTTPS
      ssl_certificate:
        type: DONT_USE
        status: READY
    
  3. Get a list of all origin groups in the default folder and select the relevant group's ID:

    yc cdn origin-group list --format yaml
    

    Result:

    - id: "90209"
      folder_id: b1g86q4m5vej********
      name: test-group-1
      use_next: true
      origins:
      - id: "561547"
        origin_group_id: "90209"
        source: www.example2.com
        enabled: true
        backup: true
      - id: "561546"
        origin_group_id: "90209"
        source: www.example1.com
        enabled: true
    - id: "90208"
      folder_id: b1g86q4m5vej********
      name: test-group
      use_next: true
      origins:
      - id: "561545"
        origin_group_id: "90208"
        source: www.a2.com
        enabled: true
        backup: true
      - id: "561544"
        origin_group_id: "90208"
        source: www.a1.com
        enabled: true
    
  4. Update resource settings by specifying the ID of the origin group:

    yc cdn resource update \
      --id <resource_ID> \
      --origin-group-id <origin_group_ID>
    

    Result:

    id: bc8krsk72icw********
    folder_id: b1g86q4m5vej********
    cname: res2.example.com
    created_at: "2022-01-15T15:29:19.103653Z"
    updated_at: "2022-01-15T15:33:22.819916Z"
    active: true
    options:
      edge_cache_settings:
        enabled: true
        default_value: "345600"
      cache_http_headers:
        value:
        - accept-ranges
        - cache-control
        - connection
        - content-encoding
        - content-length
        - content-type
        - date
        - etag
        - expires
        - keep-alive
        - last-modified
        - server
        - vary
      stale:
        enabled: true
        value:
        - error
        - updating
      allowed_http_methods:
        value:
        - GET
        - POST
        - HEAD
        - OPTIONS
    origin_group_id: "90209"
    origin_group_name: test-group-1
    origin_protocol: HTTPS
    ssl_certificate:
      type: DONT_USE
      status: READY
    

    For more information about the yc cdn resource update command, see the CLI reference.

To add an origin group when editing resource settings, use the update REST API method for the Resource resource or the ResourceService/Update gRPC API call.

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.

Was the article helpful?

Previous
Editing an origin group
Next
Getting information about origins
© 2025 Direct Cursus Technology L.L.C.