MongoDB to Redshift: CDC via Apache Iceberg
MongoDB to Redshift usually means a Database Migration Service (DMS) task, Debezium through Kafka, or a nightly export and COPY. This guide takes a fourth route. OLake Go reads the MongoDB change stream and commits the changes as Apache Iceberg tables into the AWS Glue Data Catalog, with the files in your own S3 bucket.
Redshift maps the Glue database onto an external schema and queries the tables in place. Nothing else is in the path: no DMS, no Kafka, no load job. Athena and DuckDB read the same tables through the same catalog.
Key takeaways
- OLake Go replicates MongoDB into Iceberg tables in the Glue Data Catalog: a full historical snapshot first, then change data capture (CDC) from the change stream, with no DMS or Debezium in between. Documents are flattened into columns on the way.
- Redshift reads the Glue database through one
CREATE EXTERNAL SCHEMAstatement, with no refresh. Every change a sync commits is visible on the next query, on Serverless and RA3 alike. - The same tables, written once by OLake Go, are also queryable from Athena and DuckDB. In the run on this page all three engines returned identical rows.
The short answer. To replicate MongoDB to Redshift with change data capture (CDC), run OLake Go with a MongoDB replica set as the source and the AWS Glue Data Catalog as the Iceberg destination. Set the upsert type to Positional Deletes, the format Redshift reads.
The first sync copies each collection in full (the historical snapshot); every later sync replays inserts, updates and deletes from the change stream. Redshift, Athena and DuckDB then query the same Iceberg tables, with no second copy.
How MongoDB CDC reaches Redshift here
Two things happen in order, and OLake Go does both on its own. The first sync opens a change stream and saves its resume token. Then it reads each collection in parallel chunks and writes Parquet data files: that is the historical load.
Every later sync resumes the stream from the saved token and replays the inserts, updates and deletes since. Nothing written during the snapshot is lost, and there is no separate backfill job.
Each sync ends with one commit to Glue. OLake Go uploads the data and delete files to the bucket, then updates the table's metadata pointer in the Glue database. Redshift, Athena and DuckDB see the new snapshot on their next query; none of them keeps a copy.
One thing to keep an eye on: the oplog is MongoDB's replay window. A change stream can only resume from a token that is still in the oplog.
A job paused for longer than the oplog window cannot resume and needs a fresh snapshot. Size the oplog for your longest planned pause; the source test on this page reports the current window.
What you need
- MongoDB 4.0 or later running as a replica set, self-hosted or on Atlas, with a user that can read the database and the oplog. The collections on this page ran on MongoDB 7 as a single-node replica set in Docker; step 1 covers Atlas too.
- An AWS account with an S3 bucket for the files and an IAM user or role for OLake Go with Glue and S3 permissions. The run on this page used a bucket and a scoped IAM user in
ap-southeast-1. - Amazon Redshift, Serverless or an RA3 cluster, with an IAM role attached that can read Glue and the bucket. The run on this page used a Serverless workgroup at 8 RPU.
- OLake UI from the Docker Compose install. The run on this page used OLake Go v1.1.0.
- Docker, and about 40 minutes.
Step 1: Prepare MongoDB for CDC
Most readers point OLake Go at collections they already have. If you want to follow along with the exact data from this page, create these two collections first:
The two sample collections used on this page
const now = new Date();
db.customers.insertMany([
{ _id: 1, name: 'Aarav Mehta', email: 'aarav@example.com', city: 'Mumbai', tier: 'gold', created_at: now, updated_at: now },
// ... 8 customers with integer _id values
]);
db.orders.insertMany([
{ _id: 1, customer_id: 2, product: 'Headphones', amount: NumberDecimal('99.19'), status: 'shipped', created_at: now, updated_at: now },
// ... 40 orders
]);
// Then insert whatever you like. This page started with 8 customers and 40 orders.
OLake Go reads MongoDB changes through change streams, which MongoDB builds on the replica set oplog. Three things must be in place before the first sync.
| Setting | Value | Why it matters |
|---|---|---|
| Replica set | any name, even a single node | Change streams and the oplog exist only in replica set mode. Atlas clusters are already replica sets. |
| Oplog retention | long enough to cover your longest pause | OLake Go resumes from a change-stream token saved after each sync; if the oplog has rolled past it, the next sync needs a fresh snapshot. |
| A user for OLake Go | read on the database plus clusterMonitor | The snapshot reads the collections; the change stream needs oplog access, which clusterMonitor (or readAnyDatabase) grants. |
// 1. A single-node replica set, if you do not have one (self-hosted only)
// start mongod with --replSet rs0, then:
rs.initiate({ _id: "rs0", members: [{ _id: 0, host: "<host>:27017" }] })
// 2. A user for OLake Go
use admin
db.createUser({
user: "olake", pwd: "<password>",
roles: [{ role: "read", db: "shop" }, { role: "clusterMonitor", db: "admin" }]
})
// 3. Check the oplog window; OLake Go warns below 7 days
use local
db.oplog.rs.stats().maxSize // bytes; raise with replSetResizeOplog if it is small
Check the result before moving on:
rs.status().members.map(m => m.stateStr) // one PRIMARY
db.getSiblingDB("admin").getUsers().users.map(u => u.user)
On MongoDB Atlas the replica set and oplog are already there; create the user under Database Access with the read role on your database and clusterMonitor, and allow OLake Go's IP in Network Access. The full guide, including Atlas screenshots, is MongoDB and Atlas CDC setup.
Atlas and most self-hosted installs keep 24 hours or less of oplog by default. OLake Go's source test shows the current window and warns below 7 days. Size it for your longest planned pause, or run the job often enough that the token never falls out of the window.
Step 2: Set up the Glue catalog
Redshift reads Iceberg tables through a catalog. AWS Glue Data Catalog is the one this page uses: OLake Go creates a Glue database per job and registers each table there. The files sit in your S3 bucket.
Redshift, Athena, Amazon Elastic MapReduce (EMR) and DuckDB all read from the same catalog. Redshift reaches it through an external schema, with the IAM role attached to the workgroup or cluster.
| Catalog | OLake Go writes | Amazon Redshift reads | Verified on this page |
|---|---|---|---|
| AWS Glue | Yes | Yes: external schema from the Glue Data Catalog | Yes, end to end |
- AWS Glue
AWS Glue Data Catalog is the default catalog in OLake Go. The tables live as Parquet and metadata files in an S3 bucket you own, and Glue holds the pointer to the current metadata file. Athena, Redshift, EMR, Spark and DuckDB read the same tables through Glue, which is why it is the catalog to pick when more than one AWS engine will read the data.
You need:
- An S3 bucket for the table files, in the region where your engines run.
- An IAM user or role for OLake Go with Glue and S3 permissions. The exact policy is on the AWS Glue catalog page.
- No Glue database in advance: OLake Go creates one per job, named after the source database and schema (for example
pg_to_snowflake_shop_public).
Glue has no built-in compaction for tables written by external engines, so plan on OLake Fusion or Spark for maintenance once the change volume grows.
The run on this page gave OLake Go a scoped IAM user with this inline policy. Redshift got a role with AmazonS3ReadOnlyAccess and read access to Glue:
{
"Version": "2012-10-17",
"Statement": [
{ "Effect": "Allow", "Action": ["s3:ListBucket", "s3:GetBucketLocation"], "Resource": "arn:aws:s3:::<bucket>" },
{ "Effect": "Allow", "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject", "s3:AbortMultipartUpload", "s3:ListMultipartUploadParts"], "Resource": "arn:aws:s3:::<bucket>/*" },
{ "Effect": "Allow",
"Action": ["glue:GetDatabase", "glue:GetDatabases", "glue:CreateDatabase", "glue:GetTable", "glue:GetTables", "glue:CreateTable", "glue:UpdateTable", "glue:DeleteTable"],
"Resource": ["arn:aws:glue:<region>:<account>:catalog", "arn:aws:glue:<region>:<account>:database/*", "arn:aws:glue:<region>:<account>:table/*/*"] }
]
}
Step 3: Connect MongoDB to OLake Go
- OLake UI
- OLake CLI
- In the OLake UI, open Sources and click Create Source. Pick MongoDB as the connector, give the source a name and keep the OLake Go version on the latest release.
- Under Change data capture (CDC), leave Enable CDC on.
- Under Connection details, add each host as
host:port(or one SRV host with Use SRV on for Atlas), then the Database Name, Auth DB (admin), username, password and the Replica Set name. Leave Read Preference onprimaryunless you have secondaries to spare. - Click Set up source. OLake Go tests the connection, confirms that it can open a change stream, and reports the oplog window with a warning below 7 days.
Here is the source form from the run on this page. MongoDB ran in another container, so the host is host.docker.internal:27017; the replica set is rs0 and the user is the one from step 1, authenticating against admin.
Set up source runs the connection test, confirms that a change stream can be opened, and reports the oplog window before anything is saved. A window under 7 days shows as a warning, not a blocker.
The full field reference, including SRV strings, IAM authentication and SSH tunnels, is on the MongoDB connector page.
Create source.json in your config folder. replica_set is what lets OLake Go open the change stream:
{
"hosts": [
"host1:27017",
"host2:27017",
"host3:27017"
],
"username": "username",
"password": "password",
"authdb": "admin",
"replica_set": "rs0",
"read_preference": "secondaryPreferred",
"srv": false,
"database": "database",
"max_threads": 5,
"backoff_retry_count": 4,
"chunking_strategy":""
}
Then confirm OLake Go can reach the database:
docker run --pull=always \
-v "$PWD/config:/mnt/config" \
olakego/source-mongodb:latest \
check --config /mnt/config/source.json
A working setup returns "status": "SUCCEEDED" with a prerequisites list that reports change_streams as passed and the oplog_retention window. Every field is described on the MongoDB connector page.
Step 4: Configure the Iceberg destination
- AWS Glue
- OLake UI
- OLake CLI
- Open Destinations and click Create Destination.
- Pick Apache Iceberg as the connector and AWS Glue as the catalog type.
- Enter the S3 path, the AWS region and the access key pair (or leave the keys empty to use the instance role).
- Click Create.
| Parameter | Sample Value | Description |
|---|---|---|
S3 Path required | s3://<BUCKET_NAME>/ | S3 bucket path where Iceberg table data and metadata files will be stored. |
AWS Region required | ap-south-1 | AWS Region where your S3 bucket and Glue Data Catalog exist. Required so OLake Go calls the correct regional S3 and Glue endpoints. |
| AWS Access Key | XXX | AWS access key ID for authentication. Optional if using IAM roles or instance profiles. If using IAM: Docker Compose: add the required IAM environment variables under x-envs in your compose file. See Service Environment Variables for setup details.Kubernetes: set up pod IAM in Cloud Integration. |
| AWS Secret Key | XXX | AWS secret access key for authentication. Optional if using IAM roles or instance profiles. If using IAM: Docker Compose: add the required IAM environment variables under x-envs in your compose file. See Service Environment Variables for setup details.Kubernetes: set up pod IAM in Cloud Integration. |
| S3 Endpoint | https://glue.ap-south-1.amazonaws.com | S3 API endpoint for writing Iceberg data files. Optional for AWS S3 but required for S3-compatible storage like MinIO. |
| Custom Glue Endpoint Configuration | true/false | Enable custom Glue catalog configuration when Glue catalog settings differ from S3 (different credentials, region, or endpoint). Shows additional Glue configuration fields. Leave off when Glue and S3 use the same AWS setup. |
| Enable Arrow Writes | true/false | Writes data and delete files using Apache Arrow based writer and registers them in Iceberg. |
The following fields appear in the UI after Custom Glue Endpoint Configuration is turned on. Configure Glue catalog connection settings here separately from the S3 fields above.
| Parameter | Sample Value | Description |
|---|---|---|
| Glue Catalog ID | 123456789012 | AWS account ID used as the Glue Data Catalog identifier. |
| Glue Access Key | XXX | Access key for authenticating Glue catalog requests. Required when Glue credentials differ from S3 credentials. |
| Glue Secret Key | XXX | Secret key for authenticating Glue catalog requests. Required when Glue credentials differ from S3 credentials. |
| Glue Endpoint | https://glue.ap-south-1.amazonaws.com | Custom endpoint URL for AWS Glue or a Glue-compatible catalog service. |
| Glue Region | ap-south-1 | Region for the Glue catalog, if different from the S3 region. Falls back to AWS Region if not set. |
{
"type": "ICEBERG",
"writer": {
"catalog_type": "glue",
"catalog_name": "olake_iceberg",
"iceberg_s3_path": "s3://<BUCKET_NAME>/",
"aws_region": "<AWS_REGION>",
"aws_access_key": "<AWS_ACCESS_KEY>",
"aws_secret_key": "<AWS_SECRET_KEY>",
"arrow_writes": false
}
}
| Parameter | Sample Value | Description |
|---|---|---|
iceberg_s3_path required | s3://<BUCKET_NAME>/ | S3 bucket path where Iceberg table data and metadata files will be stored. |
aws_region required | ap-south-1 | AWS Region where your S3 bucket and Glue Data Catalog exist. Required so OLake Go calls the correct regional S3 and Glue endpoints. |
| aws_access_key | XXX | AWS access key ID for S3 authentication. Optional if using IAM roles or instance profiles. If using IAM: add the required IAM environment variables in your shell or runtime environment. |
| aws_secret_key | XXX | AWS secret access key for S3 authentication. Optional if using IAM roles or instance profiles. If using IAM: add the required IAM environment variables in your shell or runtime environment. |
| s3_endpoint | https://glue.ap-south-1.amazonaws.com | S3 API endpoint for reading/writing Iceberg data files. Optional for AWS S3 but required for S3-compatible storage like MinIO. |
| glue_additional_config | true/false | Enable custom Glue catalog configuration when Glue catalog settings differ from S3 (different credentials, region, or endpoint). Leave off when Glue and S3 use the same AWS setup. |
| arrow_writes | false | Writes data and delete files using Apache Arrow based writer and registers them in Iceberg. |
When using separate Glue catalog settings, set glue_additional_config to true in destination.json and add the fields below. These configure Glue catalog connection settings separately from the S3 fields above.
| Parameter | Sample Value | Description |
|---|---|---|
| glue_catalog_id | 123456789012 | AWS account ID used as the Glue Data Catalog identifier. |
| glue_access_key | XXX | Access key for authenticating Glue catalog requests. Required when Glue credentials differ from S3 credentials. |
| glue_secret_key | XXX | Secret key for authenticating Glue catalog requests. Required when Glue credentials differ from S3 credentials. |
| glue_endpoint | https://glue.ap-south-1.amazonaws.com | Custom endpoint URL for AWS Glue or a Glue-compatible catalog service. |
| glue_region | ap-south-1 | Region for the Glue catalog, if different from the S3 region. Falls back to AWS Region if not set. |
Here is the destination form from the run on this page. It holds the bucket path OLake Go writes under, the region of the bucket and the Glue catalog, and the access key pair of the IAM user from step 2.
Step 5: Create the job and run the first sync
Redshift is not in OLake Go's target engine picker yet. This job therefore lists Athena and DuckDB as target engines and sets the upsert type to Positional Deletes by hand.
That is the format Redshift reads, and both listed engines read it too. Each stream runs as Full Refresh + CDC, so the change stream carries every change after the snapshot.
- OLake UI
- OLake CLI
- Open Jobs and click Create Job. Give it a name and a schedule. Every Day at a fixed hour, or a cron expression, both work; the schedule is how often the change stream is drained, not how often a full copy runs.
- Select the source and the destination you created.
- Under Advanced Settings, set Target Query Engines to AWS Athena and DuckDB (Redshift is not in the list yet; it reads what Athena reads). OLake Go then resolves an Iceberg delete format every one of those engines can read, so you never pick one by hand.
- Click Next. OLake Go discovers the collections and opens the Streams page.
- Tick the collections to replicate. For each one, set the sync mode to Full Refresh + CDC and the ingestion mode to Upsert. Leave the Upsert Type as OLake Go resolved it (Positional Deletes in the run on this page).
- Click Create Job, then open the job's menu and choose Sync Now for the first run.
OLake Go offers every delete format Athena and DuckDB both read. The run on this page picked Positional Deletes from that list because Redshift reads Iceberg v2 tables with positional deletes and nothing else.

