3.4 Million NYC Taxi Trips, Zero Servers: Building an Iceberg Lakehouse on AWS

3.4 Million NYC Taxi Trips, Zero Servers: Building an Iceberg Lakehouse on AWS

Build a fully serverless data lakehouse on AWS with Amazon S3 Tables, Apache Iceberg, the AWS Glue Data Catalog and Amazon Athena, using 3.4 million real NYC taxi trips. Clean, correct, evolve and time-travel your data with nothing but SQL, for under a dollar.

Figure 1

Ever dropped some CSV and Parquet files into S3, called it a “data lake”, then got stuck the first time someone asked you to fix a bad record, add a column, or show what the data looked like last week?
That gap between a folder of files and a table you can actually manage is exactly what a data lakehouse fills. In this post, I’ll guide you through building a fully serverless lakehouse on AWS using Amazon S3 Tables (managed Apache Iceberg tables), the AWS Glue Data Catalog and Amazon Athena, with a real public dataset: the NYC Taxi & Limousine Commission (TLC) Yellow Taxi trip records for January 2025, about 3.5 million trips. No clusters, no servers, no Spark code. Everything is done from the AWS Management Console with plain SQL.
By the end of this guide, you’ll have:
  1. A raw zone in S3 with the TLC Parquet file and the taxi zone lookup CSV.
  1. Raw tables in the Glue Data Catalog, registered with Athena DDL.
  1. An Athena workgroup with a per-query scan limit, so a careless query can’t run up your bill.
  1. An S3 table bucket with namespace  taxi  and an Iceberg table  trips  partitioned by day.
  1. Hands-on DELETE, UPDATE, MERGE, schema evolution and time travel.
  1. An optional EventBridge Scheduler monthly load and Lake Formation permissions.
  1. Cost estimate, cleanup checklist and troubleshooting table.
Every sample output comes from the real January 2025 file; the raw row count, first zone row, top four pickup zones and 22 out-of-month rows were also confirmed in Athena in my account.
Figure 2


Understanding the Building Blocks

  • Data lakehouse: data stays in low-cost object storage but gains warehouse features: schemas, ACID transactions, row-level updates/deletes and consistent reads. One copy in open formats, queryable by many engines (Athena, Redshift, EMR, Spark).
  • Apache Iceberg: an open table format that tracks a table's Parquet files through metadata, manifests and snapshots. Every write creates a snapshot, enabling time travel, safe concurrent writes and schema changes without rewriting the table.
  • Amazon S3 Tables: S3 storage built for tabular data. Tables live in namespaces inside a table bucket, every table is Iceberg, and AWS runs compaction, snapshot management and unreferenced file removal for you. Tables are first-class resources with their own ARNs and IAM actions ( s3tables:* ), encrypted by default with SSE-S3, and one click adds them to the Glue Data Catalog under  s3tablescatalog  for Athena, Redshift, EMR and others.
  • AWS Glue Data Catalog: the central metadata store for both our raw tables and the S3 Tables catalog. Amazon Athena: serverless SQL, priced per data scanned.
Why a lakehouse, not just files in S3? Data quality issues are real: in the January 2025 file, 90,893 trips have a distance of 0 and 488,166 rows (after removing those) have no  store_and_fwd_flag . Schemas change: the TLC added  cbd_congestion_fee  in 2025 when congestion pricing started. And auditing needs history. With plain Parquet folders, every fix means rewriting files by hand; with Iceberg it's SQL, raw and curated data stay separate, and every change is a queryable snapshot.
Why S3 Tables + Glue + Athena? Fully serverless, managed Iceberg maintenance (the part most teams forget until queries slow down), pay-per-use pricing that costs cents here, and open formats with no engine lock-in.

Prerequisites

  1. An AWS account with permissions for S3, S3 Tables, Glue, Athena, IAM and optionally EventBridge Scheduler and Lake Formation. I used an admin IAM user,  blog-builder , in a sandbox account; scope this down for production. Enabling the S3 Tables integration needs  glue:CreateCatalog  and  glue:PassConnection .
  1. Region US East (N. Virginia) us-east-1 for everything.
  1. The two public NYC TLC files (Step 1) and basic SQL; every query is provided.

