Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026.
We will start enforcing it in phases. For more information on the details of Python end of life
and migration options, see the
blog post
Authentication and IAM permissions
The extension authenticates with IAM only. Each connection uses temporary database credentials, so there are no database passwords or database user names to manage.
The extension sends no database user name. Redshift maps the IAM identity to a
database user, for example IAMR: for a
role. What that user may do depends on its grants, so a newly mapped user might need
grants before it can read your tables. On a provisioned cluster, for example, it needs
role-nameUSAGE on the awsdatacatalog database to read the auto-mounted
AWS Glue Data Catalog, and CREATE on dev to create tables there. The
extension doesn't support database passwords or database-user authentication.
The extension refuses a URI that carries user information, because credentials come only
from the credential source the attach names. For more
information about IAM authentication, see Identity and access management in Amazon Redshift.
Creating an aws secret
The secret is the DuckDB aws secret type, provided by
the aws extension. An s3 secret also works.
Use the credential chain, which keeps access keys out of your SQL. The
credential_chain provider resolves your AWS credentials through the
AWS SDK credential
provider chain, the ordered set of sources the SDKs check for
credentials, such as environment variables, the shared config and
credentials files, and named profiles:
-- The AWS credential chain. CREATE SECRET aws_main (TYPE aws, PROVIDER credential_chain, REGION 'us-east-1'); -- A named profile from the shared config file. CREATE SECRET aws_analytics (TYPE aws, PROVIDER credential_chain, PROFILE 'analytics', REGION 'us-east-1'); -- Only some links of the chain. CREATE SECRET aws_env (TYPE aws, PROVIDER credential_chain, CHAIN 'env;config', REGION 'us-east-1');
To use a named profile, add the PROFILE key to the secret, as in the
aws_analytics example. PROFILE selects the profile the
aws extension reads.
Without REGION or an endpoint path, the AWS Region is the secret's
own REGION, which the aws extension might have taken from
the environment or a profile and which might not be the target's. Give
REGION on the attach with WORKGROUP or
CLUSTER.
To use an IAM Identity Center (SSO) sign-in, run aws sso login --profile
first. Then create an
my-profileaws secret from that profile with CHAIN 'sso' and name it on
the attach:
CREATE SECRET my_sso (TYPE aws, PROVIDER credential_chain, CHAIN 'sso', PROFILE 'my-profile', REGION 'us-east-1');
The secret holds the IAM credentials from the sign-in. If it holds none, the
connection fails with a message to run aws sso login and create the
secret again. The driver's own SSO sign-in plugins, such as the browser and
identity-token modes and identity-provider plugins for Okta,
AD FS, or Azure AD, aren't supported; create a secret
from a sign-in instead. Kerberos and GSS authentication aren't supported on any
platform.
The config provider takes explicit keys. The following example uses
short-lived credentials:
CREATE SECRET aws_keys ( TYPE aws, PROVIDER config, KEY_ID 'key-id', SECRET 'secret-key', SESSION_TOKEN 'session-token', REGION 'us-east-1' );
A config secret puts access keys in the text of a SQL statement.
That text can stay in your client's history, notebooks, application logs, and
DuckDB logs, and message redaction does not remove it from those
places. Use the credential chain where you can. If you must use explicit keys,
use short-lived credentials and keep the secret temporary, which is the
default.
Credential lifetime
The extension doesn't refresh credentials, even for a
secret created with REFRESH auto. When a secret holds temporary
credentials that expire, new connections fail. Recreate the secret with CREATE
OR REPLACE SECRET to get new credentials. A Redshift session that is
already open keeps working with the credentials it started with.
IAM permissions per target
The AWS identity needs the following actions for each target.
| Target and how you name it | IAM actions | Resource |
|---|---|---|
Redshift Serverless workgroup, by endpoint or by |
|
|
Redshift Serverless workgroup, by a labelled endpoint |
|
|
Provisioned cluster, by |
|
The cluster ARN and the |
Provisioned cluster, by endpoint URI |
|
The |
Amazon Redshift Serverless with express configuration |
|
|
For a cluster named by CLUSTER, the driver might first call
redshift:DescribeCustomDomainAssociations. If that call is denied, it
continues without it, so you don't need to grant that action.
Inside Redshift, grant the mapped database user only the privileges it needs. For
read-only access, use an identity whose database user has only SELECT
grants. A handle itself cannot be made read-only. For more information, see Security considerations and limitations.