View a markdown version of this page

Example scenarios for trusted identity propagation in Amazon Redshift - Amazon Redshift

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 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

PersonaNameResponsibility
Identity administratorPriyaOwns the IAM identity provider, role trust policies, and the AWS IAM Identity Center instance
Platform administratorJordanOwns Redshift clusters and namespaces and their settings
Data custodianMarcoWrites grants in Redshift
Finance analystAliceFederates as alice@anycompany.com; member of the Okta group Finance
Marketing analystRaviFederates as ravi@example.com; member of the Okta group Marketing
Compliance auditorSamProves who accessed regulated data
ItemValue
AWS account and AWS Region111122223333 and us-east-1
Identity providerOkta, issuer anycompany.okta.com
Shared IAM rolearn:aws:iam::111122223333:role/AnalystRole (database user IAMR:AnalystRole)
RedshiftServerless namespace analytics-ns, table sales.orders

Scenario 1: See who is behind every connection, with no change to workloads

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 in the IAM User Guide.

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

  3. 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.

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

    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

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.

  2. 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.

  3. Marco grants Alice access:

    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

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 in the IAM User Guide.

  2. 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.

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

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

    CREATE ROLE "Finance"; GRANT SELECT ON sales.orders TO ROLE "Finance";
  5. 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

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:

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

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.

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

  3. Jordan sets the namespace to Federate users and groups.

  4. 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

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.

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

  3. 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

Who: Alice

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

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

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

Who: Priya

Goal: Move AnyCompany's AWS IAM Identity Center instance to the simplified experience for trusted identity propagation 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.

  2. Priya opts the instance in. For steps, see Enable the simplified experience in the AWS IAM Identity Center User Guide.

  3. 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.

  4. 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.

Scenario 10: Prove who accessed regulated data

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.

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

  3. 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.

Edge cases

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.