Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Yandex.Cloud LLC
Yandex Cloud CDN
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Resources
      • Creating a resource
      • Editing basic settings of a resource
      • Configuring resource caching
      • Configuring log export
      • Pre-loading files to CDN servers
      • Purging resource cache
      • Configuring request and response headers
      • Configuring CORS for responses to clients
      • Configuring HTTP methods
      • Enabling file compression
      • Enabling file segmentation
      • Enabling origin shielding
      • Disabling a resource
      • Deleting a resource
    • Origin groups
      • Creating an origin group
      • Editing an origin group
      • Connecting an origin group to a resource
      • Deleting an origin group
  • Practical guidelines
    • All practical guidelines
    • Publishing game updates
    • Integrating an L7 load balancer with the CDN and Object Storage
    • Blue-green and canary deployment of service versions
  • Concepts
    • Service overview
    • Resource
    • Origins and origin groups
    • Exchanging data between clients and the CDN
      • Overview
      • TLS certificates
      • CORS
      • Compressing content
    • Exchanging data between the CDN and origins
      • Overview
      • Host header
      • Content segmentation
      • Origin shielding
    • Caching content
    • Exporting logs
    • Quotas and limits
  • Access management
  • Troubleshooting
  • API reference
    • Authentication in the API
    • gRPC
      • Overview
      • CacheService
      • OriginGroupService
      • OriginService
      • ProviderService
      • RawLogsService
      • ResourceService
      • OperationService
    • REST
      • Overview
      • Cache
        • Overview
        • prefetch
        • purge
      • OriginGroup
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • Origin
        • Overview
        • create
        • delete
        • get
        • list
        • update
      • Provider
        • Overview
        • activate
        • listActivated
      • RawLogs
        • Overview
        • activate
        • deactivate
        • get
        • update
      • Resource
        • Overview
        • create
        • delete
        • get
        • getProviderCName
        • list
        • update
  • Pricing policy
  1. Step-by-step instructions
  2. Origin groups
  3. Creating an origin group

Creating an origin group

Written by
Yandex Cloud

    To create an origin group:

    Management console
    CLI
    Terraform
    1. In the management console, select the folder where you wish to create a resource group.
    2. Select Cloud CDN.
    3. On the left-hand panel, select Origin groups.
    4. Click Create origin group.
    5. Enter the name of the group.
    6. Configure Origins:
      • Specify the Origin type: Server, Bucket, or L7 load balancer. For more information about types, see Origins and origin groups.
      • Specify an origin.
      • Select the Priority: Active or Backup. For more information about priorities, see Origin groups.
      • Add other origins if needed.
    7. Click Create.

    If you don't have the Yandex Cloud command line interface yet, install and initialize it.

    The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

    1. View a description of the CLI origin group create command:

      yc cdn origin-group create --help
      
    2. Create an origin group in the default folder:

      yc cdn origin-group create --name <group name> \
        --origin source=<origin IP address or domain name>,enabled=true \
        --origin source=<origin IP address or domain name>,enabled=true,backup=true
      

      Where origin: The origin specification:

      • source: The origin IP address or domain name.
      • enabled: Flag indicating whether an origin is enabled.
      • backup: Flag indicating whether an origin is a backup. For more information about priorities, see Origin groups.

      Result:

      id: "89018"
      folder_id: b1g86q4m5vej8lkljme5
      name: test-group
      use_next: true
      origins:
      - id: "559295"
        origin_group_id: "89018"
        source: www.example2.com
        enabled: true
        backup: true
      - id: "559294"
        origin_group_id: "89018"
        source: www.example1.com
        enabled: true
      

      For more information about the yc cdn origin-group create command, see the CLI reference.

    If you don't have Terraform, install it and configure the Yandex Cloud provider.

    1. Describe the properties of the yandex_cdn_origin_group resource in the configuration file:

      Example configuration file structure:

      provider "yandex" {
        token     = "<OAuth>"
        cloud_id  = "<cloud ID>"
        folder_id = "<folder ID>"
        zone      = "<default availability zone>"
      }
      
      resource "yandex_cdn_origin_group" "my_group" {
        name = "<group name>"
        use_next = true
        origin {
         source = "<origin 1 IP address or domain name>"
        }
        origin {
         source = "<origin 2 IP address or domain name>"
        }
        origin {
         source = "<origin 3 IP address or domain name>"
         backup = false
        }
      }
      

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

    2. Make sure the settings are correct.

      1. Using the command line, navigate to the folder that contains the up-to-date Terraform configuration files with an infrastructure plan.

      2. Run the command:

        terraform validate
        

        If there are errors in the configuration files, Terraform will point to them.

    3. Create an origin group.

      1. Run the command to view planned changes:

        terraform plan
        

        If the resource configuration descriptions are correct, the terminal will display a list of the resources to modify and their parameters. This is a test step. No resources are updated.

      2. If you are happy with the planned changes, apply them:

        1. Run the command:

          terraform apply
          
        2. Confirm the update of resources.

        3. Wait for the operation to complete.

    Was the article helpful?

    Language / Region
    Yandex project
    © 2023 Yandex.Cloud LLC