Connect Amazon S3

An Amazon S3 source reads files from one folder in a bucket and combines everything that matches the chosen format into one table. Use it when a bucket folder holds files in a single format; for the S3 bucket option inside a file source, see Load files.

Create an Amazon S3 source

  1. Open Lake and click Add datasource, then choose Amazon S3 in the picker.
  2. On General, enter a Name of at least 3 characters and a Code of letters and numbers, at least 2 characters. Choose a Folder if you want one. These are the shared fields every source has; see Supported connectors. Click Next.
  3. On Bucket, set the folder URL and the access keys, described below.
  4. On Format, choose the file type and the format, described below.
  5. Check the summary and click Add. On an existing source the button reads Save, and Duplicate creates a copy.

The summary lists Name, Folder URL, Access key ID and the chosen Format; for a CSV format it shows the delimiter in parentheses. It never shows the secret key.

Point the source at a folder

The Bucket step holds the Folder and AWS credentials sections.

The step names whatever is missing or malformed:

Choose the file format

On Format, choose a File type first, then a Format under it. Changing the file type selects that family's first format. A new source starts on CSV with header.

The four file types are Delimited text (CSV or TSV files, one row per line), JSON (JSON lines or JSON documents), Columnar (Parquet, Arrow or ORC files with their own schema) and Other (XML or raw file contents).

File typeFormatFiles readNotes
Delimited textCSV with header.csv filesThe default for a new source.
Delimited textCSV without header.csv filesColumns are named c1, c2, …
Delimited textCSV with header and types.csv filesRow 1 holds the names, row 2 the ClickHouse types.
Delimited textTSV with header.tsv files
Delimited textTSV without header.tsv files
Delimited textTSV with header and types.tsv files
Delimited textTSV raw.tsv filesTab-separated without escape sequences, no header.
Delimited textTSKV.tskv filesTab-separated key=value pairs.
JSONJSON lines.json filesOne JSON object per line (NDJSON).
JSONJSON document.json filesOne document whose "data" array holds the rows.
ColumnarParquet.parquet files
ColumnarArrow.arrow filesApache Arrow IPC files.
ColumnarORC.orc files
OtherRaw file contentsevery fileEvery file under the folder, one row per file.
OtherXML text.xml files
OtherXML as JSON.xml files

Below the cards, a line states which files the chosen format reads: Files ending in .csv are read. for a CSV format, Every file under the folder is read. for Raw file contents, and Pick a supported format to see which files are read. while no supported format is selected.

The step also shows a banner: All matching files under this folder (subfolders included) are combined into one table.

CSV delimiter appears for the CSV formats and is ignored by the others. Choose a comma, a semicolon or a pipe to match the files; the default is a comma.

Test connection on this step reads the matching files with the chosen format, so it needs the format above. It is optional, and you can continue without it.

Edit a saved source

Limits and edge cases

For the messages you may see while you connect an Amazon S3 source, read Lake troubleshooting.

Questions, answered

What should the Folder URL look like?

The full address of the bucket folder that holds the files, written like https://bucket.s3.region.amazonaws.com/prefix/, for example https://my-bucket.s3.eu-central-1.amazonaws.com/exports/. If it does not parse as a URL, the field shows Enter a valid URL (e.g. https://bucket.s3.region.amazonaws.com/prefix/).

Are subfolders read too?

Yes. Every matching file under the folder is read, subfolders included, and they all go into one table.

Which credentials do I need?

An IAM user key that can list the bucket and read the files in this folder. Enter its AWS Access Key ID and AWS Secret Access Key on the Bucket step.

Can I limit which files the source reads?

Two things decide it: Folder URL sets the folder, and Format sets which file extensions are read. Point the URL at a subfolder to narrow the scope, and pick a format whose extension matches only the files you want. Raw file contents reads every file.

Which JSON format should I pick?

JSON lines reads one JSON object per line (NDJSON). JSON document reads one document whose "data" array holds the rows. Both read .json files; pick the one that matches the shape of your files.

My CSV uses semicolons. What do I set?

On the Format step, set CSV delimiter to a semicolon. The setting appears for the CSV formats and is ignored by the others.

I changed the format after saving. What does Sync Schema do?

The format decides how the files are read, so changing it changes the structure of the existing table. The form warns Changing the format changes the existing table structure. Run Sync Schema after you save. Run Sync Schema on the datasource after saving; see Run, stop and troubleshoot loads.

Why does my saved format show as (legacy)?

The format was saved before it was retired from the list offered to new sources, so the picker keeps it visible with (legacy) after its name. If its description says Kept from the saved settings, no longer offered for new sources, the stored value still works. If it says No longer supported - choose another format, pick a supported format before you save.

Does Test connection read my files?

Yes. The test on the Format step reads the matching files with the format you chose, so it needs a format first. It is optional, and you can continue without it.

Is this the same as the S3 bucket option in Load files?

No. The standalone Amazon S3 source on this page reads one folder into one table. The S3 bucket option of a file source uses the file form instead, where you can preview files and load them as one or several tables; see Load files and Supported connectors.