Discover the collections, choose the streams, then sync:
docker run --pull=always \
-v "$PWD/config:/mnt/config" \
olakego/source-mongodb:latest \
discover --config /mnt/config/source.json
discover writes two files: available_streams.json (every collection it found, do not edit) and selected_streams.json (the collections you want and their settings). In selected_streams.json, set sync_mode to {props.cliSyncMode ?? 'cdc'} for each collection and pick the delete format your readers can open:
{
"selected_streams": {
"shop": [
{
"stream_name": "customers",
"sync_mode": "cdc",
"normalization": true,
"append_mode": false,
"update_type": "pos"
}
]
}
}
update_type accepts eq (equality deletes, the default), pos (positional deletes) and dv (deletion vectors). Positional deletes and deletion vectors keep a small index between runs, so give the container a persistent directory for it through OLAKE_INDEX_DB_DIR. The first sync runs without a state file; OLake Go writes one at the end of the run:
docker run --pull=always \
-v "$PWD/config:/mnt/config" \
-e OLAKE_INDEX_DB_DIR=/mnt/config/index-db \
olakego/source-mongodb:latest \
sync \
--config /mnt/config/source.json \
--selected-streams /mnt/config/selected_streams.json \
--available-streams /mnt/config/available_streams.json \
--destination /mnt/config/destination.json
Every later run adds --state /mnt/config/state.json to the same command, which is how OLake Go knows to replay only the changes since the last run. The full selected_streams.json reference is on the Docker CLI page; the index directory is described under index DB setup.
On this page the first run copied 8 customers and 40 orders (48 documents, 6.40 KB) and finished in 14 seconds, container start included. OLake Go names the Glue database after the job and the source database, so mongodb_to_redshift on database shop produced mongodb_to_redshift_shop. The Iceberg DB field at the top of the Streams page changes it before the first sync.
Step 6: Query the tables in Redshift
- AWS Glue
Redshift reads the Glue Data Catalog through an external schema: one statement maps a Glue database onto a schema name in your Redshift database, and every Iceberg table OLake Go commits there is queryable at once, with no refresh. Redshift Serverless and RA3 clusters both do this; the IAM role attached to the namespace or cluster needs read access to Glue and to the bucket.
-- Once: map the Glue database OLake Go created (schema = <job name>_<source database>_<source schema>)
CREATE EXTERNAL SCHEMA lakehouse
FROM DATA CATALOG
DATABASE 'mongodb_to_redshift_shop'
IAM_ROLE default;
-- Then query the Iceberg tables like any other schema
SELECT _id, name, city, tier FROM lakehouse.customers ORDER BY _id;
SELECT status, count(*) AS n, sum(cast(amount AS decimal(12,2))) AS total
FROM lakehouse.orders GROUP BY status ORDER BY status;
IAM_ROLE default uses the default role of the namespace (Serverless) or cluster; name a role ARN instead when you keep several. Redshift reads Iceberg v2 tables with positional deletes, which is why the job on this page uses that upsert type. The external schema is read-only: OLake Go is the writer, and INSERT or DELETE on these tables fails.
OLake Go adds four columns to every table: _olake_id (a hash of the primary key), _op_type, _olake_timestamp and _cdc_timestamp. _op_type is r for a row from the first snapshot, c for an insert, u for an update and d for a delete. Filter them out of dashboards, or use them to see when a row last changed.
The key column is _id, as in MongoDB, and amount arrives as text because the fixture stores it as Decimal128. The roll-up below therefore casts it: sum(cast(amount AS decimal(12,2))).
Step 7: Change documents in MongoDB and sync again
To see the change path work, the run on this page made 12 changes in MongoDB after the first sync:
const now = new Date();
db.customers.insertMany([
{ _id: 9, name: 'Maya Patel', email: 'maya@example.com', city: 'Pune', tier: 'silver', created_at: now, updated_at: now },
{ _id: 10, name: 'Lucas Silva', email: 'lucas@example.com', city: 'São Paulo', tier: 'bronze', created_at: now, updated_at: now }
]);
db.orders.insertMany([
{ _id: 41, customer_id: 9, product: 'Laptop', amount: NumberDecimal('1299.00'), status: 'placed', created_at: now, updated_at: now },
{ _id: 42, customer_id: 9, product: 'Mouse', amount: NumberDecimal('25.50'), status: 'placed', created_at: now, updated_at: now },
{ _id: 43, customer_id: 10, product: 'Monitor', amount: NumberDecimal('349.99'), status: 'placed', created_at: now, updated_at: now },
{ _id: 44, customer_id: 3, product: 'Keyboard', amount: NumberDecimal('89.00'), status: 'placed', created_at: now, updated_at: now },
{ _id: 45, customer_id: 7, product: 'Webcam', amount: NumberDecimal('79.90'), status: 'placed', created_at: now, updated_at: now }
]);
db.customers.updateOne({ name: 'Liam Carter' }, { $set: { tier: 'gold', updated_at: now } });
db.customers.updateOne({ name: 'Zara Ali' }, { $set: { city: 'Abu Dhabi', updated_at: now } });
db.orders.updateMany({ _id: { $in: [1, 4, 7] } }, { $set: { status: 'delivered', updated_at: now } });
The second sync read 12 change events (1.60 KB) from the stream and finished in 11 seconds end to end. For customers that meant one new data file with 4 rows: 2 inserts plus the new versions of 2 updated documents. One small positional delete file retires the 2 old versions.
OLake Go's commit report in the sync log shows it directly: addedDataFiles=1, addedRecords=4, addedPositionalDeleteFiles=1, addedPositionalDeletes=2. The orders table has the same shape with 8 rows and 3 deletes.

