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 Studio
    • 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.
Service page
Yandex Managed Service for YDB
Documentation
Yandex Managed Service for YDB
  • Getting started
    • Overview
    • Connecting to a database using the YDB CLI
    • Database management
    • 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 July 29, 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 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.

    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 the 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, go to the directory where you edited the configuration file.

      2. Make sure the configuration file is correct 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
        

        You will see a detailed list of resources. No changes will be made at this step. If the configuration contains any errors, Terraform will show them.

      4. Apply the changes:

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

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
Database management
Next
Managing tables and directories
© 2025 Direct Cursus Technology L.L.C.