S3
Overview
S3 foreign tables have been tested against the following object stores that implement the S3 API: Amazon S3, MinIO, Cloudflare R2, and Google Cloud.
This code block demonstrates how to query Parquet file(s) stored in Google Cloud Storage (GCS).
The file path must start with s3
, r2
, or gs
.
The glob pattern can be used to query a directory of files.
Providing Credentials
CREATE USER MAPPING
is used to provide S3 credentials. These credentials are tied to a specific Postgres user, which enables
multiple users to query the same foreign table with their own credentials.
The name of the Postgres user. If set to public
, these credentials will be
applied to all users. SELECT current_user
can be used to get the name of the
current Postgres user.
Foreign server name.
Credentials Options
The following options can be passed into CREATE USER MAPPING
:
Must be one of S3
, GCS
, or R2
.
The region for which to authenticate (should match the region of the bucket to query).
Either vhost
or path
. The default for S3 is vhost
and the default for R2
and GCS is path
.
Whether to use HTTPS or HTTP.
Can help when URLs contain problematic characters.
The R2 account ID to use for generating the endpoint URL.
Credential Chain Provider
Providing credentials via key_id
and secret
requires permanent AWS IAM/Identity Center keys. The CREDENTIAL_CHAIN
provider can
automatically fetch ephemeral credentials using mechanisms provided by the AWS SDK.
The following values can be passed into CHAIN
: config
, sts
, sso
, env
, instance
, process
.
Was this page helpful?