

 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. 

# Example scenarios for trusted identity propagation in Amazon Redshift

The following scenarios show how a fictional company, AnyCompany, uses trusted identity propagation with Redshift. Each scenario lists who does the work, the goal, and the steps. The scenarios build on each other, but you can read any one on its own.

## The running example
<a name="redshift-iam-access-control-tip-scenarios-example"></a>


| Persona | Name | Responsibility | 
| --- | --- | --- | 
| Identity administrator | Priya | Owns the IAM identity provider, role trust policies, and the AWS IAM Identity Center instance | 
| Platform administrator | Jordan | Owns Redshift clusters and namespaces and their settings | 
| Data custodian | Marco | Writes grants in Redshift | 
| Finance analyst | Alice | Federates as alice@anycompany.com; member of the Okta group Finance | 
| Marketing analyst | Ravi | Federates as ravi@example.com; member of the Okta group Marketing | 
| Compliance auditor | Sam | Proves who accessed regulated data | 


| Item | Value | 
| --- | --- | 
| AWS account and AWS Region | 111122223333 and us-east-1 | 
| Identity provider | Okta, issuer anycompany.okta.com | 
| Shared IAM role | arn:aws:iam::111122223333:role/AnalystRole (database user IAMR:AnalystRole) | 
| Redshift | Serverless namespace analytics-ns, table sales.orders | 

## Scenario 1: See who is behind every connection, with no change to workloads
<a name="redshift-iam-access-control-tip-scenarios-audit"></a>

**Who:** Priya, then Sam

**Goal:** Record each IdP user behind connections that arrive as the shared `AnalystRole` today, without changing anyone's access.

1. Priya turns on trusted identity propagation for the Okta identity provider in IAM and maps the Okta email claim to the subject. For steps, see [Getting started with trusted identity propagation for IAM federation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_tip_federation_getting_started.html) in the *IAM User Guide*.

1. Nobody changes anything in Redshift. The namespace uses the **Default** mode.

1. Alice signs in to Okta and connects as she always does. Because `IAMR:AnalystRole` exists, her session runs as `IAMR:AnalystRole` with exactly the access it had before.

1. Sam runs the following query and sees Alice's identity next to every connection she made through the shared role:

   ```sql
   SELECT recordtime, username, associated_identity
   FROM stl_connection_log
   WHERE associated_identity = 'alice@anycompany.com'
   ORDER BY recordtime DESC;
   ```

**Result:** Connections are attributed to individual IdP users. No permissions changed.

## Scenario 2: A new customer gives every IdP user their own identity
<a name="redshift-iam-access-control-tip-scenarios-new-customer"></a>

**Who:** Priya, then Marco

**Goal:** AnyCompany creates a new namespace with no existing database users. Each analyst should sign in as themselves.

1. Priya completes step 1 of Scenario 1.

1. Alice connects for the first time. No user exists for her and no `IAMR:AnalystRole` user exists in the new namespace, so Redshift creates the password-disabled user `alice@anycompany.com` and her session runs as that user.

1. Marco grants Alice access:

   ```sql
   GRANT SELECT ON sales.orders TO "alice@anycompany.com";
   ```

**Result:** In **Default** mode, a new customer already gets one database identity per IdP user. No identity federation setting is needed.

## Scenario 3: Grant access to a directory group
<a name="redshift-iam-access-control-tip-scenarios-group"></a>

**Who:** Priya, Jordan, and Marco

**Goal:** Give everyone in the Okta `Finance` group access to `sales.orders`, and remove access automatically when someone leaves the group.

1. Priya provisions users and groups from Okta into an AWS IAM Identity Center instance with SCIM, and attaches the instance to the IAM identity provider. For steps, see [Configure group-based access for trusted identity propagation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_tip_federation_configure_group_access.html) in the *IAM User Guide*.

1. Jordan confirms that the namespace can reach AWS IAM Identity Center, including VPC endpoints if enhanced VPC routing is on. See [Using trusted identity propagation for IAM with enhanced VPC routing](redshift-iam-access-control-tip-evr.md).

