Cloud and Hybrid Analytics Pipeline Across AWS and Azure
Easy · System Design · Data Engineer · Onsite
Prompt
Architect an enterprise analytics data platform that captures data from live operational systems and delivers trusted, query-ready datasets to BI dashboards, SQL analysts, machine-learning feature pipelines, and downstream operational applications. Expect an implementation-level discussion: at every layer, name the exact open-source frameworks, libraries, or managed cloud services you would deploy, compare at least one credible alternative, and explain the trade-offs driving your choice.
Because source types, daily data volumes, latency SLAs, consumer profiles, and data-governance rules are open-ended, establish concrete baseline assumptions upfront (for instance, ~800M daily telemetry events, transactional order/reservation databases, partner SFTP drops, and rate-limited SaaS APIs across daily, hourly, and 5-minute freshness tiers) and state how different requirements would simplify your stack.
Then walk the design through three progressive stages:
- Single-cloud platform: End-to-end ingestion, layered storage and table formats, partitioning, schema evolution, transformation, orchestration, serving, quality gates, and idempotent backfills on one public cloud.
- Hybrid data-center + cloud topology: Re-architecting when certain operational databases and sensitive records must stay inside on-premises data centers while broader analytics run in the cloud.
- AWS versus Azure & local parity: Implementing the architecture on both AWS and Azure, contrasting structural differences beyond service naming, drawing portability boundaries, and mirroring cloud pipelines locally for development and CI.
Scope & Expectations
- Single-cloud ingestion, lakehouse layers, and defended tooling: Specify per-source ingestion (log-based CDC, event streams, file feeds, REST APIs), open table formats, partitioning, schema evolution, transformation, orchestration, quality validation, and idempotent reruns — defending each tool against a concrete alternative.
- Hybrid boundary connectivity, placement, and security: Handle private WAN connectivity, outbound firewall posture, multi-day local outage buffering, data-classification rules governing what stays or gets tokenized on-premises, workload placement, unified scheduling, and federated identity/auditing.
- AWS vs. Azure mapping and architectural nuances: Map every pipeline component across AWS and Azure and highlight substantive provider differences across table-format ecosystems, hybrid agents, Kafka semantics, storage namespaces, and workload identity.
- Portability boundaries and developer parity: Separate cloud-agnostic engines, formats, and code from provider-specific adapters, weigh the operational cost of portability, and show how laptop and CI setups validate production jobs.
Step-by-step walkthrough
Clarify sources, freshness tiers, consumers, and compliance rules
A good data pipeline design never starts by picking Spark or Kafka—it starts by asking what produces the data, who reads it, how fresh they need it, and what privacy rules apply. Establish concrete baseline assumptions upfront so every tool choice has a clear engineering reason.
Assumed operational sources:
Source type Location Daily volume Key characteristics 10 relational DBs (Oracle, SQL Server: orders, bookings, inventory, finance) On-premises ~4 TB total size; ~50M row changes/day (~50 GB) Live transactional systems; extraction must not slow down customer checkouts Cloud app DBs (PostgreSQL microservices) Cloud ~15 GB/day of row changes (~15M) Newer cloud-native services App & web clickstream (views, playback, clicks, purchases) Cloud HTTPS edge ~800M events/day (~0.5 KB each = ~400 GB/day) Traffic spikes to ~3x average during prime hours Partner file drops (CSV, JSON, Excel from ~30 partners) SFTP uploads ~160 files/day (~40 GB/day) Bursty (01:00–05:00), late arrivals, occasional unannounced column edits Third-party SaaS APIs (CRM, ad spend, payment settlement) Public internet ~12 APIs (~5 GB/day) Strict HTTP rate limits and paginated responses Freshness requirements by consumer (this decides batch vs. streaming per source):
- Daily by 06:00 UTC: Finance close and regulatory reports.
- Hourly: ~200 BI dashboards and ad-hoc SQL tables used by ~500 analysts.
- Within 5 minutes (near-real-time): Operational inventory alerts, booking anomaly detection, and fraud ML features—needed only for order database changes and purchase events.
Privacy, security, and cloud footprint:
- Records contain PII (Personally Identifiable Information, fields like name, email, or street address that can identify a person) and payment tokens.
- Hybrid rule: Raw finance ledgers and unmasked customer PII must remain on-premises by corporate policy and contract; only pseudonymized (tokenized) or aggregated records may cross into the cloud. EU customer data stays in an EU region.
- Cloud strategy: Primary deployment on AWS today, with an Azure environment arriving via acquisition—so core transformation logic and storage formats should stay portable.
How different answers would change the architecture: If every consumer only needed daily data, we would drop streaming entirely and run simple nightly batch extracts at a fraction of the cost. If total volume were 10x smaller (< 50 GB/day) with SQL-only users, loading directly into a single cloud data warehouse (ELT — Extract, Load, Transform) would beat running a multi-engine lakehouse.
Back-of-the-envelope volume, stream, and network math
Before choosing cluster sizes or network links, verify the numbers with simple arithmetic:
1. Daily ingestion & storage footprint Clickstream events: 800,000,000 x 0.5 KB = ~400 GB/day raw DB changes (CDC): 50M on-prem + 15M cloud x ~1 KB = ~65 GB/day raw Partner files + SaaS APIs: 40 GB + 5 GB = ~45 GB/day raw ---------------------------------------------------------------------- Total raw arrival = ~510 GB/day Compressed into Parquet (5x-7x columnar compression) = ~75-100 GB/day 2-year raw ("Bronze") retention: 730 x ~85 GB = ~62 TB Cleaned ("Silver") + aggregated ("Gold") tables = ~68 TB Total object-storage footprint = ~130 TB (moderate!) 2. Event stream throughput Average event rate: 800,000,000 / 86,400 s = ~9,260 events/s (~4.6 MB/s) Peak rate (3x): 3 x 9,260 = ~27,800 events/s (~13.9 MB/s) CDC change rate: 50,000,000 / 86,400 s = ~580/s avg, ~2,900/s during night batches -> A 24-partition Kafka topic (or 24 stream shards with record batching) handles 13.9 MB/s easily with >= 30% headroom. 3. Hybrid on-prem -> cloud network link (1 Gbps private link = 125 MB/s max) Allowed daily outbound data (50 GB CDC + 35 GB files + 35 GB extracts) = ~120 GB/day Steady transfer rate: 120,000 MB / 86,400 s = ~1.4 MB/s (~1.1% of 1 Gbps!) 12-hour link outage backlog: 120 GB x (12 / 24) = ~60 GB queued on-prem Catch-up time using 50 MB/s of spare link capacity = 60,000 MB / 50 = 1,200 s (~20 min) 4. On-prem outage buffer disk (Kafka holding 4 days of 85 GB/day stream traffic, 3x replicated) 85 GB/day x 4 days x 3 replicas = 1,020 GB -> provision ~1.5 TB SSDThree design lessons jump right out of this math:
- Volume (~510 GB/day raw) is moderate: Our hardest problems are correctness (duplicates, late data, schema drift), hybrid security, and cloud portability—not petabyte-scale physics.
- Only 2 of our 5 source types need streaming (orders CDC and purchase events for the 5-minute tier); everything else runs cheaper and simpler as hourly or daily micro-batches.
- A 1 Gbps private link is ~99% idle during normal operation, so hybrid engineering is all about local buffering during link outages and outbound-only firewall safety.
Data contracts and interfaces across producers and consumers
In a data platform, data contracts play the same role as REST APIs in microservices: they define exact schemas, deduplication keys, and completeness markers so producers and consumers do not break each other silently.
1. Streaming event envelope — encoded in Avro or Protobuf and validated against a Schema Registry (a central schema catalog that blocks producers in CI if a change breaks existing readers under
BACKWARDorFULLcompatibility):event_id UUIDv4 generated at the producer (global deduplication key) event_type "purchase" | "page_view" | "video_heartbeat" schema_version integer (e.g. 3) occurred_at UTC timestamp when the user acted (used for event-time partitioning) user_key pseudonymous ID (never raw email or phone number) payload strongly typed nested record for this event_type2. CDC (Change Data Capture) record — CDC means reading row-level inserts, updates, and deletes directly from a database's internal transaction log instead of running heavy
SELECTqueries against live tables:key { order_id: 8420 } -- always populated, even on DELETE before { order_id: 8420, status: "NEW" } -- row state prior to change (or null) after { order_id: 8420, status: "PAID" } -- new row state (null when op = "d") op "c" (create) | "u" (update) | "d" (delete) | "r" (initial snapshot read) _source_position monotonic database log offset (e.g. Oracle SCN or SQL Server LSN) commit_ts UTC transaction commit timestamp on the source database3. File & API landing-zone manifest — batch extractors write data files first and write
_manifest.jsonlast so downstream jobs never ingest a half-uploaded batch:s3://company-landing/<source>/<entity>/ingest_date=2026-11-30/<batch_id>/ part-0001.parquet _manifest.json -> { "row_count": 184200, "bytes": 41920110, "sha256": "...", "cursor_from": "2026-11-30T01:00:00Z", "cursor_to": "2026-11-30T02:00:00Z" }4. Table contract (
contract.yamlalongside transformation code): Declares table owner, column types, per-column PII classification (restricted | confidential | internal), primary key, freshness SLA, and required quality checks.Storage layers (medallion), Apache Iceberg, partitioning, and schema evolution
We organize lake storage into three medallion layers, storing files in Apache Parquet (a compressed columnar file format where analytical queries read only the needed columns) managed by Apache Iceberg (an open table format that adds atomic database-like commits,
MERGEupserts, schema tracking by column ID, and historical snapshot time travel on top of object storage):Layer Purpose Write pattern Retention Bronze (Raw) Exact immutable history of what arrived plus _ingested_at,_batch_id,_source_positionAppend-only 2 years (enables full replay if code has a bug) Silver (Cleaned) Validated, typed, deduplicated current-state tables + SCD Type 2 (Slowly Changing Dimension history rows with valid_from/valid_to); PII tokenizedAtomic MERGEby primary key or partition overwrite2–7 years by domain Gold (Curated) Business star-schema fact and dimension tables ( fact_orders,dim_customer) and pre-computed KPIsRebuilt per date partition by dbtMulti-year reporting history Why Apache Iceberg over alternatives:
- vs. raw Parquet folders + Hive metastore: Plain folders lack atomic multi-file commits (readers see partial writes mid-job), require slow directory listings, and break when columns are renamed. Iceberg commits metadata snapshots atomically in milliseconds.
- vs. Delta Lake: Functionally very close (both give ACID—Atomicity, Consistency, Isolation, Durability—transactions,
MERGE, and time travel). Iceberg is natively supported across AWS engines (Athena, EMR, Glue, Redshift) and Snowflake/Trino; Delta Lake is the native default on Databricks and Microsoft Fabric (we address cross-cloud compatibility in Stage 3). - vs. Apache Hudi: Hudi handles heavy upserts well, but has a smaller SQL warehouse ecosystem and more operational tuning knobs than Iceberg.
Partitioning and small-file control:
- Clickstream events: Partition by
days(occurred_at)using Iceberg hidden partitioning (analysts filterWHERE occurred_at >= ...naturally, and events arriving 2 days late still land in their true event day). Never over-partition byhour x event_type x country, which explodes into millions of tiny kilobyte files that stall object-store reads. - CDC Silver tables: Use Iceberg merge-on-read (writing lightweight positional delete files during frequent
MERGEruns so entire 512 MB Parquet files aren't rewritten every 5 minutes), partitioned bymonths(created_at)plusbucket(32, order_id), paired with a background compaction job every few hours that merges delete files into clean ~256–512 MB Parquet files. - Schema evolution: Additive changes (new nullable column) flow automatically into Bronze via Iceberg column-ID metadata updates; Silver/Gold expose new columns only after updating
contract.yaml. Breaking changes (dropped columns or narrowed types) halt that table's load and quarantine the batch before bad data reaches Gold.
Stage 1: single-cloud architecture and per-source ingestion (AWS)
SOURCES INGESTION LAKEHOUSE (S3 + Iceberg + Glue) SERVING ------------------------------------------------------------------------------------------------------------------------ RDS Postgres --CDC---> Debezium (MSK Connect) ---+ v Web / Mobile --------> HTTPS Collector ------> Amazon MSK (Kafka) + Schema Registry | | | +--> Spark Streaming (EMR) -------> Silver (<=5m fraud/ops) | | +--> Kafka Connect Iceberg Sink --> BRONZE | Partners ---SFTP-----> AWS Transfer Family --> S3 Landing --+ | | SaaS APIs --HTTPS----> Airbyte / Python -----> S3 Landing --+--> Spark Batch (EMR) ---->+--------> SILVER (validate, dedupe, MERGE) | v dbt Core --> GOLD (Redshift) --> BI Dashboards / SQL | Athena / Trino ad-hoc +-------------> ML Features & CRM Sync CONTROL PLANE: Airflow | QUALITY: Great Expectations + dbt tests | GOVERNANCE: Lake Formation + KMS + OpenLineageFor each source type, compare a managed cloud option against an open-source engine:
- Databases -> Debezium (log-based CDC) on MSK Connect: Reads PostgreSQL logical replication slots (and Oracle/SQL Server logs in Stage 2) with minimal source CPU impact and captures hard row deletes. Defended alternatives: AWS DMS (simpler managed setup on AWS, but cannot run on-premises or on Azure and handles complex schema changes less predictably); Fivetran / Qlik Replicate (turnkey commercial connectors, great for small teams but expensive per million rows at 50M+ changes/day);
WHERE updated_at > ?polling (misses hard deletes and hammers source indexes). - Events -> Stateless HTTPS Collector + Amazon MSK (Managed Kafka): Validates schemas at the edge, keys messages by
user_keyto preserve per-user ordering, and speaks standard Kafka wire protocol. Defended alternative: Amazon Kinesis Data Streams + Firehose (zero broker management on AWS, but AWS-proprietary API; we pick MSK so producer/consumer code stays portable to on-prem Kafka and Azure). - Partner files -> AWS Transfer Family (managed SFTP directly backed by S3): Isolates each partner to its own SFTP key and S3 prefix; an S3 event validates checksums and headers against
_manifest.json, moving malformed files toquarantine/. Defended alternative: Self-managed SFTP on EC2 (cheaper at tiny scale, extra OS patching and HA toil). - SaaS APIs -> Airbyte (standard connectors) + Python Airflow tasks (custom APIs): Fetches paginated windows
[cursor_from, cursor_to)with exponential backoff on HTTP429 Too Many Requestsand writes raw JSON +_manifest.jsonto S3 Landing. Defended alternative: Fivetran (zero maintenance, higher volume-based cost).
- Databases -> Debezium (log-based CDC) on MSK Connect: Reads PostgreSQL logical replication slots (and Oracle/SQL Server logs in Stage 2) with minimal source CPU impact and captures hard row deletes. Defended alternatives: AWS DMS (simpler managed setup on AWS, but cannot run on-premises or on Azure and handles complex schema changes less predictably); Fivetran / Qlik Replicate (turnkey commercial connectors, great for small teams but expensive per million rows at 50M+ changes/day);
Deep dive 1: transformations, orchestration, idempotent reruns, and quality gates
Transformation & orchestration choices (each defended against an alternative):
- Bronze -> Silver (
PySparkon Amazon EMR Serverless): Handles heavy deduplication, multi-stream joins, PII tokenization, and IcebergMERGEwithout idle cluster bills, while keeping 100% standard Spark code. Alternatives: AWS Glue (also serverless Spark, slightly tighter AWS wrapper lock-in); Databricks (polished multi-cloud Spark + governance platform, adds a separate vendor contract). - Silver -> Gold (
dbt Corerunning SQL on Amazon Redshift): Lets analysts write modular, version-controlled SQL with built-in dependency graphs and tests, while Redshift handles high-concurrency BI queries reading Silver Iceberg tables via Glue Data Catalog. Alternatives: Snowflake (near-zero tuning across AWS and Azure, separate vendor bill); Athena/Trino alone (cheap for sporadic queries, unpredictable cost/latency under 200 concurrent dashboards). - Orchestration (
Apache Airflow): Schedules interval-bound Python DAGs (Directed Acyclic Graphs, dependency workflows of tasks). Run on MWAA (Managed Workflows for Apache Airflow) for a pure single-cloud setup, and move to Airflow on EKS in Stage 2 so on-premises workers can join. Alternatives: AWS Step Functions (rock-solid serverless state machines, but lacks data-interval backfill semantics and is AWS-only); Dagster (excellent asset-based lineage, smaller enterprise connector ecosystem).
Idempotent reruns and CDC delete tombstones:
A task is idempotent if re-running the
02:00–03:00window after a crash produces the exact same Silver/Gold state without duplicating rows or resurrecting deleted orders. Notice two subtle traps in Debezium CDC: 1. When a row is deleted (op = 'd'), Debezium setsafter = NULLand puts the primary key inbefore! 2. If Silver physically deleted the row (DELETE), replaying an earlier batch would seeNOT MATCHEDand bring the deleted order back to life! Instead, we store a tombstone (_is_deleted = truealongside its_source_position) and filterWHERE NOT _is_deletedin reader views (purging tombstones only after 30 days):MERGE INTO silver.orders AS t USING ( SELECT order_id, customer_id, total_cents, updated_at, _source_position, (op = 'd') AS _is_deleted FROM ( SELECT COALESCE(after.order_id, before.order_id) AS order_id, COALESCE(after.customer_id, before.customer_id) AS customer_id, COALESCE(after.total_cents, before.total_cents) AS total_cents, COALESCE(after.updated_at, before.updated_at) AS updated_at, _source_position, op, ROW_NUMBER() OVER ( PARTITION BY COALESCE(after.order_id, before.order_id) ORDER BY _source_position DESC ) AS rn FROM bronze.orders_cdc WHERE _ingested_at >= :interval_start AND _ingested_at < :interval_end ) latest_per_key WHERE rn = 1 ) AS s ON t.order_id = s.order_id WHEN MATCHED AND s._source_position > t._source_position THEN UPDATE SET -- Preserve last known attributes when a DELETE event only carries primary keys in `before` t.customer_id = COALESCE(s.customer_id, t.customer_id), t.total_cents = COALESCE(s.total_cents, t.total_cents), t.updated_at = COALESCE(s.updated_at, t.updated_at), t._source_position = s._source_position, t._is_deleted = s._is_deleted WHEN NOT MATCHED THEN INSERT (order_id, customer_id, total_cents, updated_at, _source_position, _is_deleted) VALUES (s.order_id, s.customer_id, s.total_cents, s.updated_at, s._source_position, s._is_deleted);- Clickstream deduplication: Silver
MERGEs onevent_idscoped to theoccurred_atpartitions present in the batch (t.occurred_at >= min_batch_date), turning at-least-once delivery into exact per-event rows. - Gold idempotency:
dbtoverwrites affected date partitions (DELETE + INSERTinside one Redshift transaction or IcebergINSERT OVERWRITE), never blindINSERT. - Write-Audit-Publish (WAP) quality gates: Spark writes to an unpublished Iceberg branch (or staging table), runs Great Expectations + dbt tests (primary-key uniqueness, non-null checks, daily order-sum reconciliation against source, and null-rate drift thresholds), and fast-forwards
mainonly if all checks pass. Failures page the table owner while dashboards keep reading the last good snapshot.
- Bronze -> Silver (
Deep dive 2: hybrid on-prem boundary, placement, and unified control
When sensitive databases stay in on-premises data centers, we enforce four architectural rules across the corporate boundary:
1. Data classification drives an automated replication allowlist: - Restricted (raw finance ledgers, regulated customer PII): Never leaves on-premises; transformed into local Iceberg tables on on-prem object storage (MinIO/Ceph) and queried via on-prem Trino. - Confidential (customer IDs/emails needed for cloud analytics): Crosses only after on-premises HMAC/vault tokenization (replacing
devon@example.orgwith deterministic tokentok_4c9e...using a secret key stored strictly in the on-prem HSM — Hardware Security Module) or pre-aggregation. - Internal (product catalog, inventory counts): Replicated as-is on allowlisted topics.ON-PREMISES DATA CENTER | AWS CLOUD -------------------------------------------------------------+------------------------------------------------- Oracle / SQL Server --log CDC--> Debezium (Kafka Connect) | | | v | On-Prem Kafka (3 brokers, 1.5 TB disk, | 4-7 day outage buffer) | | | | restricted topics| | allowlisted | v v | On-Prem Spark: tokenize PII & aggregate --> MirrorMaker 2 ---+--TLS over 1 Gbps Direct Connect--> Amazon MSK | (runs on-prem, | (IPsec Site-to-Site VPN backup) | v dials OUTWARD) | v On-Prem Object Store + Iceberg + Trino | Bronze -> Silver | SMB/NFS Shares --> AWS DataSync Agent (dials OUTWARD) -------+----------------------------------> S3 Landing Airflow Celery Workers [queue="onprem"] (dial OUTWARD) <-----+-- Airflow on EKS (single DAG control plane) OpenTelemetry + Audit Shippers (dial OUTWARD) ---------------+--> Central CloudWatch / Prometheus + SIEM2. Connectivity, outbound-only firewall posture, and outage buffering: - Private link: 1 Gbps AWS Direct Connect (dedicated fiber with consistent latency) backed by automatic BGP failover to an IPsec Site-to-Site VPN over the public internet. Because 1 Gbps Direct Connect is not encrypted at the link layer (MACsec requires 10 Gbps+ ports), every byte uses TLS 1.3 in transit. - Outbound-only connections: Enterprise security teams rarely allow the cloud to open inbound ports into corporate database subnets. Every boundary component—Kafka MirrorMaker 2, DataSync agent, Airflow Celery workers, and log shippers—runs on-premises and opens outbound TLS connections to AWS. - Outage survival: If a fiber cut drops both links for 12 hours, Debezium keeps streaming database logs into on-premises Kafka (4–7 days retention, paired with
>= 7 daysof Oracle archive log / SQL Server CDC retention). When connectivity returns, MirrorMaker 2 resumes from its last committed Kafka offset and drains the ~60 GB backlog in ~20 minutes.3. Compute placement & unified orchestration/security: - Where jobs run: Run PII tokenization, restricted ledger joins, and heavy volume-reducing aggregations (e.g., summarizing 200 GB of raw machine logs into 500 MB) on-premises to obey compliance and save bandwidth; run elastic joins, ML feature generation, and company-wide Gold tables in the cloud. Keep cloud -> on-prem reverse data tiny to avoid cloud egress fees (clouds charge per GB leaving their network). - Single control plane: Because AWS MWAA cannot attach workers inside your data center, Stage 2 runs self-managed Airflow on EKS with the Celery executor. Tasks tagged
queue="onprem"are pulled over TLS by on-prem Celery workers, letting one DAG coordinatetokenize_onprem -> mirror_sync -> merge_cloud_silverwith unified retries and OpenLineage tracking. - Consistent identity & audit: Federate corporate Active Directory via SAML/SCIM to both AWS IAM Identity Center and on-prem Trino; issue short-lived X.509 workload credentials to on-prem servers via AWS IAM Roles Anywhere (zero static IAM access keys on disk!); ship CloudTrail, Lake Formation, Kafka, and database audit logs into one central SIEM (Security Information and Event Management) system.Stage 3: mapping AWS to Azure and design-changing differences
Pipeline stage AWS implementation Azure implementation Portable across both Private hybrid link Direct Connect + Site-to-Site VPN ExpressRoute + VPN Gateway Outbound TLS agents, BGP failover Log-based CDC Debezium on MSK Connect (or DMS) Debezium on AKS / Confluent Cloud Debezium connector configs Event streaming Amazon MSK (Managed Kafka) Event Hubs (Kafka endpoint) or Confluent Kafka clients, Avro/Protobuf schemas Partner SFTP & files AWS Transfer Family -> S3 ADLS Gen2 native SFTP + ADF SHIR Manifest & SHA-256 validation logic Object storage Amazon S3 Azure Data Lake Storage (ADLS) Gen2 Parquet data files Table format & catalog Iceberg + Glue Catalog + Lake Formation Delta Lake + Unity Catalog / Fabric OneLake SQL table schemas & contract.yamlSpark processing Amazon EMR Serverless Azure Databricks or Fabric Spark Containerized PySparkcodeSQL warehouse Amazon Redshift (+ Athena) Databricks SQL or Fabric Warehouse dbt CoreSQL models & testsOrchestration Airflow on EKS (or MWAA cloud-only) Airflow on AKS (or Azure Data Factory) Airflow Python DAGs Identity & secrets IAM, Identity Center, Roles Anywhere, KMS Entra ID, Managed Identities, Azure Arc, Key Vault RBAC role definitions & PKI certs Six differences that genuinely change the architecture (beyond renaming services):
- Table format gravity (Iceberg vs. Delta Lake): AWS native engines center on Iceberg, while Azure's ecosystem (Azure Databricks and Microsoft Fabric OneLake) centers on Delta Lake. If both clouds share tables, standardize on one primary format with automated metadata translation (Apache XTable / Delta UniForm, which writes both Delta and Iceberg metadata manifests over the exact same Parquet files without duplicating data!).
- Hybrid agent ergonomics: Azure Data Factory's Self-Hosted Integration Runtime (SHIR) is a turnkey outbound HTTPS agent installed on-premises that natively pulls from SQL Server, Oracle, and local file shares with zero inbound firewall rules. AWS lacks a single multi-source outbound equivalent (AWS DMS dials inbound into databases), making self-hosted Debezium + MirrorMaker 2 essential on AWS.
- Kafka service semantics: AWS MSK runs real Apache Kafka brokers and hosts Kafka Connect natively. Azure Event Hubs emulates the Kafka protocol over a proprietary broker (supported on Standard/Premium/Dedicated tiers, not Basic), prices capacity in Throughput/Processing Units with strict per-unit ingress caps, and cannot host Kafka Connect plugins—so Debezium runs on AKS (Azure Kubernetes Service) or Confluent Cloud.
- Storage namespace & permissions: ADLS Gen2 (
abfss://) layers a true hierarchical file system with atomic directory renames and POSIX Access Control Lists on top of Blob storage; S3 (s3a://) is a flat key-value object store governed by IAM policies and Lake Formation. Open table formats hide rename differences, but access-control automation must be written per cloud. - Hybrid server identity: Azure's Azure Arc gives on-premises servers native Entra Managed Identities almost identically to Azure VMs, whereas AWS uses certificate-based IAM Roles Anywhere.
- Network egress billing: Azure ExpressRoute offers an Unlimited flat-rate data plan alongside Metered plans, changing cost math if on-premises users query large cloud datasets frequently.
Portability strategy ("stable core, replaceable edges") and local dev parity
Draw a clean architectural boundary between your portable core and provider-specific edges:
- Portable core (~85% of engineering code, moves unchanged): Parquet files + open table formats (Iceberg / Delta UniForm), containerized
PySparkjobs reading paths from config (STORAGE_ROOT),dbt CoreSQL models (avoiding proprietary extensions or isolating them behinddbtmacros), Airflow Python DAGs, Kafka client libraries + Avro/Protobuf schemas, andGreat Expectationssuites. - Replaceable edges (~15%, thin per-cloud adapters): Storage URI schemes and credential providers (
s3a://+ IAM role vs.abfss://+ Entra Managed Identity), Terraform network/IAM/KMS modules, SFTP ingress triggers, anddbtwarehouse connection profiles. - Honest cost of portability: Skipping cloud-only shortcuts (like AWS Firehose or ADF GUI pipelines) means operating Kubernetes-hosted Debezium/Airflow components yourself. Only pay that tax where multi-cloud or on-prem execution actually happens—never write a custom wrapper around IAM or KMS.
Mirroring cloud deployments on a developer laptop and in CI:
docker compose up (runs identically on developer laptops and pull-request CI): - postgres + debezium-connect -> emits real log-based CDC events on schema/row edits - kafka + schema-registry -> enforces BACKWARD/FULL schema checks locally - minio + iceberg-rest-catalog -> local S3-compatible object store for Bronze/Silver - spark-local (prod container) -> runs exact PySpark Bronze -> Silver MERGE jobs - airflow-standalone -> validates DAG parsing, task wiring, and idempotency Note on Azure local storage testing: `Azurite` emulates Azure Blob APIs, NOT ADLS Gen2's hierarchical namespace (`abfss://`). Local unit/integration tests target MinIO + Iceberg, while CI runs a fast smoke test against an ephemeral dev ADLS Gen2 container + dev warehouse schema before prod deploy.- Portable core (~85% of engineering code, moves unchanged): Parquet files + open table formats (Iceberg / Delta UniForm), containerized
Scaling bottlenecks, cost guardrails, failure recovery, and summary
Key bottlenecks & cost controls:
- Small-file explosion from 5-minute streaming commits: Run hourly Iceberg
rewrite_data_filescompaction on streaming Silver tables andexpire_snapshotsafter 7 days so object storage doesn't accumulate orphaned Parquet files and high S3LIST/GETbills. - Storage lifecycle tiering: Transition Bronze files older than 90 days to S3 Standard-IA (or Azure Cool) and after 1 year to S3 Glacier Instant Retrieval—never Glacier Flexible/Deep Archive on active Iceberg tables, because objects in asynchronous archive tiers fail normal
GETreads until manually restored for hours! - Compute & warehouse guardrails: Use Spot/Preemptible capacity for stateless batch Spark workers, auto-suspend BI compute clusters after 5 minutes idle, isolate ad-hoc analyst queries from dashboard queues, and tag every job by
teamandpipelinewith automated daily spend anomaly alerts.
End-to-end failure recovery matrix:
Failure mode Detection & automated recovery CDC connector crash Restarts on Connect cluster and resumes from Kafka-stored log offset; pages if lag > 15 minBreaking source schema change Schema Registry or Silver contract check blocks batch -> quarantines files -> Gold serves last valid snapshot Corrupt partner file _manifest.jsonSHA-256 / row-count mismatch -> routed toquarantine/+ partner alert; zero partial readsWAN link outage (hours) On-prem Kafka buffers days of CDC; dashboards display data_as_ofwatermark; MirrorMaker catches up idempotentlyBuggy transformation deployed Roll back Silver instantly via CALL system.rollback_to_snapshot(...), deploy fix, rerun intervals from immutable BronzeCloud region disaster Cross-region bucket replication preserves Bronze ( RPO ~15 min); rewrite Iceberg metadata prefixes and redeploy via Terraform- Small-file explosion from 5-minute streaming commits: Run hourly Iceberg
Intuition & how it works
Think of this hybrid data platform like a city water-treatment system connected to a hospital that has strict privacy rules. Raw water from many sources—rivers, rain trucks, and partner pipes—first pours untouched into a raw holding reservoir (Bronze layer) so you always keep an exact historical backup if a filter malfunctions later. Next, treatment tanks remove debris, deduplicate repeated deliveries, and scrub sensitive chemicals into clean storage tanks (Silver layer), before bottling lines package tailored jugs for homes, cafés, and labs (Gold layer). Across town, the hospital (on-premises data center) is legally barred from sending raw patient waste over city pipes, so it runs a compact local filter and holding tank (on-premises Debezium, Kafka, and Spark) inside its own basement—masking patient identities before pumping clean water outward over a private pipe (Direct Connect / ExpressRoute) to the central cloud plant.
Why do naive designs fail? Running analytical SQL directly against live order databases slows down customer checkouts and silently misses deleted rows or historical changes. Streaming every source 24/7 burns cloud budget on sources that finance teams only read once each morning, while retrying failed batch jobs with plain INSERT statements duplicates rows every time a job restarts. And in a hybrid setup, opening inbound firewall holes from the cloud into corporate database networks gets rejected by security teams—and without a multi-day local buffer on-premises, a 12-hour fiber cut overflows database logs and loses changes permanently.
Trace a single order (order_id = 8420) through a normal edit, a 12-hour network outage, and recovery:
1. Live change on-premises (07:55):
Customer places order #8420 ($120) in on-prem SQL Server, using email "devon@example.org".
Debezium reads the transaction log (LSN 4100, op="c") without scanning the live table,
and on-prem Spark replaces the email with token "tok_4c9e" before queueing in local Kafka.
2. Hybrid link goes down (08:00 .. 20:00):
At 11:30, order #8420 updates to $145 (LSN 4155, op="u").
At 16:15, customer cancels and the app deletes order #8420 (LSN 4190, op="d", after=NULL).
Direct Connect & VPN are both down -> local Kafka safely buffers all changes on its 1.5 TB disk;
cloud dashboards show "data_as_of = 07:59" rather than silently serving incomplete hours.
3. Catch-up & at-least-once replay (20:01):
Link recovers -> MirrorMaker 2 dials outward over TLS and drains the 12-hour backlog in ~20 min,
delivering LSN 4155 twice due to a retry, followed by LSN 4190.
4. Idempotent Silver MERGE (20:25):
Spark deduplicates by order_id keeping highest _source_position (LSN 4190, op="d"),
extracts order_id=8420 via COALESCE(after.order_id, before.order_id), and writes a tombstone
(_is_deleted=true, _source_position=4190). Even if an older retry (LSN 4155) arrives later,
4155 < 4190 is ignored, so the canceled order never comes back to life!
Key trade-offs
- Streaming vs. micro-batch per source. Continuous streaming achieves <= 5-minute freshness for fraud and inventory views, but requires 24/7 compute, small-file compaction (merging small Parquet files into ~256–512 MB files), and stateful monitoring. Limiting streaming to the two sources that actually have a 5-minute consumer—and running hourly/daily batches for everything else—cuts cost and operational complexity sharply.
- Managed cloud services vs. self-hosted open-source engines. Managed infrastructure (Amazon MSK, EMR Serverless, Transfer Family) eliminates OS patching and broker hardware replacement, while open engines (Debezium, Spark, dbt Core, Apache Airflow on Kubernetes) cost engineering time to run yet behave identically on-premises, on AWS, and on Azure. Using managed infrastructure at the edges and open engines for data formats and logic balances both.
- Lakehouse (Iceberg / Delta on object storage) vs. single-warehouse ELT. Loading everything straight into one cloud warehouse is simpler below ~50 GB/day, whereas an open table format (Apache Iceberg or Delta Lake, adding atomic snapshots and SQL
MERGEover cheap S3 / ADLS Parquet files) lets Spark, BI warehouses, and ML notebooks share a single copy of 130+ TB without vendor storage lock-in. - Apache Iceberg vs. Delta Lake across AWS and Azure. AWS analytics services integrate natively with Iceberg, while Azure Databricks and Microsoft Fabric center on Delta Lake. Rather than maintaining two copies of Parquet data, picking one primary table format and enabling Delta UniForm / Apache XTable (which generates lightweight metadata manifests for both formats over the same Parquet files) preserves native speed on both clouds.
- Log-based CDC vs. timestamp SQL polling. Log-based CDC (reading internal database redo/transaction logs via Debezium) captures hard deletes and adds negligible load to transactional databases, at the cost of managing log retention and Kafka Connect workers; timestamp queries (
WHERE updated_at > ?) are trivial to write but miss hard deletes and scan production indexes. - On-premises compute vs. cloud compute. Running PII tokenization (replacing sensitive identifiers with keyed tokens) and high-reduction aggregations on-premises keeps restricted fields inside the building and slashes WAN traffic, trading off against fixed on-premises hardware capacity; elastic joins and company-wide marts run in the cloud.
- Single hybrid Airflow control plane vs. separate orchestrators. Self-hosting Airflow on Kubernetes (EKS/AKS) with outbound on-premises Celery workers gives one end-to-end dependency graph and unified backfills, at the cost of operating Airflow yourself (managed MWAA cannot attach on-premises workers) and pausing on-prem batch tasks during WAN outages.
Common mistakes
- Defaulting every pipeline to real-time streaming when downstream finance or BI consumers only check dashboards once an hour or once a day.
- Listing cloud service names without defending why, or omitting a concrete alternative and the scale/constraint threshold that would flip the choice.
- Extracting database changes with
WHERE updated_at > last_run, silently dropping hardDELETEoperations and stressing live OLTP tables. - Using blind
INSERTon batch retries, duplicating an entire hour of data whenever an Airflow task fails halfway and reruns. - Reading
after.order_idblindly on CDC events or physically deleting Silver rows onDELETE, which crashes or yieldsNULLkeys whenafteris null on deletes, and resurrects deleted records if an older batch is replayed (always useCOALESCE(after.key, before.key)and_is_deletedtombstones guarded by_source_position). - Partitioning events by ingestion timestamp instead of
occurred_at, misplacing late mobile events into the wrong business day, or over-partitioning into millions of tiny files. - Publishing untransformed or unchecked tables straight to BI, instead of running Write-Audit-Publish quality checks before exposing a new snapshot.
- Opening inbound firewall rules from the cloud into on-premises databases, or assuming a 1 Gbps Direct Connect / ExpressRoute circuit encrypts traffic automatically without TLS.
- Archive-tiering active Iceberg tables into asynchronous cold storage (like S3 Glacier Deep Archive), causing table scans and replays to fail because objects cannot be fetched via standard
GETrequests without a multi-hour restore.
Follow-up questions
- Suppose an unannounced column modification hits an on-premises database table. How does your ingestion layer catch the drift, and how are downstream analytical tables shielded? Debezium embeds the source table schema in every change event and validates updates against the Schema Registry: narrowing a column type fails compatibility immediately and pauses that connector with an alert, while additive nullable columns pass safely into Bronze (a metadata-only column-ID update in Iceberg) and stay hidden from Silver/Gold until an engineer updates
contract.yaml. Because Debezium treats nullable columns as optional, a dropped or renamed column can passBACKWARDregistry checks as nulls, so our Bronze-to-Silver contract validator catches the missing required column, quarantines that batch, pages the owner, and leaves Gold serving its last known-good snapshot flagged with a stale-data banner. A nightly catalog diff againstINFORMATION_SCHEMA/ALL_TAB_COLUMNSalso catches silent drift on low-traffic tables (and catches SQL Server's quirk where existing CDC capture instances ignore newly added columns until recreated). - If private connectivity between the corporate data center and the cloud drops for half a day, how do dashboards behave during the outage and how does replay avoid duplicate rows afterward? While the private link and VPN backup are both down, Debezium continues reading Oracle/SQL Server transaction logs into the on-premises Kafka cluster (sized with 1.5 TB of disk for 4–7 days of retention, matched by
>= 7 daysof source database log retention), so zero changes are lost. Cloud dashboards reading on-premises entities display an explicitdata_as_ofwatermark timestamp, and Airflow watermark sensors hold dependent hourly Gold runs rather than publishing partial hours as complete. Once connectivity returns, MirrorMaker 2 dials outward from its last committed offset and drains a 12-hour (~60 GB) backlog in ~20 minutes at 50 MB/s; even though replication is at-least-once and sends some records twice, SilverMERGEs by primary key withs._source_position > t._source_position(and deduplicates events byevent_id), making duplicate deliveries complete no-ops. - Six weeks after cutover, monthly cloud infrastructure spend has surged to twice the projected budget. How do you triage and remediate the cost drivers? Break down daily spend by cloud service and
pipeline/teamcost tags first to isolate the spike, then audit the four classic culprits: network egress & routing (dashboards or reverse-ETL shipping large datasets back on-premises, cross-AZ Kafka broker-to-consumer traffic, or S3/ADLS traffic hair-pinning through paid NAT Gateways instead of free Gateway VPC Endpoints), idle or over-provisioned compute (24/7 streaming clusters on daily data, warehouses without auto-suspend, un-rightsized dev environments), storage & query waste (pay-per-TB engines scanning unpartitioned tables, uncompacted small files spiking S3 request fees, or un-expired Iceberg snapshots retaining deleted Parquet files forever), and verbose debug logging ingested into CloudWatch / Log Analytics. Put automated per-team budget alerts in place so future regressions trigger pages within 24 hours instead of at month's end. - Product analytics adds a new attribute and needs 24 months of historical tables populated without delaying live hourly or daily schedules. How do you execute that backfill? First execute
ALTER TABLE ... ADD COLUMNon Silver and Gold (an instant metadata-only operation in Iceberg where historical rows read asNULL) and deploy the updated daily pipeline so all new intervals populate the column going forward. Next, source the 2-year history—recomputing directly from immutable Bronze if the raw JSON/CDC payload already captured the field, or running throttled off-peak key-range extracts from the source DB if it did not. Execute the backfill on a separate Airflow DAG using a dedicated worker pool and isolated Spot EMR Serverless compute, processing 1-month chunks (24 chunks total) through staging validation checks before committing. For date-partitioned tables, overwriting historical partitions (< deploy_date) never touches today's active partition; for unpartitioned current-state tables, run batchedMERGEupdates affecting only that column, relying on Iceberg's optimistic concurrency control to automatically retry any chunk that collides with a live hourly run.
Follow-up questions
- Suppose an unannounced column modification hits an on-premises database table. How does your ingestion layer catch the drift, and how are downstream analytical tables shielded?
- If private connectivity between the corporate data center and the cloud drops for half a day, how do dashboards behave during the outage and how does replay avoid duplicate rows afterward?
- Six weeks after cutover, monthly cloud infrastructure spend has surged to twice the projected budget. How do you triage and remediate the cost drivers?
- Product analytics adds a new attribute and needs 24 months of historical tables populated without delaying live hourly or daily schedules. How do you execute that backfill?
Similar questions
- Architect a Billion-Event Telemetry Ingestion and Analytics Pipeline
- Flash-Sale Virtual Waiting Room and Inventory Engine
- Browser Shopping Cart and Remote Config Architecture
- Architect a Worldwide Multi-Title Competitive Ranking Service
- Architect a Real-Time Microblogging Feed Service
- Broad Software Engineering Behavioral Screen
More Disney interview questions
- Onsite Behavioral Loop: Disagreements, Coaching, Triage, and Motivation Easy
- Aligning Cross-Team Product Decisions Without Formal Authority Hard
- Browser Shopping Cart and Remote Config Architecture Easy Pro
- Causal Triage of a Post-Launch Viewing Drop Hard Pro
- Linking Your Standout Engineering Work to the Target Role Medium Pro
- Cross-Functional Alignment and Lead Frontend Influence Easy Pro
- Mentoring Through a Frontend Pull Request Review Easy Pro
- Dynamic Array-Backed Integer Hash Set Medium Pro
- Using LLMs Safely for Language Migration and Data Cleansing Easy Pro
- Concurrent Timed and Size-Bounded Batch Writer Medium Pro