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.
Terraform in Yandex Cloud
  • Getting started
  • Solution library
    • Overview
    • Release notes
          • ydb_database_dedicated
          • ydb_database_iam_binding
          • ydb_database_serverless
          • ydb_table
          • ydb_table_changefeed
          • ydb_table_index
          • ydb_topic

In this article:

  • Example usage
  • Schema
  • Required
  • Optional
  • Read-Only
  • Nested Schema for scale_policy
  • Nested Schema for scale_policy.auto_scale
  • Nested Schema for scale_policy.auto_scale.target_tracking
  • Nested Schema for scale_policy.fixed_scale
  • Nested Schema for storage_config
  • Nested Schema for location
  • Nested Schema for location.region
  • Nested Schema for timeouts
  • Import
  1. Terraform reference
  2. Resources
  3. Managed Service for YDB
  4. Resources
  5. ydb_database_dedicated

yandex_ydb_database_dedicated (Resource)

Written by
Yandex Cloud
Updated at September 11, 2025
  • Example usage
  • Schema
    • Required
    • Optional
    • Read-Only
    • Nested Schema for scale_policy
    • Nested Schema for scale_policy.auto_scale
    • Nested Schema for scale_policy.auto_scale.target_tracking
    • Nested Schema for scale_policy.fixed_scale
    • Nested Schema for storage_config
    • Nested Schema for location
    • Nested Schema for location.region
    • Nested Schema for timeouts
  • Import

Yandex Database (dedicated) resource. For more information, see the official documentation.

Example usageExample usage

//
// Create a new YDB Dedicated Database.
//
resource "yandex_ydb_database_dedicated" "database1" {
  name      = "test-ydb-dedicated"
  folder_id = data.yandex_resourcemanager_folder.test_folder.id

  network_id = yandex_vpc_network.my-inst-group-network.id
  subnet_ids = ["${yandex_vpc_subnet.my-inst-group-subnet.id}"]

  resource_preset_id  = "medium"
  deletion_protection = true

  scale_policy {
    fixed_scale {
      size = 1
    }
  }

  storage_config {
    group_count     = 1
    storage_type_id = "ssd"
  }

  location {
    region {
      id = "ru-central1"
    }
  }
}
//
// Create a new YDB Dedicated Database with auto-scale policy.
//
resource "yandex_ydb_database_dedicated" "database1" {
  name      = "test-ydb-dedicated"
  folder_id = data.yandex_resourcemanager_folder.test_folder.id

  network_id = yandex_vpc_network.my-inst-group-network.id
  subnet_ids = ["${yandex_vpc_subnet.my-inst-group-subnet.id}"]

  resource_preset_id  = "medium"
  deletion_protection = true

  scale_policy {
    auto_scale {
      min_size = 2
      max_size = 8
      target_tracking {
        cpu_utilization_percent = 70
      }
    }
  }

  labels = {
    # enable preview feature
    enable_autoscaling = "1"
  }

  storage_config {
    group_count     = 1
    storage_type_id = "ssd"
  }

  location {
    region {
      id = "ru-central1"
    }
  }
}

SchemaSchema

RequiredRequired

  • name (String) The resource name.
  • network_id (String) The VPC Network ID of subnets which resource attached to.
  • resource_preset_id (String) The Yandex Database cluster preset. Available presets can be obtained via yc ydb resource-preset list command.
  • scale_policy (Block List, Min: 1, Max: 1) Scaling policy for the Yandex Database cluster. (see below for nested schema)
  • storage_config (Block List, Min: 1, Max: 1) A list of storage configuration options for the Yandex Database cluster. (see below for nested schema)
  • subnet_ids (Set of String) The list of VPC subnets identifiers which resource is attached.

OptionalOptional

  • assign_public_ips (Boolean) Whether public IP addresses should be assigned to the Yandex Database cluster.
  • deletion_protection (Boolean) The true value means that resource is protected from accidental deletion.
  • description (String) The resource description.
  • folder_id (String) The folder identifier that resource belongs to. If it is not provided, the default provider folder-id is used.
  • labels (Map of String) A set of key/value label pairs which assigned to resource.
  • location (Block List, Max: 1) Location for the Yandex Database cluster. (see below for nested schema)
  • location_id (String) Location ID for the Yandex Database cluster.
  • security_group_ids (Set of String) The list of security groups applied to resource or their components.
  • sleep_after (Number)
  • timeouts (Block, Optional) (see below for nested schema)

Read-OnlyRead-Only

  • created_at (String) The creation timestamp of the resource.
  • database_path (String) Full database path of the Yandex Database cluster. Useful for SDK configuration.
  • id (String) The ID of this resource.
  • status (String) Status of the Yandex Database cluster.
  • tls_enabled (Boolean) Whether TLS is enabled for the Yandex Database cluster. Useful for SDK configuration.
  • ydb_api_endpoint (String) API endpoint of the Yandex Database cluster. Useful for SDK configuration.
  • ydb_full_endpoint (String) Full endpoint of the Yandex Database cluster.

Nested Schema for Nested Schema for scale_policy

Optional:

  • auto_scale (Block List, Max: 1) Auto scaling policy for the Yandex Database cluster. This is a preview feature, and you need to enable it using the label enable_autoscaling=1. (see below for nested schema)
  • fixed_scale (Block List, Max: 1) Fixed scaling policy for the Yandex Database cluster. (see below for nested schema)

Nested Schema for Nested Schema for scale_policy.auto_scale

Required:

  • max_size (Number) Maximum number of nodes to which autoscaling can scale the database.
  • min_size (Number) Minimum number of nodes to which autoscaling can scale the database.
  • target_tracking (Block List, Min: 1, Max: 1) A target tracking scaling policy automatically scales the capacity of your Yandex Database cluster based on a target metric value. (see below for nested schema)

Nested Schema for Nested Schema for scale_policy.auto_scale.target_tracking

Required:

  • cpu_utilization_percent (Number) A percentage of database nodes average CPU utilization.

Nested Schema for Nested Schema for scale_policy.fixed_scale

Required:

  • size (Number) Number of instances for the Yandex Database cluster.

Nested Schema for Nested Schema for storage_config

Required:

  • group_count (Number) Amount of storage groups of selected type for the Yandex Database cluster.
  • storage_type_id (String) Storage type ID for the Yandex Database cluster. Available presets can be obtained via yc ydb storage-type list command.

Nested Schema for Nested Schema for location

Optional:

  • region (Block List, Max: 1) Region for the Yandex Database cluster. (see below for nested schema)

Nested Schema for Nested Schema for location.region

Required:

  • id (String) Region ID for the Yandex Database cluster.

Nested Schema for Nested Schema for timeouts

Optional:

  • default (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

ImportImport

The resource can be imported by using their resource ID. For getting the resource ID you can use Yandex Cloud Web Console or YC CLI.

# terraform import yandex_ydb_database_dedicated.<resource Name> <resource Id>
terraform import yandex_ydb_database_dedicated.my_ydb ...

Was the article helpful?

Previous
ydb_database_serverless
Next
ydb_database_iam_binding
© 2025 Direct Cursus Technology L.L.C.