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
    • 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 Managed Service for YDB
  • Getting started
    • Overview
    • Connecting to a database using the YDB CLI
    • Managing databases
    • Migrating a database to a different availability zone
    • Managing tables and directories
    • Reading and writing data
    • Monitoring DB status
  • Access management
  • Monitoring metrics
  • Audit Trails events
  • FAQ
  • Public materials
  1. Step-by-step guides
  2. Migrating a database to a different availability zone

Migrating a YDB database to a different availability zone

Written by
Yandex Cloud
Updated at May 5, 2025

Migration to another availability only makes sense for a YDB dedicated database. Serverless databases are not migrated between availability zones.

A dedicated database is hosted in multiple availability zones of the central Russia ru-central1 region. You can replace one zone with another. To do this:

  1. Create a subnet in the availability zone to which you are migrating your database.

  2. Move the YDB database to a new set of subnets:

    Yandex Cloud CLI
    Terraform

    If you do not have the Yandex Cloud CLI 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.

    Run this command:

    yc ydb database update <DB_name> \
       --subnet-id <subnet_ID_in_ru-central1-a_availability_zone> \
       --subnet-id <subnet_ID_in_ru-central1-b_availability_zone> \
       --subnet-id <subnet_ID_in_ru-central1-d_availability_zone>
    

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

    1. Open the Terraform configuration file containing the infrastructure plan and edit the fragment with the DB description:

      resource "yandex_ydb_database_dedicated" "<DB_name>" {
         ...
         subnet_ids = [<subnet_IDs>]
         ...
      }
      

      In the subnet_ids parameter, list the subnet IDs in the ru-central1-a, ru-central1-b, and ru-central1-d availability zones, separated by commas.

    2. Apply the changes:

      1. In the terminal, change to the folder where you edited the configuration file.

      2. Make sure the configuration file is correct using the command:

        terraform validate
        

        If the configuration is correct, the following message is returned:

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

        terraform plan
        

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

      4. Apply the configuration changes:

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

Migrating to Yandex Data TransferMigrating to Yandex Data Transfer

If are using a transfer of the Replication or Snapshot and increment type and your database serves as an endpoint, restart the transfer using one of two methods after changing subnets in the database:

To restart a transfer, choose one of the two methods:

  • Deactivate the transfer and wait for its status to change to Stopped. Next, reactivate the transfer and wait for its status to change to Replicating.
  • Update any setting for the transfer or endpoint.

For more information, see Migrating a Data Transfer transfer and endpoints to a different availability zone.

Was the article helpful?

Previous
Managing databases
Next
Managing tables and directories
© 2025 Direct Cursus Technology L.L.C.