Overview of Steps

Download the data (1) → raw bucket (2) → Glue database (3) → Athena workgroup with a scan limit (4) → register raw tables (5) → check (6) and explore (7) raw data → S3 table bucket with analytics integration (8) → namespace, Iceberg table and January load (9) → DELETE, UPDATE, time travel, ADD COLUMNS and MERGE (10) → optional monthly schedule (11) → Lake Formation grants, required when the integration is Enabled with Lake Formation (12) → verify (13).
Now, let's get started!

Step 1: Download the NYC TLC Data Files

From the  NYC TLC Trip Record Data page , download:
Figure 3

Note: The trip file has 20 columns and 3,475,226 rows. The zone lookup has 265 rows mapping a LocationID to a borough and zone, e.g.  1, EWR, Newark Airport  and  132, Queens, JFK Airport .

Step 2: Create the Raw S3 Bucket and Upload the Files

  1. In Amazon S3 (Region US East (N. Virginia)), choose General purpose buckets → “Create bucket”.
  1. Name it  nyc-taxi-raw-ajay-20261104  (names are global; add your own suffix). Keep “Block all public access” and SSE-S3, and create it.
Figure 4

  1. Create a  raw  folder with two subfolders,  yellow  and  zones , then upload the Parquet file to  raw/yellow/  and the CSV to  raw/zones/ .
Figure 5

Figure 6

Note: Each dataset needs its own folder: an Athena table points to a folder, so mixing the files would break both tables.

Step 3: Create the Glue Database

In AWS Glue → Data Catalog → Databases, click “Add database”, enter  nyc_taxi_raw , and create it.
Figure 7

It holds only metadata; the data stays in S3.

Step 4: Create the Athena Workgroup with a Data Scanned Limit

A workgroup isolates this project’s queries, results and cost controls.
  1. In Amazon Athena, choose Workgroups → “Create workgroup” and name it  lakehouse-wg .
  1. Keep Athena SQL and automatic engine updates (engine version 3).
  1. Under “Query result configuration”, choose Customer managed:  s3://nyc-taxi-raw-ajay-20261104/athena-results/ .
  1. Leave result encryption off or SSE-S3 (not SSE-KMS or CSE-KMS). Optionally publish query metrics to CloudWatch. Click “Create workgroup”.
Figure 8

  1. Open  lakehouse-wg  → “Execution controls” → “Edit controls”, set “Data scanned limit” to  1  GB, and save.
Figure 9

Note: Athena cancels any query here that scans over 1 GB; the whole raw file is only ~59 MB. Also, Athena rejects INSERT, UPDATE, DELETE and MERGE on S3 Tables in a workgroup that encrypts results with SSE-KMS/CSE-KMS or has Requester Pays enabled, which is why we keep SSE-S3.

Step 5: Register the Raw Files with Athena DDL

We’ll register both raw files in the Glue Data Catalog ourselves with two  CREATE EXTERNAL TABLE  statements.
In the Query editor, select workgroup lakehouse-wg, data source  AwsDataCatalog , catalog None, database  nyc_taxi_raw .
Figure 10

Run these one at a time (they’re in  sql/00_create_raw_tables.sql ). This registers the yellow taxi Parquet folder as  yellow :
CREATE EXTERNAL TABLE IF NOT EXISTS nyc_taxi_raw.yellow (
vendorid int,
tpep_pickup_datetime timestamp,
tpep_dropoff_datetime timestamp,
passenger_count bigint,
trip_distance double,
ratecodeid bigint,
store_and_fwd_flag string,
pulocationid int,
dolocationid int,
payment_type bigint,
fare_amount double,
extra double,
mta_tax double,
tip_amount double,
tolls_amount double,
improvement_surcharge double,
total_amount double,
congestion_surcharge double,
airport_fee double,
cbd_congestion_fee double
)
STORED AS PARQUET
LOCATION 's3://nyc-taxi-raw-ajay-20261104/raw/yellow/';
This registers the zone lookup CSV as  zones :
CREATE EXTERNAL TABLE IF NOT EXISTS nyc_taxi_raw.zones (
locationid string,
borough string,
zone string,
service_zone string
)
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES ('separatorChar' = ',', 'quoteChar' = '"')
STORED AS TEXTFILE
LOCATION 's3://nyc-taxi-raw-ajay-20261104/raw/zones/'
TBLPROPERTIES ('skip.header.line.count' = '1');
A few things to notice:
  • LOCATION is a folder, so files added to  raw/yellow/  later join the table.
  • Lowercase names: Athena matches Parquet columns case-insensitively ( VendorID  →  vendorid ,  PULocationID  →  pulocationid ).
  • OpenCSVSerDe strips the quotes ( "1","EWR",... ) but reads every column as a string, hence  CAST(z.locationid AS integer)  in joins.
  •  skip.header.line.count  drops the header row.
