S3 Destination
Upload sync batches to an Amazon S3 bucket as CSV / JSON / JSONL / Parquet files. Optional gzip compression for the text formats; native column compression for Parquet.
YAML Example — CSV with gzip
destination:
type: s3
bucket: my-data-exports
prefix: drt/users/
format: csv
compression: gzip
region: us-east-1
Default key format: <prefix><UTC ISO8601 basic>.<ext> →
drt/users/20260605T123000Z.csv.gz.
YAML Example — Parquet
destination:
type: s3
bucket: my-data-lake
prefix: events/
format: parquet
parquet_compression: snappy
region: eu-west-1
YAML Example — JSONL to MinIO / R2 / S3-compatible
destination:
type: s3
bucket: events
prefix: drt/
format: jsonl
endpoint_url: http://minio.internal:9000
aws_access_key_id_env: MINIO_ACCESS_KEY
aws_secret_access_key_env: MINIO_SECRET_KEY
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
type | "s3" | — | Required |
bucket | string | — | S3 bucket name |
prefix | string | "" | Key prefix; for per-sync routing, set a unique prefix per sync |
format | csv | json | jsonl | parquet | csv | Output format |
compression | none | gzip | none | gzip compresses csv / json / jsonl. Ignored for parquet (see parquet_compression) |
parquet_compression | snappy | gzip | zstd | none | snappy | Parquet column compression (Parquet only) |
region | string | null | null | AWS region; falls back to boto3 default |
aws_profile | string | null | null | Named profile in ~/.aws/credentials |
aws_access_key_id_env | string | null | null | Env var holding AWS_ACCESS_KEY_ID value |
aws_secret_access_key_env | string | null | null | Env var holding AWS_SECRET_ACCESS_KEY value |
aws_session_token_env | string | null | null | Env var holding AWS_SESSION_TOKEN value |
endpoint_url | string | null | null | For MinIO / LocalStack / R2 / Spaces |
key_template | string | null | null | Override the file name; supports {timestamp} placeholder |
Authentication
By default the destination uses boto3's standard credential chain:
- Environment variables (
AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN) ~/.aws/credentials(default profile)- EC2 instance profile / ECS task role / IAM role
This works without any YAML changes in the typical EC2 / ECS / EKS deployment.
Named profile (when running locally with multiple AWS accounts):
aws_profile: prod-readonly
Explicit env vars (when secrets are managed outside drt's standard credential mechanism, e.g. when injecting per-sync credentials through a secret manager):
aws_access_key_id_env: APP_AWS_KEY_ID
aws_secret_access_key_env: APP_AWS_SECRET
File naming
Every sync writes one file. The default key is:
<prefix><UTC ISO8601 basic>.<ext>
— for example drt/users/20260605T123000Z.csv. Timestamping the key
(rather than overwriting a fixed name) matches the Census / Hightouch
convention and lets downstream consumers reliably detect "new files
since last check".
Custom naming via key_template
For per-sync routing, the recommended pattern is to use a sync-specific prefix:
destination:
type: s3
bucket: data-lake
prefix: drt/active_users/ # per-sync prefix
For more control, set key_template. The only supported placeholder is
{timestamp}. If the template includes its own extension, it is used
as-is; otherwise the format-derived extension is appended.
# Produces: drt/users/snapshot-20260605T123000Z.csv
key_template: "snapshot-{timestamp}"
# Produces: drt/users/latest.csv (no timestamp, no auto-extension)
key_template: "latest.csv"
Format details
| Format | Encoding | Notes |
|---|---|---|
csv | UTF-8 | Header row (column names) + csv.DictWriter, RFC 4180. Empty rows raise. |
json | UTF-8 | JSON array of objects ([{...}, {...}]) |
jsonl | UTF-8 | One JSON object per line — the de-facto data-lake standard |
parquet | binary | Via pandas + pyarrow. Requires the separate [parquet] extra. |
compression: gzip is applied AFTER serialisation for the text formats
and sets the ContentEncoding: gzip header on the S3 object. Use this
for downstream consumers that decompress transparently (Athena, Glue,
Snowpipe, etc.).
Sync modes
S3 destinations write one file per sync run. Because the default
key is timestamped, every run produces a fresh object — there is no
"replace existing data" semantic for an S3 destination. sync.mode
values (full, incremental, upsert, replace, mirror) don't
change S3 behaviour: every batch becomes a row inside the file, and
the file is uploaded once when the batch completes.
If you need "latest snapshot" semantics, point key_template at a
fixed name like latest.csv — downstream consumers will see an
overwrite each run. Note that this loses re-run replay since prior
exports are gone.
Notes
- Requires
pip install drt-core[s3](depends onboto3>=1.34). - For
format: parquet, also requirespip install drt-core[parquet]. - Empty batches short-circuit before any boto3 import or AWS call — the same "no driver was imported" contract used by the SQL destinations. A run with zero source rows produces zero S3 objects.
- Errors during serialisation are recorded in
result.errorsand fail the sync. Errors during upload (AWS-side) are recorded asresult.failed = len(records)so the sync's other batches keep going. - Bucket policies / IAM roles must allow
s3:PutObjecton the prefix.