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 Managed Service for YDB
  • Getting started
  • Access management
  • Monitoring metrics
  • Audit Trails events
    • Introduction to YDB via Terraform
    • Getting authentication credentials
    • Installing and configuring Terraform and a provider to connect to YDB
    • Creating configuration files and connecting to YDB
    • Creating and editing parameters of a serverless database
    • Creating and editing parameters of a dedicated database
    • Creating row tables in a database
    • Creating document tables in a database
    • Creating a changefeed for a table
    • Creating secondary indexes in row tables
    • Managing YDB topic configurations
  • FAQ
  • Public materials
  1. Working with YDB via Terraform
  2. Creating and editing parameters of a dedicated database

Creating and editing parameters of a dedicated database

Written by
Yandex Cloud
Improved by
Max Z.
Updated at January 20, 2025

To create a dedicated database, use theyandex_ydb_database_dedicated resource.

Description of the yandex_ydb_database_dedicated resourceDescription of the yandex_ydb_database_dedicated resource

Add the following code section to the project configuration file after the provider initialization section:

resource "yandex_ydb_database_dedicated" "my_database_2" {
  name = "dedicated-base"
  folder_id = "<folder_ID_in_Yandex_Cloud>"
  
  resource_preset_id = "medium"

  location_id = "ru-central1"
  network_id  = "enpv06v9b6og********" # ID of the network to host the new DB
  subnet_ids = [
    "e2lekh3vqf1p********", "e9bmliplcipm********", "b0cm0qpcf4q5********" 
  ]
  
  scale_policy {
    fixed_scale {
      size = 2 # Number of VMs in the DB
    }
  }

  storage_config {
    group_count = 1
    storage_type_id = "ssd"
  }
}

Properties of the yandex_ydb_database_dedicated resource fields:

  • name: Name of the database. It may contain lowercase Latin letters, digits, and hyphens. The first character must be a letter, the last one cannot be a hyphen. It must be from 3 to 63 characters long. This is a required parameter.
  • folder_id: ID of the Yandex Cloud folder to create the database in. This is a required parameter.
  • resource_preset_id: Name of the VM configuration template. Available templates: medium, medium-m64, medium-m96, large, xlarge. They differ in the processor platform, number of vCPUs, and amount of RAM. This tutorial gives a detailed description of the VM template configurations.
  • location_id: Database location according to the availability zone set in the provider initialization block.
  • network_id: Cloud network ID in the Yandex Cloud deployment.
  • subnet_ids: List of IDs for subnets where the database will operate. It contains all subnets belonging to the network in the Yandex Cloud deployment.

Properties of the scale_policy section fields:

  • fixed_scale.size: Number of VMs the database will use. The minimum recommended number of VMs is two (for the production environment).

Properties of the storage_config section fields:

  • group_count: Number of storage groups which define the total storage size. One storage group is a multiple of 100 GB of disk space. You can only set integer values for storage groups.
  • storage_type_id: Storage type, either ssd or hdd.

Once you have filled out all the fields of the yandex_ydb_database_dedicated resource and nested sections, run terraform validate to make sure the configuration file is error-free. Then run terraform plan to reconcile the changes contained in the configuration file with the current infrastructure configuration. Finally, run terraform apply to deploy the resource you are creating in the cloud.

The time needed to create a dedicated database depends on the number of allocated VM instances and storage groups. To delete a dedicated database, remove the yandex_ydb_database_dedicated resource from the configuration file and run this command sequence: terraform validate, terraform plan, and terraform apply.

Was the article helpful?

Previous
Creating and editing parameters of a serverless database
Next
Creating row tables in a database
Yandex project
© 2025 Yandex.Cloud LLC