Redshift shows the result on the next query, with no refresh and no ALTER TABLE. Liam Carter is gold, Zara Ali moved to Abu Dhabi, and the two new customers are there.
The two retired versions are gone, because Redshift applies the positional deletes while reading. The _op_type column shows how each row arrived: r for the snapshot, c for the inserts and u for the updates.
Schema changes. When a new field appears in the documents, OLake Go adds it as a column on the next sync. The Glue table definition is updated in the same commit, and Redshift shows it on the next query of the external schema, with nulls for older rows.
A field whose type changes in an incompatible way fails the sync rather than corrupt the table. Full rules are on the schema evolution page.
Query the same tables from Athena and DuckDB
This is the point of writing Iceberg instead of loading Redshift tables. Nothing is exported, copied or refreshed: both engines read the files OLake Go wrote, through the same Glue database.
- Amazon Athena
- DuckDB
Athena reads the Glue Data Catalog natively: the Glue database OLake Go created shows up in the query editor's database list, and the Iceberg tables in it need no registration and no refresh. Pick a workgroup with a query result location in S3, select the database, and query.
SELECT _id, name, city, tier FROM mongodb_to_redshift_shop.customers ORDER BY _id;
SELECT status, count(*) AS n, sum(cast(amount AS decimal(12,2))) AS total
FROM mongodb_to_redshift_shop.orders GROUP BY status ORDER BY status;
Athena engine v3 reads Iceberg v2 tables with positional and equality deletes, and cannot read v3 tables at all. Keep the job on positional or equality deletes, never deletion vectors, while Athena is a reader. From the command line, aws athena start-query-execution --work-group <workgroup> --query-execution-context Database=${props.schema ?? 'postgres_to_redshift_shop_public'} --query-string "..." runs the same queries; aws athena get-query-results returns the rows.
DuckDB reads an Iceberg table from its current metadata file, which Glue holds as the table's metadata_location. Ask Glue for it, then scan: no catalog to configure, and the same S3 keys you gave OLake Go are enough.
aws glue get-table --database-name <glue database> --name customers \
--query 'Table.Parameters.metadata_location' --output text
INSTALL iceberg; LOAD iceberg;
INSTALL httpfs; LOAD httpfs;
CREATE SECRET lake (TYPE s3, KEY_ID '<access key>', SECRET '<secret key>', REGION '<region>');
SELECT _id, name, city, tier
FROM iceberg_scan('s3://<bucket>/lakehouse/mongodb_to_redshift_shop.db/customers/metadata/<latest>.metadata.json')
ORDER BY _id;
Each sync writes a new metadata file, so fetch the location again before a fresh read, or wrap the two steps in a script. DuckDB can also attach the Glue Data Catalog as an Iceberg REST catalog (ATTACH '<account id>' AS glue (TYPE iceberg, ENDPOINT_TYPE 'glue')), which needs Lake Formation permissions on the catalog; that path is not covered on this page. DuckDB reads positional deletes, and deletion vectors from duckdb-iceberg 1.5.3.
DuckDB 1.5.5 returned the same 10 customers and the same orders roll-up as Redshift and Athena in the run on this page. It read the current metadata file of each table.
An orders roll-up matched MongoDB to the cent in all three engines, each casting amount to a decimal first. It gave 16 delivered orders for 8659.68, 18 placed for 10522.26, 11 shipped for 6397.25.
Data types: MongoDB to Iceberg to Redshift
OLake Go maps MongoDB's BSON (Binary JSON) types to Iceberg types, and Redshift maps Iceberg types to its own through the external schema. Scalars pass through; everything structured arrives as text.
| MongoDB type | Iceberg (written by OLake Go) | Redshift shows | Notes |
|---|---|---|---|
int, timestamp | int | INTEGER | The integer _id keys on this page arrived as INTEGER. |
long | long | BIGINT | |
double | double | DOUBLE PRECISION | |
boolean | boolean | BOOLEAN | |
date | timestamptz (UTC) | TIMESTAMP | Shown without a zone. |
decimal128 | string | VARCHAR | Money stored as NumberDecimal arrives as text. sum(cast(amount AS decimal(12,2))) gives the exact total; the roll-up on this page used that cast. Store doubles in MongoDB if you want a numeric column without the cast. |
objectId, binData, regex, code | string | VARCHAR | An ObjectId primary key arrives as its 24-character hex string. |
object, array | string | VARCHAR | JSON text. Parse with JSON_PARSE into a SUPER value, or pick fields with json_extract_path_text. |
MongoDB types in the table come from the MongoDB connector reference. The Redshift side comes from the Redshift Iceberg page (checked 2026-10-30) and from svv_external_columns on the tables of this run. OLake Go adds _cdc_resume_token on MongoDB tables, the change-stream token each change came from.
Cost and maintenance
- Storage is your bucket: you pay S3 rates for the Parquet and delete files, and nothing to Glue beyond its per-object pricing for the table entries.
- Compute. OLake Go runs wherever you run Docker. Redshift Serverless bills RPU-hours only while queries run; a query over the external schema scans the Parquet files in S3 through Redshift Spectrum, so filter on the columns you need. Athena bills per terabyte scanned.
- Maintenance. Glue has no built-in compaction for tables written by external engines. A CDC table that gets a new small file and delete file per sync wants compaction; OLake Fusion does this for the catalogs OLake Go writes to, and Spark on EMR's
rewrite_data_filesworks through the same Glue catalog. - Oplog size. The oplog is sized in gigabytes, not hours, so a write-heavy cluster shortens the window. Check it after a busy day and resize before a planned pause.
- Key rotation. The IAM user's access key is what OLake Go writes with. Rotate it on your schedule, or run OLake Go on an instance with a role and leave the key fields empty.
Troubleshooting
1. The source test warns about the oplog
oplog_retention: current 1.3 hours, recommended >= 7 days
Not a blocker, but it is the window in which the next sync must start. The fix is on the MongoDB side: replSetResizeOplog on self-hosted, or the minimum oplog window setting on Atlas. Until then, run the job more often than the window.
2. The source test cannot open a change stream
change_streams: OLake cannot open a change stream, so CDC cannot run.
Either mongod is not running with --replSet, or the user lacks oplog access. Check rs.status() on the server and give the OLake Go user clusterMonitor (or readAnyDatabase) in admin on top of read on the database.
3. A money column will not sum in Redshift
ERROR: function sum(character varying) does not exist
The field is a Decimal128 in MongoDB, which arrives as VARCHAR. Wrap it: sum(cast(amount AS decimal(12,2))). Athena and DuckDB need the same cast.
4. The destination test fails on a table OLake Go did not create
User: arn:aws:iam::<account>:user/<olake user> is not authorized to perform: s3:GetObject on resource: "arn:aws:s3:::<another bucket>/.../test_olake.db/test_olake/metadata/00000-....metadata.json"
OLake Go's destination test opens a probe table called test_olake.test_olake in the Glue database test_olake. An earlier run in the same account and region may have left that table behind, pointing at a bucket your user cannot read.
The test then fails before it writes anything. Delete the stale table from Glue, or run OLake Go against a region whose Glue catalog does not have it.
5. Redshift cannot see the external schema's tables
ERROR: Database 'mongodb_to_redshift_shop' does not exist in the Glue Data Catalog
The external schema was created before the first sync, or in a different region from the Glue database. OLake Go creates the Glue database on the first sync; create the external schema after it, in the workgroup's region.
How this compares with other ways to move MongoDB data to Redshift
| Method | Freshness | Updates and deletes | Where the data lands | What you run |
|---|---|---|---|---|
| AWS DMS to Redshift with the MongoDB source | CDC through the oplog or change streams | Yes | Native Redshift tables, in document or table mode | A DMS replication instance and task, plus an S3 staging bucket |
| Debezium, Kafka and a Redshift sink | Seconds | Yes, with your own merge logic | Kafka topics, then Redshift tables | Kafka, Kafka Connect, Debezium and a sink connector per collection |
Export (mongoexport to JSON), then COPY into Redshift | Hours to daily | No; full reloads only | Native Redshift tables | A script, a scheduler and a staging bucket |
| Managed ELT (Fivetran, Estuary, Airbyte Cloud) | Minutes, by plan | Varies by tool | Redshift tables, a second copy you pay to move and store | Nothing; priced per row, per GB or per connector |
| OLake Go to Iceberg on Glue (this guide) | CDC on a schedule down to one minute | Yes, as Iceberg row-level deletes | Apache Iceberg tables that Redshift, Athena, EMR, Spark and DuckDB all read | One Docker Compose stack, open source; your bucket plus your own compute |
DMS is the simpler choice when Redshift is the only reader and you are already on AWS. Writing Iceberg once avoids paying to move and store a second copy. That matters as soon as Athena, EMR or a notebook needs the same rows, or you want to own the files.
When not to use this
- Every query must hit native Redshift speed. Spectrum reads Parquet from S3 on every query. Keep the Iceberg tables as the source and load the hot slice into a native table on a schedule.
- You need the documents kept whole. OLake Go flattens one level; deeply nested documents arrive as JSON text in one column. If every query starts with
JSON_PARSE, loading the documents into aSUPERcolumn in a native Redshift table may serve you better. - You need equality deletes or deletion vectors. Redshift reads positional deletes only. Keep the upsert type on Positional Deletes while Redshift is a reader.
FAQs
How do I replicate MongoDB to Redshift without DMS or a Kafka pipeline?
Run OLake Go (open source, Apache 2.0) against a MongoDB replica set and point it at the AWS Glue Data Catalog with an S3 bucket. The first sync copies each collection in full, every later sync replays only the changes from a change stream, and Redshift reads the result through an external schema over the Glue database. DMS, Kafka, Debezium and a Redshift load job are not needed, and documents are flattened into columns on the way.
Does Redshift read Iceberg tables with row-level deletes?
Yes. Redshift reads Iceberg v2 tables with positional deletes through Redshift Spectrum, on Serverless and RA3. The run on this page used positional deletes and Redshift returned one row per key after the updates. Equality deletes and Iceberg v3 tables with deletion vectors are not the right pick while Redshift is a reader.
Does OLake Go copy the existing collections before it starts reading the change stream?
Yes, automatically. A job in Full Refresh + CDC mode opens the change stream, copies every selected collection in parallel chunks, then replays the stream from the token it saved. Nothing written during the copy is lost, and there is no separate backfill job.
How do nested documents arrive in Redshift?
Flattened one level. Top-level fields become columns; nested objects and arrays arrive as JSON text in a VARCHAR column, which Redshift parses with JSON_PARSE or json_extract_path_text. Decimal128 values also arrive as VARCHAR, so cast them to DECIMAL before you sum.
Is Redshift one of OLake Go's target query engines?
Not in the picker yet. On this page the job lists Athena and DuckDB as target engines and sets the upsert type to Positional Deletes by hand, which is the format Redshift reads. Redshift then reads the tables through the external schema like any other Iceberg v2 table.
Does MongoDB CDC with OLake Go work on Atlas?
Yes. Atlas clusters are already replica sets with the oplog on. Create a database user with the read role on your database plus clusterMonitor, allow OLake Go's address in the Atlas network list, and paste the cluster hosts into the source form with Use SRV on.
What does OLake Go need on the MongoDB side?
A replica set (a single node is fine), oplog retention longer than your longest pause between syncs, and a user with read on the database plus clusterMonitor or readAnyDatabase in admin for oplog access. Step 1 has the commands.
Related guides
Deeper reading on this site: