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
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex API Gateway
  • Getting started
    • All guides
    • Creating an API gateway
      • Updating API gateways and their specifications
      • Adding a domain
      • Specifying a cloud network
      • Setting up variables
      • Setting up a canary release
      • Viewing monitoring charts
      • Removing a domain
      • Migration to the ru-central1-d availability zone
      • Deleting an API gateway
    • Viewing operations with service resources
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ
  1. Step-by-step guides
  2. Managing an API gateway
  3. Setting up a canary release

Setting up a canary release

Written by
Yandex Cloud
Updated at May 13, 2025

You can only set up a canary release for OpenAPI specifications with variables (see Specification parameterization).

Management console
CLI
Terraform
API
  1. In the management console, go the folder containing the API gateway.
  2. Select API Gateway.
  3. In the API gateway row, click and select Edit.
  4. Under Variable settings, enable canary release.
  5. In the Share of requests in canary release field, specify the percentage of requests to be processed by the canary release.
  6. In the Variables for canary release field, list the variables and their values to be used in the canary release.
  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.

To set up a canary release:

  1. If necessary, edit the OpenAPI specification file or create a new one.

  2. View a description of the CLI command for updating an API gateway:

    yc serverless api-gateway update --help
    
  3. Specify the API gateway ID or name and the canary release parameters in the command below:

    yc serverless api-gateway update \
      --id <API_gateway_ID> \
      --canary-weight <percentage_of_requests> \
      --canary-variables=<list_of_variables>
    

    Where:

    • --canary-weight: Percentage of requests to be processed by the canary release.
    • --canary-variables: Variables for the canary release, listed as key=value.

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the documentation on the Terraform website or mirror website.

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

To set up a canary release:

  1. Open the Terraform configuration file and add the canary section to it:

    resource "yandex_api_gateway" "<API_gateway_name>" {
    ...
    canary {
      weight    = <percentage_of_requests>
      variables = {
        <list_of_variables>
      }
    }
    

    Where:

    • weight: Percentage of requests to be processed by the canary release.
    • variables: Variables for the canary release, listed as key=value.

    For more information about the yandex_api_gateway resource parameters in Terraform, see the provider documentation.

  2. Check the configuration using this command:

    terraform validate
    

    If the configuration is correct, you will get this message:

    Success! The configuration is valid.
    
  3. Run this command:

    terraform plan
    

    The terminal will display a list of resources with parameters. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.

  4. Apply the configuration changes:

    terraform apply
    
  5. Confirm the changes: type yes into the terminal and press Enter.

You can check the API gateway update using the management console or this CLI command:

yc serverless api-gateway get <API_gateway_name>

To set up a canary release, use the update REST API method for the ApiGateway resource or the ApiGatewayService/Update gRPC API call.

See also

  • What is a canary release?
  • Canary release of a Cloud Functions function.

Was the article helpful?

Previous
Setting up variables
Next
Adding a label
Yandex project
© 2025 Yandex.Cloud LLC