1. Jordan sets the identity federation mode for `analytics-ns` to **Federate users and groups**.

1. Marco creates a role named after the group and grants it access:

   ```sql
   CREATE ROLE "Finance";
   GRANT SELECT ON sales.orders TO ROLE "Finance";
   ```

1. Alice connects. Her session runs as `alice@anycompany.com` and receives the `Finance` role because she's in the `Finance` group. Ravi connects, receives no `Finance` role, and is denied access to `sales.orders`.

**Result:** Access follows group membership in Okta. Added and removed roles reach connected sessions after group membership is synchronized. A session that connected without group roles must reconnect before it can receive them.

## Scenario 4: Pilot one IdP user before changing the namespace
<a name="redshift-iam-access-control-tip-scenarios-pilot"></a>

**Who:** Marco

**Goal:** Test federated sign-in for Alice while everyone else keeps running as `IAMR:AnalystRole`.

The namespace stays in **Default** mode. Marco binds Alice's user:

```sql
CREATE USER "alice@anycompany.com" PASSWORD DISABLE
FEDERATION WITH GROUPS;
GRANT SELECT ON sales.orders TO "alice@anycompany.com";
```

Alice now signs in as `alice@anycompany.com` with her group roles. Ravi still signs in as `IAMR:AnalystRole`. To undo the pilot, Marco runs `ALTER USER "alice@anycompany.com" RESET FEDERATION;`.

## Scenario 5: Move analysts off a shared IAM role user
<a name="redshift-iam-access-control-tip-scenarios-shared-role"></a>

**Who:** Marco, then Jordan

**Goal:** Stop sharing `IAMR:AnalystRole` among analysts, without anyone losing access.

Permissions granted to `IAMR:AnalystRole` don't apply to an IdP user who signs in as themselves. Marco moves those permissions first:

1. Marco lists what `IAMR:AnalystRole` can access, for example by querying `SVV_USER_GRANTS`.

1. Marco grants the same permissions to the `Finance` and `Marketing` roles that match the Okta groups.

1. Jordan sets the namespace to **Federate users and groups**.

1. Alice and Ravi now sign in as themselves and receive their group roles. Scheduled jobs that should keep running as the role continue to sign in with `AnalystRole` as before.

**Result:** Each analyst has their own identity. Objects that an analyst creates from now on are owned by that analyst, so Marco grants shared objects to roles rather than relying on a shared owner.

## Scenario 6: Allow an IdP group to grant a system role
<a name="redshift-iam-access-control-tip-scenarios-system-role"></a>

**Who:** Priya and Jordan

**Goal:** Let members of the Okta group `sys:operator` operate the namespace, without allowing any other system role.

1. Priya creates the group `sys:operator` in Okta and provisions it to AWS IAM Identity Center.

1. Jordan adds `sys:operator` to the **System roles federation** list for `analytics-ns` and leaves every other system role out.

1. A member of the group who signs in with groups turned on receives `sys:operator`. A group named `sys:dba` gives nothing on this namespace because `sys:dba` isn't in the list.

## Scenario 7: Unload data to Amazon S3 as the IdP user
<a name="redshift-iam-access-control-tip-scenarios-unload"></a>

**Who:** Alice

**Goal:** Write query results to Amazon S3 so that Amazon S3 and AWS CloudTrail see Alice, not only the role.

```sql
UNLOAD ('SELECT * FROM sales.orders WHERE region = ''NA''')
TO 's3://amzn-s3-demo-finance/finance-reports/'
IAM_ROLE 'SESSION';
```

AWS CloudTrail records the Amazon S3 requests with the role in `userIdentity` and Alice in `userIdentity.onBehalfOf`. If Alice uses an explicit role, such as `IAM_ROLE 'arn:aws:iam::111122223333:role/RedshiftUnload'`, Redshift attaches her identity when it assumes the role. If Redshift can't attach Alice's identity, the statement fails instead of running without it.

