
September 11, 2026
12 min read
By Kokil Thapa | Last reviewed: September 2026
Data replication and sync across clouds is what keeps orders, documents, and session state consistent when your application runs in more than one region or provider. A booking platform on AWS may need a read replica in Singapore while analytics lives on GCP. A law-firm portal may mirror case files to a second bucket for disaster recovery. Without a deliberate replication design, you get stale reads, split-brain writes, and recovery plans that fail the first time you test them. This guide walks through the patterns I use on production systems—database streaming, object sync, event buses, and the operational checks that actually matter. If you are sketching a wider layout, start with our multi-cloud architecture practical guide for context on how data fits the full stack.
What Is Data Replication and Sync Across Clouds?
Replication means one system maintains a copy of data produced elsewhere. Sync means those copies converge toward the same state within a defined time window. Across clouds, the source might be MySQL on a VPS in Kathmandu and the target PostgreSQL on a managed service in Mumbai or Oregon.
The terms overlap but they are not identical. Replication usually describes continuous copying—binlog streaming, logical decoding, or block-level disk sync. Sync often implies bidirectional or scheduled alignment—nightly ETL, object storage replication rules, or CRDT-based client merges.
Three layers show up in almost every multi-cloud data design:
- Transactional stores — MySQL 9.7, PostgreSQL 18, or MariaDB 12.3 holding orders, users, and bookings.
- Object and file storage — PDFs, images, and exports that must mirror between buckets.
- Event streams — change feeds that decouple writers from downstream consumers in another cloud.
On a Laravel booking system I maintain, the app writes to a primary MySQL instance. A read replica in another region serves reporting queries. Document uploads replicate to a secondary object store nightly. That split keeps the user-facing path fast while DR stays independent of the primary VPC.
How Do You Choose a Replication Strategy for Multi-Cloud?
Strategy follows recovery goals, write patterns, and how much inconsistency you can tolerate. Start with RPO (maximum acceptable data loss) and RTO (maximum acceptable downtime). Those two numbers narrow the topology quickly.
| Pattern | Write Model | Typical RPO | Complexity | Best For |
|---|---|---|---|---|
| Async one-way replica | Single primary | Seconds to minutes | Low | Read scaling, warm DR standby |
| Semi-sync / quorum | Single primary, ack from replica | Near zero on ack | Medium | Finance, inventory ledgers |
| Active-passive failover | One writer at a time | Minutes (manual promote) | Medium | Regulated workloads, simpler ops |
| Active-active multi-write | Multiple primaries | Depends on conflict rules | High | Global low-latency writes |
| Event-sourced sync | Append-only log | Event lag bound | Medium–High | Microservices, audit trails |
For most Nepal-facing SaaS products, async replication to a secondary region is the sane default. Active-active looks attractive on paper. In practice it demands conflict resolution, clock skew handling, and runbooks your two-person ops team may not want to own. Our active-active vs active-passive multi-cloud article compares failover mechanics in more detail.
Hybrid setups—on-prem MySQL plus a cloud read replica—still appear in budget-sensitive deployments. Treat the cloud side as downstream only until you have tested promotion and DNS cutover. The hybrid cloud vs multi-cloud differences guide clarifies when a single-provider hybrid beats true multi-cloud.
Decision checklist before you commit
- Can all writes go through one primary without unacceptable latency for remote users?
- Do you need cross-cloud reads only, or cross-cloud writes?
- Is the data relational, blob, or event-shaped—and does the tool match?
- Who promotes the replica during failover, and how is split-brain prevented?
- Have you priced egress between providers? Cross-cloud transfer adds up fast.
How Do You Set Up Database Replication Across Cloud Providers?
Relational replication remains the backbone of cross-cloud sync for Laravel, Symfony, and WordPress backends. The mechanics differ by engine, but the workflow is similar: enable logical or physical change capture, ship changes over TLS, apply on the replica, monitor lag.
MySQL binary log replication
MySQL replication uses the binary log on the primary and a replication thread on the replica. For cross-cloud setups, use GTID-based replication so failover and re-pointing are less fragile. Official guidance lives in the MySQL 9.7 replication documentation.
On the primary, confirm binlog format and server ID uniqueness:
# /etc/mysql/mysql.conf.d/mysqld.cnf (primary)
server-id = 1
log_bin = mysql-bin
binlog_format = ROW
gtid_mode = ON
enforce_gtid_consistency = ON
Create a dedicated replication user with minimal privileges:
CREATE USER 'repl'@'%' IDENTIFIED BY 'strong-random-password';
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repl'@'%';
FLUSH PRIVILEGES;
On the replica in the second cloud, point replication at the primary's public or VPN-routed endpoint:
CHANGE REPLICATION SOURCE TO
SOURCE_HOST='primary.example.com',
SOURCE_USER='repl',
SOURCE_PASSWORD='strong-random-password',
SOURCE_AUTO_POSITION=1,
SOURCE_SSL=1;
START REPLICA;
SHOW REPLICA STATUS\G
Watch Seconds_Behind_Source and IO/SQL thread state. A stuck SQL thread usually means schema drift— a column added on primary but not replica. Our MySQL master-slave replication setup and binary logs for replication and backup posts cover baseline tuning and retention.
PostgreSQL logical and physical replication
PostgreSQL 18 supports streaming replication for byte-level sync and logical replication for selective tables or cross-version upgrades. Logical decoding fits multi-cloud when you replicate a subset of schemas to an analytics warehouse.
# postgresql.conf on primary
wal_level = logical
max_replication_slots = 4
max_wal_senders = 4
# pg_hba.conf — restrict to replica IP
host replication repl 10.20.0.0/24 scram-sha-256
Create a publication on the primary and a subscription on the cloud replica. The PostgreSQL 18 logical replication docs describe slot management and conflict behaviour on subscribers that also accept writes.
For HA clusters spanning zones within one provider, see our PostgreSQL replication and high availability guide. Cross-provider setups add network latency and firewall rules— treat the replication link like production traffic with monitoring and alerting.
Object storage and file sync
Database replication does not copy S3-style objects. Use provider-native replication— AWS S3 Cross-Region Replication, GCS dual-region buckets—or tools like rclone sync in cron with versioning enabled on both sides.
On legal-tech portals where clients upload affidavits and scans, I replicate buckets to a secondary region with versioning and lifecycle rules. Deletes on primary should not instantly purge DR copies. Pair object sync with our Docker volumes and persistent data notes if containers mount local uploads before cloud push.
Cache and session layers
Redis 8.10 is usually not replicated across clouds for session storage. Replicate the source of truth instead, or use a global cache with explicit TTL and stampede protection. Our Redis caching and data structures article explains when cache coherency matters. For cross-region session affinity, prefer sticky load balancing plus centralized Redis in one region over multi-master Redis unless you have dedicated ops capacity.
How Do You Handle Conflict Resolution and Ordering in Cross-Cloud Sync?
Single-primary replication avoids most conflicts— the replica is read-only until promotion. Active-active or bidirectional sync introduces collisions when two regions update the same row.
Common resolution policies:
- Last-write-wins (LWW) — compare
updated_attimestamps; simple but clock skew can pick the wrong winner. - Primary-region wins — Nepal HQ overrides branch edits; good for master data.
- Application merge — field-level rules (inventory subtracts, text fields concatenate).
- CRDTs — for counters and collaborative edits; rare in typical PHP/Laravel stacks.
Event-driven sync reduces direct database coupling. Producers write to Kafka or NATS; consumers in another cloud apply idempotent handlers. Duplicate delivery is expected— use natural keys or idempotency tokens in your Laravel jobs queue.
Secrets for replication users belong in a vault, not plain .env files on each server. Cross-cloud credential sprawl is a common audit finding. See multi-cloud secrets management for rotation patterns that work with CI pipelines.
Schema changes need a defined order. Run migrations on the primary, wait for replication to catch up, then validate replica schema parity before enabling writes elsewhere. Skipping this step breaks SQL replication threads silently until peak traffic hits.
How Do You Monitor, Test, and Operate Cross-Cloud Replication?
Replication that nobody monitors is backup theatre. Instrument lag, thread health, disk space on replicas, and replication slot bloat for PostgreSQL logical setups.
Metrics that matter
- Replication lag — seconds behind primary; alert before users notice stale dashboards.
- Replication thread state — IO/SQL errors in MySQL;
pg_stat_replicationon Postgres. - WAL/binlog disk usage — a full disk stops the primary.
- Egress bandwidth and cost — cross-cloud bytes are billed; track trends.
- Checksum or row-count spot checks — nightly compare on critical tables.
Export metrics to Prometheus or your cloud monitor. Page on-call when lag exceeds business RPO, not when the site is already wrong.
Failover drills
Run a controlled promotion at least quarterly. Steps: stop writes, verify lag zero, promote replica, repoint application DNS or connection strings, confirm read/write paths, document time taken. Our backup and disaster recovery strategy on the cloud and multi-cloud disaster recovery strategy posts include checklist templates.
Automate infrastructure with Terraform modules per cloud, but keep replication config explicit. Blind terraform apply on database resources can recreate instances and break replication chains. See manage multi-cloud state with Terraform for state file boundaries.
Region choice for Nepal-facing workloads
Replication target region affects latency for Kathmandu users and compliance posture. A replica in ap-south-1 (Mumbai) often beats US-East for read traffic serving Nepal. Our choosing a cloud region for Nepal users guide covers latency and data-residency trade-offs without overclaiming local presence.
For global traffic steering once replicas exist in multiple regions, pair replication with global load balancing across cloud providers so reads hit the nearest healthy copy.
Application-level safeguards
Laravel apps should read from replica connections only for reporting endpoints—not for payment confirmation or inventory deduction unless you accept lag. Configure a read/write split in config/database.php:
'mysql' => [
'read' => [
'host' => [env('DB_READ_HOST', 'replica.example.com')],
],
'write' => [
'host' => [env('DB_WRITE_HOST', 'primary.example.com')],
],
'sticky' => true,
// ...driver, database, credentials
],
Use sticky => true so a write in the same request cycle reads from primary afterward. That prevents the user from paying and immediately seeing an old balance from a lagging replica.
When debugging replication payloads or webhook bodies during integration work, a local JSON formatter tool saves time validating event shapes before they hit cross-cloud consumers.
Key Takeaways
- Define RPO and RTO first— they determine whether async replica, active-passive, or active-active fits.
- Use GTID MySQL or PostgreSQL logical replication with TLS; never expose replication accounts to the open internet.
- Replicate objects and events separately from relational data; one tool rarely covers all three layers.
- Run primary-first migrations and alert on lag before users report stale reads.
- Quarterly failover drills turn replication from hope into a tested recovery path.
- Budget cross-cloud egress and instrument costs alongside lag metrics.
People Also Ask
What is the difference between replication and synchronization?
Replication continuously copies changes from a source to one or more targets, often asynchronously. Synchronization aligns datasets so they match, which may involve bidirectional updates, scheduled jobs, or conflict resolution. In multi-cloud projects, replication handles the live copy; sync jobs reconcile blobs or reference tables that replication skips.
Can you replicate MySQL across AWS and Google Cloud?
Yes. Run standard MySQL replication over a VPN or Cloud VPN connection between VPC and GCP network. The replica treats the AWS primary like any remote master. Watch latency, secure the replication user, and confirm firewall rules allow port 3306 only from the replica subnet.
How much does cross-cloud data transfer cost?
Egress fees vary by provider and region. Replication of a 100 GB daily change set can cost hundreds of USD per month before compute. Use compression, replicate only changed tables where possible, and place replicas in regions with cheaper peering. FinOps dashboards help catch drift early.
Is active-active replication worth it for small teams?
Usually no. Active-active adds conflict resolution, split-brain risk, and heavier ops. Most small teams—including many Nepal SaaS products—do better with a single write region plus async read replicas and a documented failover runbook.
Ship Replication You Can Trust in Production
Data replication and sync across clouds is not a checkbox on a migration slide. It is ongoing engineering: topology choice, secured replication links, schema discipline, and drills that prove RPO claims. Start with one async replica and measured lag alerts before chasing active-active complexity. If you want help designing replication for a Laravel booking platform, legal-tech portal, or multi-region store, review our Adventure Third Pole Trek portfolio case for a production booking stack, or explore enterprise application development services and support and maintenance for long-term ops. Contact us to map replication to your RPO, budget, and team size—we will recommend boring infrastructure that survives real outages.
Frequently Asked Questions
0 Comments
Leave a comment
Your email is not published. Comments appear once they have been read. Sign in to have your details filled in.