Figure 11

Both now appear as regular tables in AWS Glue → Tables.
Figure 12

Note: A Glue crawler can infer the schema instead when you don’t know it up front.

Step 6: Check the Raw Tables

Run these one at a time ( sql/01_raw_checks.sql ):
SELECT COUNT(*) AS trip_count
FROM nyc_taxi_raw.yellow;
Result in my account: 3,475,226, the full row count of the file.
Preview zones (no quotes, no header row):
SELECT *
FROM nyc_taxi_raw.zones
LIMIT 10;
Result in my account: first row  1 | EWR | Newark Airport | EWR , then  2 | Queens | Jamaica Bay | Boro Zone .
Figure 13


Step 7: Explore the Raw Data in Athena

This finds the 10 busiest pickup zones by joining trips with the zone lookup:
SELECT z.borough,
z.zone,
COUNT(*) AS trips
FROM nyc_taxi_raw.yellow y
JOIN nyc_taxi_raw.zones z
ON y.pulocationid = CAST(z.locationid AS integer)
GROUP BY z.borough, z.zone
ORDER BY trips DESC
LIMIT 10;
Expected result (from the Jan 2025 file; the top four rows match my Athena run):
Borough
Zone
Trips
Manhattan
Midtown Center
169,977
Manhattan
Upper East Side South
163,703
Manhattan
Upper East Side North
155,647
Queens
JFK Airport
146,137
Manhattan
Times Sq/Theatre District
125,829
Manhattan
Penn Station/Madison Sq West
119,131
Manhattan
Midtown East
117,930
Manhattan
Lincoln Square East
110,585
Manhattan
Upper West Side South
96,614
Manhattan
Midtown North
95,906
Figure 14

This checks for trips whose pickup time falls outside January 2025:
SELECT COUNT(*) AS rows_outside_jan_2025
FROM nyc_taxi_raw.yellow
WHERE tpep_pickup_datetime < TIMESTAMP '2025-01-01 00:00:00'
OR tpep_pickup_datetime >= TIMESTAMP '2025-02-01 00:00:00';
Result in my account: 22 rows (pickups range from 2024-12-31 20:47:55 to 2025-02-01 00:00:44).
Note: Stray rows would land in wrong daily partitions, and Athena writes at most 100 partitions per INSERT. Filtering to January keeps exactly 31.

Step 8: Create the S3 Table Bucket with Analytics Integration

  1. In S3 → Table buckets, click “Create table bucket” and name it  nyc-taxi-lakehouse .
  1. Under “Integration with AWS analytics services”, check the status. My account showed the account-level Enabled with Lake Formation (no per-bucket checkbox); if you see an “Enable integration” checkbox, keep it selected.
  1. Keep SSE-S3 encryption and create the bucket.
Figure 15

Figure 16

What just happened? The integration created a federated Glue catalog,  s3tablescatalog , with every table bucket in the Region as a child catalog, so ours appears in Athena as  s3tablescatalog/nyc-taxi-lakehouse .
Note: With Enabled with Lake Formation, Lake Formation (not just IAM) controls access: even an IAM admin must be a data lake administrator or have grants on the catalog before Athena shows it. If that’s you, do Step 12 now, then return to Step 9.

Step 9: Create the Namespace and the Iceberg Table, then Load January

In the Athena query editor (workgroup  lakehouse-wg ), set “Data source” to  AwsDataCatalog  and “Catalog” to  s3tablescatalog/nyc-taxi-lakehouse .
Figure 17

9a. Create the namespace. In S3 Tables, a namespace is what Athena calls a database:
CREATE DATABASE taxi;
Refresh the “Database” list and choose  taxi .
Figure 18

9b. Create the Iceberg table with clean snake_case column names and a hidden day partition on pickup time:
CREATE TABLE trips (
vendor_id int,
pickup_datetime timestamp,
dropoff_datetime timestamp,
passenger_count bigint,
trip_distance double,
rate_code_id bigint,
store_and_fwd_flag string,
pickup_location_id int,
dropoff_location_id int,
payment_type bigint,
fare_amount double,
extra double,
mta_tax double,
tip_amount double,
tolls_amount double,
improvement_surcharge double,
total_amount double,
congestion_surcharge double,
airport_fee double,
cbd_congestion_fee double
)
PARTITIONED BY (day(pickup_datetime))
TBLPROPERTIES ('table_type' = 'iceberg');
A few things to notice:
  • No  LOCATION : S3 Tables manages storage.
  • Lowercase names are required by the S3 Tables integration ( VendorID  →  vendor_id ).
  • Use  string , not  varchar .
  •  day(pickup_datetime)  is hidden partitioning: filters on  pickup_datetime  prune partitions with no extra date column.
Figure 19

The S3 console now lists  trips  under namespace  taxi  in the table bucket.
Figure 20

9c. Load January 2025. This reads the raw Glue table (default catalog) and writes to the Iceberg table, keeping only January pickups:
INSERT INTO trips
SELECT
vendorid, tpep_pickup_datetime, tpep_dropoff_datetime, passenger_count, trip_distance,
ratecodeid, store_and_fwd_flag, pulocationid, dolocationid, payment_type,
fare_amount, extra, mta_tax, tip_amount, tolls_amount, improvement_surcharge,
total_amount, congestion_surcharge, airport_fee, cbd_congestion_fee
FROM "awsdatacatalog"."nyc_taxi_raw"."yellow"
WHERE tpep_pickup_datetime >= TIMESTAMP '2025-01-01 00:00:00'
AND tpep_pickup_datetime < TIMESTAMP '2025-02-01 00:00:00';
Figure 21

