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
    • Education and Science
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
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 serverless database

Creating and editing parameters of a serverless database

Written by
Yandex Cloud
Updated at May 15, 2025

To create a serverless database, use the yandex_ydb_database_serverless resource.

Description of the resourceDescription of the yandex_ydb_database_serverlessresource

The configuration file in your project should already include a code section for initializing providers. Open the file and add this code:

resource "yandex_ydb_database_serverless" "database1" {
  name                = "test-ydb-serverless"
  deletion_protection = true

  serverless_database {
    enable_throttling_rcu_limit = false
    provisioned_rcu_limit       = 10
    storage_size_limit          = 50
    throttling_rcu_limit        = 0
  }
}

Note that the resource initialization strings consist of three parts:

  • The resource keyword.
  • Resource name enclosed in quotes: "yandex_ydb_database_serverless".
  • Resource internal ID within the configuration file: "database1" (not the database name in the cloud).

The resource ID together with its name serve as an address for retrieving a field of the created resource, as is described further below. The yandex_ydb_database_serverless resource has the following field properties:

  • name: Database name. 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 setting.
  • deletion_protection: Database deletion protection (does not protect the database contents). The default value is false.
  • enable_throttling_rcu_limit: Introduce a throughput limit. This is an optional parameter. The default value is false.
  • throttling_rcu_limit: Limit on request units consumed per second. This is an optional parameter. The default value is 0.
  • provisioned_rcu_limit: Request units per second charged on an hourly basis according to the service plan. If set to 0, hourly billing is off. This is an optional parameter. The default value is 0.
  • storage_size_limit: Amount of data, GB. This is an optional parameter. The default value is 50.

Save the file and run the terraform validate command. This command checks all files in the project directory for errors. If there are no errors, the terminal will output this message: Success! The configuration is valid. If there are errors, the terminal will output a code section containing errors and specific erroneous lines of code.

If there are no errors, run the terraform plan command. This command will create a plan for infrastructure changes and generate a report with the resources to be created. No real cloud resources are created at this stage. Use the terraform apply command to apply changes and create actual cloud resources. To confirm the action, enter yes in the terminal.

Terraform will create all required resources. You can check the update using the management console or this CLI command: yc ydb database get <database_name>. The terminal will display information about the created database.

If you need to reconfigure an existing database, edit the configuration file and run this command sequence: terraform validate, terraform plan, and terraform apply. For example, you can change the database name (name), data storage limit (storage_size_limit), etc. Warning: if you change the database ID ("database1" in this case), the database will be recreated, and its data will be lost.

Was the article helpful?

Previous
Creating configuration files and connecting to YDB
Next
Creating and editing parameters of a dedicated database
© 2025 Direct Cursus Technology L.L.C.