## Scenario 8: Analyze data from Amazon SageMaker Unified Studio
<a name="redshift-iam-access-control-tip-scenarios-unified-studio"></a>

**Who:** Alice and Ravi

**Goal:** Each analyst sees only what their identity allows when they query Redshift from Amazon SageMaker Unified Studio.

Alice signs in to Okta, assumes `AnalystRole`, and opens Amazon SageMaker Unified Studio. Her sign-in is unchanged. She queries `sales.orders` on Redshift. Redshift signs her in as `alice@anycompany.com`, adds the `Finance` role, and returns rows. Ravi runs the same SQL and is denied. AWS CloudTrail records each request with the user's identity.

## Scenario 9: An existing AWS IAM Identity Center customer moves to the simplified experience
<a name="redshift-iam-access-control-tip-scenarios-simplified"></a>

**Who:** Priya

**Goal:** Move AnyCompany's AWS IAM Identity Center instance to the [simplified experience for trusted identity propagation](https://docs.aws.amazon.com/singlesignon/latest/userguide/simplified-tip-overview.html) without breaking Redshift.

1. Before opting in, Priya sets the instance's subject format deliberately to email or user name. If no subject format is chosen, an automatic transition sets it to user ID, and grants written against email addresses or user names won't match.

1. Priya opts the instance in. For steps, see [Enable the simplified experience](https://docs.aws.amazon.com/singlesignon/latest/userguide/simplified-tip-enabling.html) in the *AWS IAM Identity Center User Guide*.

1. Nothing changes in Redshift. Clusters with a registered Redshift AWS IAM Identity Center application keep their sign-in flows, user and group assignments, and grants.

1. For new namespaces, Jordan can skip registering an AWS IAM Identity Center application. Clients connect with `GetClusterCredentialsWithIAM`, or `GetCredentials` for Serverless, using credentials from the simplified instance. Drivers use the `iam://` scheme, with `groupFederation=true` on provisioned clusters.

For more information, see [Moving from the legacy experience to the simplified experience](https://docs.aws.amazon.com/singlesignon/latest/userguide/simplified-tip-migration.html).

## Scenario 10: Prove who accessed regulated data
<a name="redshift-iam-access-control-tip-scenarios-compliance"></a>

**Who:** Sam

**Goal:** Show which IdP users connected to `analytics-ns` and what they ran last quarter.

1. Sam queries `STL_CONNECTION_LOG` or `SYS_CONNECTION_LOG` for connections, using the user name and the `associated_identity` column.

1. Sam queries `SYS_QUERY_HISTORY` for the queries run by `alice@anycompany.com`.

1. Sam matches database connections to AWS CloudTrail credential requests, such as `GetCredentials`, which record the IdP user in `onBehalfOf`.

For details, see [Auditing federated connections](redshift-iam-access-control-tip-audit.md).

## Edge cases
<a name="redshift-iam-access-control-tip-scenarios-edge-cases"></a>

A local user with the same name already exists  
In **Default** mode, if `alice@anycompany.com` exists as a local user that isn't bound and the role has no database user, Alice's sign-in fails. Marco binds the user with `ALTER USER "alice@anycompany.com" FEDERATION WITHOUT GROUPS;`.

New hires  
Group grants cover new hires automatically. In **Default** mode, a new hire who signs in through a role with no database user gets their own user automatically.

Reused email addresses  
Redshift matches an IdP user to a database user by name. If a departed employee's email address is later given to someone else, that IdP user signs in as the departed employee's user and receives its permissions. Don't reuse identities in your IdP, or drop or rename the departed user's database user.

Two identity providers that send the same email  
Redshift matches by name only. Restrict which issuers can be trusted by using the `aws:OriginIdentity/Issuer` condition key in IAM policies on the roles that your workforce assumes.

Connecting tools  
IdP users connect with Amazon Redshift query editor v2, Tableau, DBeaver, and other tools that use IAM authentication. No driver upgrade is required.

Lambda, SageMaker AI, and Amazon Bedrock UDFs  
These functions run as their IAM role without the IdP user's identity.