Integration Change Data Capture (Cloud)
Problem
A cloud-hosted system must send row changes, in near real time, to consumers it does not run: partner platforms, other clouds or on-premises applications. They connect over the public internet, so none of them can have a database connection, and traffic to an outside target leaves through a managed egress gateway that only allows approved FQDNs. The source application usually cannot be changed to emit events.
Solution
Run a cloud-native Change Data Capture (CDC) service beside the source data store. It reads row-level changes (inserts, updates, deletes) from the transaction log and publishes them as events or files to a highly available messaging service or object storage. Consumers read from there asynchronously, stay decoupled from the producer, and never touch the database.
Cloud Paradigm
- Event-Driven Architecture
- Data Streaming and Pipelines
- Decoupled Data Integration
- Serverless Computing (for CDC processing)
- Hybrid Cloud Integration (if source/target are on-premises or across different cloud providers)
Solution Flow
Data Ingestion and Publishing Flow:
- Source Data Store: A backend workload in an internal private subnet changes data in its primary data store (e.g., relational or NoSQL database).
- CDC Service Deployment: A cloud-native CDC service in the Private Subnet (Workloads) holds a secure, read-only connection to the source over private network endpoints, authenticating with a least-privilege managed identity.
- Change Capture & Transformation: The service reads the transaction log or database journal, captures every insert, update and delete as it happens, and converts each into a standard format (e.g., JSON, Avro, Protobuf).
- Event/Data Stream Publishing: It publishes the events in near real time to a highly available, scalable messaging service (e.g., event stream platform, message queue) or to an object storage bucket used for staging.
- Egress Gateway (Optional): If the target sits outside this cloud environment (e.g., a partner's messaging platform), outbound traffic from the CDC service or an internal message broker goes through a Managed NAT / Egress Gateway in a Public Subnet (Perimeter), which enforces FQDN allow-listing and network access controls.
External Consumption Flow:
- External Consumer: An external system, or another internal Backend Workload, connects to the messaging service or object storage over the Public Internet (e.g., TLS, mutual authentication).
- Data Retrieval: The consumer subscribes to the event stream or fetches files from object storage, then updates its own data store or triggers business processes.
- Acknowledgement & State Management: Each consumer acknowledges processed messages and tracks its own consumption state, giving "at-least-once" or "exactly-once" delivery without data loss or duplication.
When to Use
- Row-level changes must reach external or cross-environment consumers in near real time, with no direct database access.
- The source application cannot be changed to emit events, so reading the transaction log or database journal is the only non-invasive option.
- Producers and consumers must be able to scale, change and fail independently.
- Several different consumers need the same change feed and can share one replayable event stream or staging bucket.
- Data crosses organisational or trust boundaries and needs egress controls, TLS and least-privilege authentication.
When NOT to Use
- Consumers need synchronous request-response access to current state, not an asynchronous change feed. An API or query gateway fits better.
- You need a one-off or infrequent bulk migration. A batch ETL job or snapshot export is simpler and cheaper.
- The source store has no accessible transaction log or journal, so reliable change capture is impractical.
- Systems must be strictly and immediately consistent. CDC's eventual, at-least-once delivery adds lag and possible duplicates.
- Downstream systems only need aggregated or heavily transformed data. A materialised view or reporting pipeline avoids streaming raw row changes.
Trade-offs
- Non-invasive change capture vs running and monitoring a CDC service tied to the source database's internals and log formats.
- Decoupled producers and consumers vs no end-to-end transactional guarantee, so consumers must handle ordering and idempotency.
- Near-real-time synchronisation vs the latency, storage and cost of an intermediate messaging service or object store.
- Smaller attack surface (no direct database access) vs the work of securing egress gateways, mutual TLS and cross-boundary authentication.
- Schema-flexible, replayable event streams vs ongoing discipline over schema evolution and dead-letter handling.
Illustrative Scenario
A hypothetical scenario showing how the pattern applies. Not a client case study.
Picture a hypothetical telecommunications carrier that has to pass subscriber provisioning and plan changes from its core customer database to its MVNO partners and to roaming clearinghouses. A cloud-native CDC service in a private workload subnet holds a read-only, managed-identity connection to the database. It tails the transaction log and turns every insert, update and delete into an Avro event. The events go in near real time to a highly available event stream. Because the MVNOs run on external platforms, any outbound traffic to them passes through a managed NAT egress gateway that only allows listed FQDNs. Each partner subscribes over mutual TLS, applies the changes to its own provisioning store, and tracks its own consumption offsets for at-least-once delivery. Activations, SIM swaps and plan upgrades can reach partner systems within seconds, so billing and network entitlements stay aligned. At no point does a partner connect directly to the carrier's core database.
Additional Details
- Data Consistency & Ordering: Publish change events in source order, so related operations keep their transactional consistency and causality.
- Error Handling & Resilience: Use dead-letter queues for unprocessable messages, automatic retries, and observability for failed captures or publications. Run the CDC component in a highly available, fault-tolerant configuration across multiple availability zones.
- Data Formats & Schema Evolution: Standardise on widely adopted, self-describing formats (e.g., JSON, Avro, Protobuf). Agree how schema changes in the source reach downstream consumers.
- Monitoring & Alerting: Monitor the CDC service, the messaging service or object storage, and the consumers. Track latency, throughput, error rates and resource use, and alert on deviations from normal.
- Security Practices: Apply least privilege to all service accounts and roles, audit access logs regularly, encrypt data at rest in object storage, and use client-side encryption for sensitive data.
- Avoid Direct Database Connections: External systems must never connect directly to internal data stores. CDC gives them a decoupled feed instead, which keeps the database hidden and reduces the attack surface.
Security Controls
- Data Source Connectivity: Secure the CDC component's access to the source data store with private network endpoints, least-privilege access controls, and managed identity where available.
- Transport Security: Enforce Transport Layer Security (TLS) 1.2 or higher on every hop: CDC component to source, CDC component to message broker or object storage, and broker or storage to external consumers.
- Authentication & Authorisation:
- Use Managed Identity or role-based access control (RBAC) for the CDC component's connections to the source data store and to the message broker or object storage.
- External consumers authenticate with strong mechanisms such as OAuth 2.0 Client Credentials or mutually authenticated TLS (mTLS). API keys may be used for basic identification or quota management.
- Keep credentials in a secret management service, never in cleartext.
- Perimeter Security (Egress): Route all outbound connections from the cloud environment (e.g., to external message brokers or SFTP services) through a Managed NAT / Egress Gateway in a Public Subnet (Perimeter) that enforces FQDN allow-listing and network access controls.
- Data Integrity & Immutability: Use checksums or content hashing where applicable, especially for file-based transfers. For event streams, keep messages immutable and detect tampering.