Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • 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
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for YDB
  • Getting started
  • Access management
  • Monitoring metrics
  • Audit Trails events
    • Introduction to using 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 reconfiguring a serverless database
    • Creating and reconfiguring a dedicated database
    • Creating row-oriented and column-oriented tables in a database
    • Creating document tables in a database
    • Creating a change data feed for a table
    • Creating secondary indexes in row-oriented tables
    • Managing YDB topic configurations
  • FAQ
  • Public materials
  1. Using YDB via Terraform
  2. Creating a change data feed for a table

Creating a change data feed for a table

Written by
Yandex Cloud
Improved by
Max Z.
Updated at April 24, 2026

Change data capture (CDC) is a process of tracking changes in a particular table and delivering them to a consumer. When you add, update, or delete a table row, CDC generates a change record with the primary key of the row and writes it to the topic partition matching this key. A topic is an entity for storing unstructured messages and delivering them to multiple subscribers. Basically, a topic is a named set of messages.

Description of the yandex_ydb_table_changefeed resourceDescription of the yandex_ydb_table_changefeed resource

You can create a change data feed (CDF) for a table using the yandex_ydb_table_changefeed resource:

resource "yandex_ydb_table_changefeed" "ydb_changefeed" {
  table_id = yandex_ydb_table.test_table_2.id
  name = "changefeed"
  mode = "NEW_IMAGE"
  format = "JSON"

  consumer {
    name = "test_consumer"
  }
}

We used the following fields to create a table CDF:

  • table_id: ID of the table to create a CDF for.
  • name: CDF name.
  • mode: CDF mode. For all available CDF modes, see this guide.
  • format: CDF format. Only JSON format is available.

Full description of all the yandex_ydb_table_changefeed resource fields:

Field name Type Description
table_path string
required
Table path.
connection_string string
required
Connection string, conflicts with table_id.
database_id string
required
Database ID, conflicts with table_path and connection_string.
table_id string
required
Terraform table ID.
name string
required
CDF name.
mode string
required
CDF mode.
format string
required
CDF format.
virtual_timestamps bool
optional
Using virtual timestamps.
retention_period string
optional
Data retention period in a topic, in ISO 8601 format.
consumer array[consumer]
optional
Consumers for a CDF.

When initializing the yandex_ydb_table_changefeed resource, you can only specify one connection field: connection_string, table_path, or table_id. If you specify multiple connection fields, they will come into conflict, e.g., the table_id field with a relative link in <resource>.<ID>.<parameter> format: yandex_ydb_table.test_table_2.id.

The CDF resource contains the consumer section. A consumer is a named entity for reading data from the topic. Each consumer has several setting fields. The main field is name, i.e., the consumer's name. When initializing the yandex_ydb_table_changefeed resource, you can specify multiple consumers, or none; however, in this case, you will not be able to read data from the CDF.

Full list of the consumer section fields:

Field name Type Description
name string
required
Consumer name.
supported_codecs array[string]
optional
Supported data encodings.
starting_message_timestamp_ms integer
optional
UNIX timestamp for the consumer to start reading data from.

The consumer name is used in the SDK or CLI to read data from the topic.

Was the article helpful?

Previous
Creating document tables in a database
Next
Creating secondary indexes in row-oriented tables
© 2026 Direct Cursus Technology L.L.C.