Note: The fully qualified  "awsdatacatalog"...  name lets one query read the Glue catalog and write to S3 Tables.
9d. Query the curated table (from  sql/05_curated_queries.sql ). Count the rows loaded:
SELECT COUNT(*) AS trips FROM trips;
Expected: 3,475,204 (raw count minus the 22 out-of-month rows), across 31 daily partitions.
Busiest days and their revenue:
SELECT CAST(pickup_datetime AS date) AS pickup_day,
COUNT(*) AS trips,
ROUND(SUM(total_amount), 2) AS revenue
FROM trips
GROUP BY 1
ORDER BY trips DESC
LIMIT 5;
pickup_day
trips
revenue
2025-01-16
138,711
3,595,777.16
2025-01-23
138,136
3,452,987.17
2025-01-25
136,816
3,176,920.42
2025-01-31
133,579
3,322,164.37
2025-01-30
133,266
3,412,903.60
Quietest: Jan 5 (79,624), Jan 6 (80,126), Jan 2 (84,832), right after the holidays.
This joins the Iceberg table with the raw zone lookup across catalogs for trips, average distance and average fare per pickup zone:
SELECT z.borough,
z.zone,
COUNT(*) AS trips,
ROUND(AVG(t.trip_distance), 2) AS avg_miles,
ROUND(AVG(t.total_amount), 2) AS avg_total_usd
FROM trips t
JOIN "awsdatacatalog"."nyc_taxi_raw"."zones" z
ON t.pickup_location_id = CAST(z.locationid AS integer)
GROUP BY z.borough, z.zone
ORDER BY trips DESC
LIMIT 10;
Expected top 5:
Borough
Zone
Trips
Avg miles
Avg total (USD)
Manhattan
Midtown Center
169,977
3.79
22.90
Manhattan
Upper East Side South
163,703
1.67
19.26
Manhattan
Upper East Side North
155,647
2.46
19.71
Queens
JFK Airport
146,135
15.11
72.35
Manhattan
Times Sq/Theatre District
125,829
2.77
25.22
JFK pickups average 15.11 miles and $72.35 per trip, more than three times a typical Manhattan pickup.
Payment mix using the TLC data dictionary codes:
SELECT CASE payment_type
WHEN 0 THEN 'Flex Fare'
WHEN 1 THEN 'Credit card'
WHEN 2 THEN 'Cash'
WHEN 3 THEN 'No charge'
WHEN 4 THEN 'Dispute'
WHEN 5 THEN 'Unknown'
WHEN 6 THEN 'Voided trip'
END AS payment,
COUNT(*) AS trips,
ROUND(100.0 * COUNT(*) / SUM(COUNT(*)) OVER (), 2) AS pct
FROM trips
GROUP BY payment_type
ORDER BY trips DESC;
Expected: Credit card 2,444,377 (70.34%), Flex Fare 540,149 (15.54%), Cash 390,423 (11.23%), Dispute 76,481 (2.20%), No charge 23,773 (0.68%), Unknown 1.
And the new congestion relief zone (CBD) fee, which started on January 5, 2025:
SELECT COUNT_IF(cbd_congestion_fee > 0) AS trips_with_cbd_fee,
ROUND(SUM(cbd_congestion_fee), 2) AS cbd_fees_usd,
ROUND(100.0 * COUNT_IF(cbd_congestion_fee > 0) / COUNT(*), 2) AS pct_of_trips
FROM trips;
Expected: 2,246,494 trips (64.64%) paid $1,679,955.75. Jan 1–3 have zero, Jan 4 has 401, and from Jan 5 it jumps to 50,000+ trips a day: the policy start date, right in the data.
Figure 22


Step 10: Use Iceberg Features: DELETE, UPDATE, Time Travel, Schema Evolution and MERGE

Run these in order from  sql/06_iceberg_features.sql , with catalog  s3tablescatalog/nyc-taxi-lakehouse  and database  taxi .
10a. List the table’s snapshots. Every write creates a snapshot; right now there’s one, from the INSERT:
SELECT committed_at, snapshot_id, operation
FROM "trips$snapshots"
ORDER BY committed_at;
Figure 23

Copy the  committed_at  value for time travel.
10b. DELETE bad rows. Check how many trips have no distance:
SELECT COUNT(*) AS bad_rows FROM trips WHERE trip_distance <= 0;
Expected: 90,893 (all exactly 0). Remove them:
DELETE FROM trips WHERE trip_distance <= 0;
 SELECT COUNT(*) FROM trips  now returns 3,384,311.
Figure 24

10c. UPDATE missing values. All 488,166 remaining rows with a NULL  store_and_fwd_flag  are Flex Fare ( payment_type = 0 ) with NULL  passenger_count  and  rate_code_id : a different record type, not random gaps. I normalize the flag to  'N' :
UPDATE trips
SET store_and_fwd_flag = 'N'
WHERE store_and_fwd_flag IS NULL;
Note: Athena writes UPDATE/DELETE as merge-on-read position delete files (you pay for data scanned); S3 Tables compaction later folds them into the data files.
10d. Time travel. Compare the table now with the table before the DELETE. Use a UTC time between the first and second  committed_at  values from  trips$snapshots :
SELECT
(SELECT COUNT(*) FROM trips) AS rows_now,
(SELECT COUNT(*) FROM trips
FOR TIMESTAMP AS OF TIMESTAMP '2026-11-04 15:00:00 UTC') AS rows_before_delete;
Expected:  rows_now  = 3,384,311,  rows_before_delete  = 3,475,204. You can also travel to an exact snapshot ID:
SELECT COUNT(*) FROM trips FOR VERSION AS OF <snapshot_id_from_10a>;
Figure 25

