Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
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
  • Tools
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • 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 July 14, 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, navigate to 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 for the canary release to process.
  6. In the Variables for canary release field, list the variables and their values to use in the canary release.
  7. Click Save.

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-name or --folder-id parameter.

To set up a canary release:

  1. Edit the OpenAPI specification file or create a new one, if required.

  2. View the 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 for the canary release to process.
    • --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 relevant documentation on the Terraform website or its mirror.

If you do not have Terraform yet, install it and configure the 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 for the canary release to process.
    • variables: Variables for the canary release, listed as key=value.

    For more information about yandex_api_gateway properties in Terraform, see this Terraform article.

  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 their properties. No changes will be made at this step. If the configuration contains any errors, Terraform will point them out.

  4. Apply the changes:

    terraform apply
    
  5. Type yes and press Enter to confirm the changes.

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 alsoSee 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
© 2025 Direct Cursus Technology L.L.C.