

 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 ](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/) that was published on June 30, 2025. 

# 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:{{role-name}}` 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 `USAGE` 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](redshift-iam-authentication-access-control.md).

## Creating an `aws` secret
<a name="duckdb-redshift-authentication-secret"></a>

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](https://docs.aws.amazon.com/sdkref/latest/guide/standardized-credentials.html), the ordered set of sources the SDKs check for credentials, such as environment variables, the shared `config` and `credentials` files, and named profiles:

```sql
-- 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 {{my-profile}}` first. Then create an `aws` secret from that profile with `CHAIN 'sso'` and name it on the attach:

```sql
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:

```sql
CREATE SECRET aws_keys (
    TYPE aws, PROVIDER config,
    KEY_ID '{{key-id}}', SECRET '{{secret-key}}', SESSION_TOKEN '{{session-token}}',
    REGION 'us-east-1'
);
```

**Warning**  
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
<a name="duckdb-redshift-authentication-lifetime"></a>

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
<a name="duckdb-redshift-authentication-permissions"></a>

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 `WORKGROUP` and `ACCOUNT_ID` | `redshift-serverless:GetCredentials` | `arn:aws:redshift-serverless:{{region}}:{{account-id}}:workgroup/{{workgroup-id}}` | 
| Redshift Serverless workgroup, by a labelled endpoint | `redshift-serverless:GetCredentials` | `arn:aws:redshift-serverless:{{region}}:{{account-id}}:workgroup/{{label}}/{{workgroup}}`. Such an endpoint might need further IAM actions. | 
| Provisioned cluster, by `CLUSTER` | `redshift:DescribeClusters` and `redshift:GetClusterCredentialsWithIAM` | The cluster ARN and the `dbname` ARN | 
| Provisioned cluster, by endpoint URI | `redshift:GetClusterCredentialsWithIAM` | The `dbname` ARN | 
| Amazon Redshift Serverless with express configuration | `redshift-serverless:GetCredentials` and `redshift-serverless:DbConnect` | `arn:aws:redshift-serverless:{{region}}:{{account-id}}:workgroup/express/express-default`. For more information, see [Data access and permissions](serverless-express-permissions.md). | 

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](duckdb-redshift-security.md).