10e. Schema evolution: add a column.  ALTER TABLE ADD COLUMNS  changes only metadata; no data files are rewritten:
ALTER TABLE trips ADD COLUMNS (trip_duration_min double);
Existing rows show NULL until you backfill:
UPDATE trips
SET trip_duration_min = date_diff('second', pickup_datetime, dropoff_datetime) / 60.0
WHERE trip_duration_min IS NULL;
After the backfill, the average trip is 15.11 minutes and the median 11.73 minutes.
Figure 26

Figure 27

10f. MERGE (upsert) a correction. A late tip correction arrives for a JFK pickup on January 15 at 00:01:09 to Canarsie (7.03 miles), recorded with a $0.00 tip and $25.26 total. MERGE matches it on key columns and updates it in place:
MERGE INTO trips t
USING (
SELECT 2 AS vendor_id,
TIMESTAMP '2025-01-15 00:01:09' AS pickup_datetime,
132 AS pickup_location_id,
CAST(5.00 AS double) AS corrected_tip
) s
ON t.vendor_id = s.vendor_id
AND t.pickup_datetime = s.pickup_datetime
AND t.pickup_location_id = s.pickup_location_id
WHEN MATCHED THEN
UPDATE SET tip_amount = s.corrected_tip,
total_amount = t.total_amount - t.tip_amount + s.corrected_tip;
Check the result:
SELECT vendor_id, pickup_datetime, pickup_location_id, dropoff_location_id, tip_amount, total_amount
FROM trips
WHERE vendor_id = 2
AND pickup_datetime = TIMESTAMP '2025-01-15 00:01:09'
AND pickup_location_id = 132;
Expected: one row with  tip_amount  = 5.0 and  total_amount  = 30.26 (was 25.26).
Figure 28

Note: In production,  USING  would read a staging table, with  WHEN NOT MATCHED THEN INSERT ...  for new records.
10g. See the full history.
SELECT made_current_at, snapshot_id, parent_id, is_current_ancestor
FROM "trips$history"
ORDER BY made_current_at;
You’ll see one entry per change: the INSERT, DELETE, UPDATE, backfill UPDATE and MERGE.
Figure 29

Congratulations! You’ve just cleaned, corrected, evolved and audited a 3.4-million-row table using nothing but SQL.
Note: Time travel is not a backup; S3 Tables expires old snapshots. For real backups, see  Securing Your Data with AWS Backup .

Step 11 (Optional): Automate Monthly Loads with EventBridge Scheduler

The TLC publishes a new file monthly. Upload it to  raw/yellow/  (e.g.  yellow_tripdata_2025-02.parquet ) and the  yellow  table picks it up automatically; all that’s left is a monthly INSERT. EventBridge Scheduler calls the Athena API directly, so there’s no Lambda to maintain.
The query ( sql/07_monthly_incremental_insert.sql ) loads only the month after the latest month already in  trips , applying the Step 10 cleanup rules. If the next file isn’t there yet, it inserts 0 rows:
INSERT INTO "s3tablescatalog/nyc-taxi-lakehouse"."taxi"."trips"
SELECT vendorid, tpep_pickup_datetime, tpep_dropoff_datetime, passenger_count, trip_distance,
ratecodeid, COALESCE(store_and_fwd_flag, 'N'), pulocationid, dolocationid, payment_type, fare_amount,
extra, mta_tax, tip_amount, tolls_amount, improvement_surcharge, total_amount,
congestion_surcharge, airport_fee, cbd_congestion_fee,
date_diff('second', tpep_pickup_datetime, tpep_dropoff_datetime) / 60.0
FROM "awsdatacatalog"."nyc_taxi_raw"."yellow"
WHERE trip_distance > 0
AND date_trunc('month', tpep_pickup_datetime) = (
SELECT date_add('month', 1, date_trunc('month', MAX(pickup_datetime)))
FROM "s3tablescatalog/nyc-taxi-lakehouse"."taxi"."trips"
);
11a. Create the execution role. EventBridge Scheduler runs the query as this role.
  1. Open IAM → Roles → “Create role” → “Custom trust policy” and paste:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": { "Service": "scheduler.amazonaws.com" },
