The same on AWS and Google Cloud
Part of the free LogicWiz Data Engineering course, Module 14: Cloud data platforms. The SQL and Python run in the app, on real Postgres and real Python in the browser.
It is 4:40 on Friday. The group's AWS team has shared its lake, and Tess asks it one question: which orders were placed on 3 June? The answer comes back with a line under it. Data scanned: 3 TB. Cost: $15, for one day of orders. Nora shrugs: "Same pipeline as ours, different names. Find out why it read everything."
You'll learn to
- Map each Azure service to its AWS and Google Cloud twin
- Estimate the bytes a query scans, and cut them
- Explain how Spark writes safely to S3 without renames
- Size Glue, Athena and Kinesis in their own units
Learn
Same pipeline, different names
Nora's hint is the whole lesson. The pipeline you drew on Azure exists on every cloud: storage, a copy tool, Spark, a warehouse, a scheduler, a place for secrets. Each piece has a twin on AWS and on Google Cloud.
So learn the job first and the service name second. Answer interviews the same way: "land raw files in object storage (S3), catalogue them (Glue Data Catalog), transform with Spark (Databricks or EMR), serve from a warehouse (Redshift), orchestrate with Airflow (MWAA)". Interviewers do not mind which cloud you learned on.
The table has the twins. Read it one row at a time.
The mapping
| Job | Azure | AWS | Google Cloud |
|---|---|---|---|
| Object storage, the lake | ADLS Gen2 | S3 | Cloud Storage |
| Copy data in on a schedule | Data Factory | Glue jobs; DMS for databases | Datastream for databases; Data Fusion |
| Managed Airflow | Apache Airflow jobs in Fabric | MWAA | Cloud Composer |
| Spark | Azure Databricks, Fabric | EMR, Glue, Databricks | Dataproc, Databricks |
| Warehouse | Fabric Warehouse, Synapse | Redshift | BigQuery |
| SQL on lake files, pay per scan | Synapse serverless SQL | Athena | BigQuery external tables |
| Event streams | Event Hubs | Kinesis, MSK | Pub/Sub |
| Catalogue and permissions | Unity Catalog, Purview | Glue Data Catalog, Lake Formation | Dataplex |
| Secrets | Key Vault | Secrets Manager | Secret Manager |
| Identity for programs | Managed identity | IAM role | Service account |
Databricks and Snowflake run on all three clouds, so much of a modern stack moves across unchanged.
AWS: the lake is the hub
Start with AWS, where Tess's query ran. The lake is S3, and everything hangs off it.
Glue is three things: a Data Catalog of table definitions, crawlers that infer them from files, and serverless Spark jobs. Athena runs SQL straight on S3 files and charges by the bytes it scans. Redshift is the warehouse (also as Redshift Serverless). EMR runs Spark clusters you configure. Kinesis and MSK (managed Kafka) carry streams, and MWAA is managed Airflow. Lake Formation adds table and column permissions on top of the Glue catalog.
Identity is IAM, and jobs run as roles, not as users.
SwiftKart on AWS
A graph from the shop database through DMS and from the app through Kinesis into S3 bronze, Spark on EMR or Glue merging into Iceberg or Delta tables, served by Athena and Redshift, with the Glue Data Catalog holding the table definitions.
Read it left to right: everything lands on S3 and is read from S3. MWAA (managed Airflow) or Step Functions runs the schedule; Secrets Manager holds the database password.
Files in S3 with the aws CLI
Runs in the cloud:
aws s3 cp orders.csv s3://swiftkart-lake/bronze/orders/2025-06-08.csv
aws s3 ls s3://swiftkart-lake/bronze/
aws s3 ls s3://swiftkart-lake/bronze/orders/
upload: ./orders.csv to s3://swiftkart-lake/bronze/orders/2025-06-08.csv
PRE orders/
PRE payments/
2025-06-08 06:00:12 412 2025-06-01.csv
2025-06-08 06:00:12 530 2025-06-02.csv
2025-06-08 06:01:03 388 2025-06-08.csv
PRE marks a prefix, the closest thing S3 has to a folder (Lesson 14.1). Each object line shows its upload time, size in bytes, and the rest of its key.
Google Cloud: the warehouse is the hub
On Google Cloud the lake is Cloud Storage (gs:// buckets), but the centre of gravity is BigQuery: a serverless warehouse with no servers to size, billed by bytes scanned or by reserved capacity.
Around it: Dataflow runs Apache Beam pipelines, batch or streaming. Dataproc runs Spark clusters. Pub/Sub carries events. Cloud Composer is managed Airflow. Dataform runs SQL transformations in the spirit of dbt, and Dataplex catalogues and governs. Programs act as service accounts.
Compare the picture below with the AWS one. There, files on S3 were the hub. Here most arrows end in BigQuery, and Spark on Dataproc is used where SQL is not enough.
SwiftKart on Google Cloud
A graph from the shop database through Datastream and from the app through Pub/Sub and Dataflow into BigQuery, with raw files loaded from Cloud Storage, then SQL models in Dataform building marts read by Looker.
Read it left to right: three ways in, one warehouse. Cloud Composer (managed Airflow) runs the schedule.
Why one day cost $15
Back to Tess's $15. Athena, BigQuery's on-demand pricing and Synapse serverless SQL all bill by the data a query reads: not by how long it runs, not by how many rows come back. So the layout of your files is your bill.
- CSV and JSON are read whole: every byte of every column.
- Parquet is columnar: a query reads only the columns it names, compressed.
- Partitions (folders such as
order_date=2025-06-03/) let the engine skip whole files when the query filters on the partition column.
The group's order history is CSV. That is why one day cost as much as all of them. The same question can cost a hundred times less, only because of how the data is stored.
One question, three layouts
The orders table drawn as days and columns: as CSV every column of every day is read, as one Parquet file only two columns of every day, and as Parquet partitioned by day only two columns of 3 June.
CSV, one file. To find the orders of 3 June the engine reads every byte: all six columns of all 14 days. That is 4,910 bytes on this small table, and 3 TB on the real one.
Parquet, one file. Parquet stores each column apart, compressed. The query names two columns, so only
order_idandstatusare read, for all 14 days: 554 bytes.Parquet, one folder per day. The filter is on the partition column, so the engine opens only the folder
order_date=2025-06-03/, and only two columns in it: 128 bytes.
Red is what the engine reads and bills. Almost 40 times less, on a tiny table: on a real one, with years of days and dozens of columns, the gap is often thousands of times, and so is the bill.
Remember: on a pay-per-scan engine the file layout is the bill. Columnar files, partitions on the filter column, and only the columns you need.
Measure the three layouts yourself
import os
import duckdb
duckdb.sql("""
COPY (SELECT *, CAST(order_ts AS DATE) AS order_date FROM 'data/orders.csv')
TO 'orders_by_day' (FORMAT PARQUET, PARTITION_BY (order_date))
""")
duckdb.sql("COPY (SELECT * FROM 'data/orders.csv') TO 'orders.parquet' (FORMAT PARQUET)")
def parquet_bytes(pattern, columns):
"""Compressed bytes of the named columns in the files matching pattern."""
names = ', '.join(repr(c) for c in columns)
return duckdb.sql(f"""
SELECT COALESCE(SUM(total_compressed_size), 0)
FROM parquet_metadata('{pattern}')
WHERE path_in_schema IN ({names})
""").fetchone()[0]
# The question: which orders were placed on 3 June, and their status?
cols = ['order_id', 'status']
print('CSV, whole file: ', os.path.getsize('data/orders.csv'), 'bytes')
print('Parquet, two columns: ', parquet_bytes('orders.parquet', cols), 'bytes')
print('Parquet, one partition: ', parquet_bytes('orders_by_day/order_date=2025-06-03/*.parquet', cols), 'bytes')
parquet_metadata reads the footer of each file: per column chunk, its compressed size and its min and max. Engines like Athena and BigQuery use the same information to decide what to read.
Turn bytes into dollars
MB = 1024 ** 2
def billed_mb(bytes_scanned, minimum_mb=10):
"""Pay-per-scan engines round up to a whole MB, with a 10 MB minimum per query."""
return max(minimum_mb, -(-bytes_scanned // MB))
TB = 1024 ** 4
PRICE_PER_TB = 5.00 # Athena in us-east-1; BigQuery on demand is $6.25 per TiB in the US
for label, scanned in [('tiny lookup', 4_910), ('one month of Parquet', 900 * MB), ('full CSV history', 3 * TB)]:
mb = billed_mb(scanned)
print(f'{label:22} billed {mb:>9} MB ${mb * MB / TB * PRICE_PER_TB:.6f}')
The last line is Tess's query: 3 TB of CSV, $15. Athena rounds up to the MB with a 10 MB minimum per query; BigQuery bills at least 10 MB per table referenced and per query. Thousands of tiny queries are not free either.
Ask BigQuery before you pay: a dry run
Runs in the cloud:
bq query --use_legacy_sql=false --dry_run \
'SELECT order_id, status FROM swiftkart.orders WHERE order_date = "2025-06-03"'
Query successfully validated. Assuming the tables are not modified, running this query will process 1532 bytes of data.
A dry run costs nothing and reports the bytes the query would scan. The BigQuery console shows the same estimate before you press Run.
A function hides the partition
Partitions only help when the engine can tell, from the query alone, which folders to skip. Skipping them is called partition pruning.
Postgres can show you. The table orders_by_day below is split into 14 partitions, one per day (the setup builds them). Filter on order_date itself and the plan scans one partition. Wrap the column in a function and the planner can no longer see a date range, so it scans all 14.
Pay-per-scan engines behave the same way, and they bill you for every partition they open.
Watch Postgres skip 13 partitions
EXPLAIN (COSTS OFF)
SELECT order_id, status
FROM orders_by_day
WHERE order_date = DATE '2025-06-03';
The plan scans only orders_d03. Change the filter to EXTRACT(DAY FROM order_date) = 3 and run again: every partition appears.
Filter on the partition column itself, as stored. WHERE order_date = DATE '2025-06-03' skips 13 of 14 partitions. WHERE EXTRACT(DAY FROM order_date) = 3 asks nearly the same question, but wraps the column in a function, and many engines can no longer prune: they read everything and bill you for it. And SELECT * on a pay-per-scan engine reads every column, even if you look at two.
Partitions skipped by a filter
Order files stored in one folder per day; setting a date filter greys out the folders the query can skip, showing how few files it reads.
Set a date filter and watch the folders the query can skip turn grey.
Writing to a store with no rename
Reading is priced. Writing has its own trap, from Lesson 14.1: S3 has no rename. Three facts decide how Spark writes there.
- Consistency. S3 reads and listings are strongly consistent right after a write, so the old workarounds are no longer needed.
- No rename. A rename is a copy plus a delete per object, so the rename-based
FileOutputCommitteris slow and unsafe here (Lesson 11.5). EMR's EMRFS S3-optimized committer and Hadoop's S3A committers avoid renames: each task uploads its files as multipart uploads that are not visible yet, and job commit completes them. - Conditional writes. A PUT with
If-None-Matchfails if the key already exists. That is put-if-absent, what a table format needs to make a commit file atomic without a separate lock service.
The S3A magic committer: written once, never renamed
A sequence between a task, S3 and the driver: the task starts a multipart upload to the final key and uploads parts that are not yet visible, commits by recording the pending upload, and the driver completes every upload at job commit so the objects appear.
Read it top to bottom: no copy and no rename, each byte is written once. If the job dies before job commit, nothing becomes visible, and the pending uploads are aborted; an S3 lifecycle rule that aborts incomplete multipart uploads cleans up what a crash leaves.
Three meters: DPUs, terabytes, shards
One more thing differs: the unit on the bill. Each AWS analytics service meters its own, and sizing starts from it.
- Glue jobs run on DPUs. One DPU is 4 vCPU and 16 GB of memory, at $0.44 per DPU-hour.
- Athena charges per TB scanned. With hundreds of thousands of partitions, planning can take longer than scanning, because Athena first asks the Glue Data Catalog for every matching partition. Partition projection computes partition values and locations from table properties instead, with no catalog lookups.
- Kinesis Data Streams in provisioned mode is sized in shards. Each takes up to 1 MB or 1,000 records per second in. You need enough shards for whichever limit you hit first, and one hot partition key still lands on one shard.
Price a Glue job, size a stream
import math
def glue_cost(dpus, seconds, per_dpu_hour=0.44):
return round(dpus * max(60, seconds) / 3600 * per_dpu_hour, 2)
def kinesis_shards(events_per_s, bytes_per_event):
by_bytes = math.ceil(events_per_s * bytes_per_event / 1_000_000) # 1 MB per second per shard
by_records = math.ceil(events_per_s / 1000) # 1,000 records per second per shard
return max(by_bytes, by_records)
print('Glue, 10 DPUs for 14 minutes: $', glue_cost(10, 14 * 60))
print('Glue, 2 DPUs for 20 seconds: $', glue_cost(2, 20))
print('Shards for 12,000 events/s of 1,500 bytes:', kinesis_shards(12_000, 1_500))
print('Shards for 4,000 events/s of 600 bytes:', kinesis_shards(4_000, 600))
The 20-second Glue job pays for a full minute. The first stream is bound by bytes (18 MB/s, 18 shards), the second by records (4,000 per second, 4 shards, though it moves only 2.4 MB/s). Megabytes here are 10^6 bytes; check how your provider counts before you size a production stream.
Numbers to remember
| What | The number |
|---|---|
| Athena | $5.00 per TB scanned in us-east-1; rounded up to the MB, 10 MB minimum per query |
| BigQuery on demand | $6.25 per TiB in the US; at least 10 MB per table referenced and per query |
| Glue DPU | 4 vCPU and 16 GB; $0.44 per DPU-hour, billed per second with a 1-minute minimum on Glue 2.0 and later |
| Kinesis shard | provisioned mode: up to 1 MB or 1,000 records a second in, up to 2 MB a second out |
| S3 strong consistency | since December 2020; EMRFS consistent view and S3Guard are no longer needed |
| EMRFS S3-optimized committer | from EMR 5.19.0, the default since 5.20.0 |
| If-None-Match on an S3 PUT | since August 2024 |
What changed at SwiftKart
The AWS team rewrites the order history as Parquet, one folder per order_date. Tess runs her question again. Athena reads megabytes instead of 3 TB, and the query costs a fraction of a cent.
That is also the answer to "how would you cut the Athena bill?": Parquet, partitions on the column people filter by, only the columns you need, and small files compacted.
And Nora has her drawing three times over: the same boxes on Azure, AWS and Google Cloud, with different names in them.
Next, Lesson 14.4 opens the warehouses those bills come from, Snowflake and BigQuery, where storage is billed apart from compute.
In one line
Every Azure service has a twin on AWS and Google Cloud, and on pay-per-scan engines the file layout is the bill: Parquet, partitions on the filter column, and only the columns you need.
Interview corner
How would you build a batch pipeline on AWS?
Raw files land in S3 (bronze), with Glue Data Catalog for table definitions and Lake Formation for permissions. Spark jobs on Databricks, EMR or Glue clean and model the data into Parquet or Delta/Iceberg tables. Redshift or Athena serves it, MWAA (Airflow) or Step Functions orchestrates, IAM roles give each job least privilege, and Secrets Manager holds credentials.
How do you reduce the cost of Athena or BigQuery queries?
They bill by bytes scanned, so: store columnar Parquet, compressed; partition by the column queries filter on (usually date) and filter on it directly; cluster or sort by other common filters; select only needed columns, never SELECT *; compact small files; and use dry runs, maximum-bytes limits and workgroup or project quotas as guard rails.
What is the GCP equivalent of Azure Data Factory and of Databricks?
For ingestion, Datastream for database change capture, Data Fusion for visual pipelines and the BigQuery Data Transfer Service for SaaS sources; orchestration is Cloud Composer (Airflow). For Spark there is Dataproc, and Databricks itself also runs on Google Cloud. Many GCP teams do most transformation in BigQuery SQL with Dataform or dbt.
Why did Spark on S3 need special committers, and what changed in 2020 and 2024?
Hadoop's FileOutputCommitter commits by renaming task output into place, and on S3 a rename is a copy plus a delete per object, so job commit was slow and a failure left partial output; before December 2020 listings could also miss new files. The EMRFS S3-optimized committer and the S3A committers write each file once as a multipart upload and only complete the uploads at job commit, so nothing is copied and nothing is visible early. Since December 2020 S3 is strongly consistent for reads and listings, which retired the consistency workarounds, and since August 2024 conditional writes with If-None-Match give a put-if-absent that table formats can use for atomic commit files.