"Action": "sts:AssumeRole"
}
]
}
  1. Skip managed policies, name the role  lakehouse-monthly-load-role , and create it.
  1. Add an inline policy  lakehouse-monthly-load  from  sql/scheduler_role_policy.json : Athena queries in  lakehouse-wg , Glue Catalog reads, S3 reads on  raw/  and writes to  athena-results/ , and S3 Tables read/write on  nyc-taxi-lakehouse .
11b. Create the schedule.
  1. In EventBridge → Scheduler, create a schedule named  nyc-taxi-monthly-load .
  1. Choose Recurring schedule → Cron-based schedule and enter  0 6 5 * ? *  (06:00 on the 5th of every month). Set “Flexible time window” to Off and timezone to America/New_York. Click “Next”.
  1. On “Select target”, choose All APIs → Athena → StartQueryExecution.
  1. In the input box, paste the JSON from  sql/07_scheduler_input.json ; it contains the query above as  QueryString  and sets  "WorkGroup": "lakehouse-wg" . Click “Next”.
  1. Under “Permissions”, choose “Use existing role” →  lakehouse-monthly-load-role . Review and click “Create schedule”.
Note: The TLC publishes data a couple of months late, so the schedule only loads when you’ve uploaded a new file. Check each run in Athena → Recent queries for  lakehouse-wg .

Step 12: Grant Access with AWS Lake Formation

Required (before Step 9) if your S3 Tables integration shows Enabled with Lake Formation, as mine did: the catalog won’t appear in Athena, or you’ll get “Insufficient permissions to execute the query. Principal does not have any privilege on specified resource”. Otherwise it’s optional, e.g. for column-level access for analysts.
  1. In AWS Lake Formation → Administrative roles and tasks → Data lake administrators, click “Add”, select  blog-builder , and save. IAM admin alone isn’t enough.
  1. Under Catalogs, confirm  s3tablescatalog  lists  s3tablescatalog/nyc-taxi-lakehouse .
Figure 30

  1. Choose Data permissions → “Grant”, principal IAM users and roles →  blog-builder .
  1. Choose Named Data Catalog resources: catalog  <your-account-id>:s3tablescatalog/nyc-taxi-lakehouse , database  taxi , table  trips  (or All tables).
  1. Grant Super (or Select, Insert, Delete, Describe, Alter, Drop) and click “Grant”.
Figure 31

Figure 32

Note: “Iceberg cannot access the requested resource” means a grant is missing on the catalog or database itself, not just the table.

Step 13: Verify the Lakehouse

  1. Glue:  nyc_taxi_raw  has  yellow  and  zones .
  1. Raw count:  nyc_taxi_raw.yellow  has 3,475,226 rows.
  1. S3 Tables:  nyc-taxi-lakehouse  →  taxi  →  trips  exists.
  1. Curated count:  trips  has 3,384,311 rows after Step 10 (3,475,204 without the DELETE).
  1. Partitions: this returns 31 rows, one per day:
SELECT * FROM "trips$partitions";
  1. History:  trips$history  shows one snapshot per change.
  1. Cost guardrail: the  lakehouse-wg  Execution controls tab shows the 1 GB limit.
Figure 33


Cost Estimate

For us-east-1 (prices at the time of writing; check current ones):
Service
Usage
Approx. cost
S3 (raw bucket)
~60 MB, a few hundred requests
< $0.01
S3 Tables
~60 MB at $0.0265/GB-month + requests, monitoring ($0.025/1,000 objects), compaction ($0.002/1,000 objects + $0.005/GB)
< $0.05
Glue Data Catalog
A few objects and requests
$0 (free tier)
Athena
~20 queries, $5/TB scanned, 10 MB minimum
< $0.02
EventBridge Scheduler
1 run/month
$0 (free tier)
Total (same-day cleanup)

Well under $1
The 1 GB scan limit caps any single query at about $0.005.

Cleanup (in this order)

Table buckets must be emptied from the inside out:
  1. Drop the Iceberg table and namespace (catalog  s3tablescatalog/nyc-taxi-lakehouse ):
DROP TABLE trips;
DROP DATABASE taxi;
  1. Delete the table bucket from AWS CloudShell in us-east-1 (replace the account ID). It fails if any namespace or table still exists, which is why step 1 comes first:
aws s3tables delete-table-bucket \
--table-bucket-arn arn:aws:s3tables:us-east-1:<account-id>:bucket/nyc-taxi-lakehouse
  1. Delete the schedule  nyc-taxi-monthly-load  and IAM role  lakehouse-monthly-load-role  (Step 11).
  1. Revoke Lake Formation grants and remove  blog-builder  from Data lake administrators (Step 12).
  1. Drop the raw tables and database (catalog None):
DROP TABLE nyc_taxi_raw.yellow;
DROP TABLE nyc_taxi_raw.zones;
DROP DATABASE nyc_taxi_raw;
  1. Delete the workgroup  lakehouse-wg .
  1. Empty and delete the raw bucket  nyc-taxi-raw-ajay-20261104 .
Note: Dropping Athena tables doesn’t delete the raw files; only step 7 does.

Troubleshooting

Symptom
Cause
Fix
 Unsupported Federation Resource - Invalid table or column names 
Uppercase names in S3 Tables
Use lowercase ( vendor_id )
 Principal does not have any privilege on specified resource 
Integration uses Lake Formation
Grant in Lake Formation (Step 12)
 Iceberg cannot access the requested resource 
No LF grant on catalog/database
Grant on the catalog and  taxi , not just the table
Zone values have quotes or a header row
No OpenCSVSerDe /  skip.header.line.count 
Drop  zones  and rerun the Step 5 DDL
 TOO_MANY_OPEN_PARTITIONS 
INSERT touched >100 partitions
Load one month per INSERT
Writes to the S3 table rejected
SSE-KMS/CSE-KMS results or Requester Pays
Use SSE-S3, disable Requester Pays
Query cancelled: data scanned limit
Scanned >1 GB
Add filters/fewer columns, or raise the limit deliberately
Catalog missing in Athena
Integration off, wrong Region, or no LF permissions
Check status in us-east-1; grant in LF (Step 12)
Join returns 0 rows
Integer vs. string  locationid 
 CAST(z.locationid AS integer) 
 DROP DATABASE taxi  fails
Namespace still has tables
Drop  trips  first
Scheduled run loads nothing
No new file yet, or role lacks permissions
Check Recent queries in  lakehouse-wg 

Best Practices

  • Keep the raw zone immutable; clean data only in the Iceberg table so you can always reload from source.
  • Use lowercase snake_case names in S3 Tables.
  • Partition by how you filter:  day(pickup_datetime)  fits time queries; avoid high-cardinality keys like location ID.
  • Load one month per INSERT to stay under the 100-partition limit and keep snapshots meaningful.
  • Guardrail every workgroup with a scan limit and CloudWatch metrics.
  • Let S3 Tables do the maintenance; keep compaction and snapshot management on.
  • Use least-privilege roles scoped to the exact buckets, workgroup and table bucket.

Conclusion

We built a complete serverless lakehouse: real NYC taxi data landed in an S3 raw zone, cataloged in Glue with Athena DDL, explored in Athena, and promoted into a managed Iceberg table in S3 Tables. Then we used Iceberg’s strengths: deleting 90,893 bad rows, fixing nulls, adding a column without rewriting data, applying a MERGE correction, and traveling back in time to see the table before every change. All of it with SQL, no servers, and for less than a dollar.
Along the way, the data told its own story: Midtown Center is the busiest pickup zone, JFK trips average more than $72, and the congestion relief zone fee shows up in the data on January 5, 2025, the day it started.

What’s Next?

Because  trips  is open Iceberg, Amazon Redshift Serverless, Amazon EMR or Amazon QuickSight can use it without copying data. Try connecting one to  s3tablescatalog/nyc-taxi-lakehouse  next.
Figure 34

Ajay Uppu is an AWS Community Builder and AI/ML & Cloud Engineer with four years of experience across cloud and AI engineering, building RAG applications, fine-tuning language models and developing cloud AI solutions with AWS, Python, PyTorch and Hugging Face. Connect with me on  LinkedIn  or  X (Twitter) .
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article