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
Identity and access management in Amazon Redshift
Access to Amazon Redshift requires credentials that AWS can use to authenticate your requests. Those credentials must have permissions to access AWS resources, such as an Amazon Redshift cluster. The following sections provide details on how you can use AWS Identity and Access Management (IAM) and Amazon Redshift to help secure your resources by controlling who can access them:
This topic contains a collection of best practices for managing permissions, identities and secure access. We recommend that you get familiar with best practices for using IAM with Amazon Redshift. These include using IAM roles for applying permissions. Having a good understanding of these sections will help you maintain a more secure Amazon Redshift data warehouse.
Authentication with identities
Authentication is how you sign in to AWS using your identity credentials. You must be authenticated as the AWS account root user, an IAM user, or by assuming an IAM role.
You can sign in as a federated identity using credentials from an identity source like AWS IAM Identity Center (IAM Identity Center), single sign-on authentication, or Google/Facebook credentials. For more information about signing in, see How to sign in to your AWS account in the AWS Sign-In User Guide.
For programmatic access, AWS provides an SDK and CLI to cryptographically sign requests. For more information, see AWS Signature Version 4 for API requests in the IAM User Guide.
When your workforce federates into AWS through IAM, you can use trusted identity propagation so that Amazon Redshift knows the IdP user behind each connection, not only the IAM role. For more information, see Workforce identity with Trusted Identity Propagation for IAM.
AWS account root user
When you create an AWS account, you begin with one sign-in identity called the AWS account root user that has complete access to all AWS services and resources. We strongly recommend that you don't use the root user for everyday tasks. For tasks that require root user credentials, see Tasks that require root user credentials in the IAM User Guide.
IAM users and groups
An IAM user is an identity with specific permissions for a single person or application. We recommend using temporary credentials instead of IAM users with long-term credentials. For more information, see Require human users to use federation with an identity provider to access AWS using temporary credentials in the IAM User Guide.
An IAM group specifies a collection of IAM users and makes permissions easier to manage for large sets of users. For more information, see Use cases for IAM users in the IAM User Guide.
IAM roles
An IAM role is an identity with specific permissions that provides temporary credentials. You can assume a role by switching from a user to an IAM role (console) or by calling an AWS CLI or AWS API operation. For more information, see Methods to assume a role in the IAM User Guide.
IAM roles are useful for federated user access, temporary IAM user permissions, cross-account access, cross-service access, and applications running on Amazon EC2. For more information, see Cross account resource access in IAM in the IAM User Guide.
Forward access sessions (FAS) in Redshift are valid for 12 hours only. After this period, any connection session using FAS to integrate with other services must be re-established.
Choosing how users sign in to Amazon Redshift databases
Choose the identity option that matches how your workforce signs in and how you want to manage Amazon Redshift users and permissions.
| Option | Use it when | Learn more |
|---|---|---|
| IAM-generated temporary database credentials | Your application or SQL client authenticates with IAM and requests temporary database credentials for a database user mapped from an IAM user or role. | Using IAM authentication to generate database user credentials |
| Workforce identity with Trusted Identity Propagation for IAM | Your workforce federates into AWS through an existing SAML 2.0 or OpenID Connect identity provider, and you want Amazon Redshift to identify the IdP user behind an IAM role session. | Workforce identity with Trusted Identity Propagation for IAM. For IAM setup, see Trusted identity propagation with IAM in the IAM User Guide. |
| Single sign-on with IAM Identity Center | You want to connect Amazon Redshift directly to IAM Identity Center and manage access through an Amazon Redshift application in IAM Identity Center. | Single sign-on with AWS IAM Identity Center |
| Native identity provider federation | You want Amazon Redshift to authenticate tokens from a supported identity provider that you register directly with the database. | Native identity provider (IdP) federation for Amazon Redshift |
Cross-service confused deputy prevention
The confused deputy problem is a security issue where an entity that doesn't have permission to perform an action can coerce a more-privileged entity to perform the action. In AWS, this can happen through cross-service impersonation, when one service calls another service. For more information, see Cross-service confused deputy prevention in the IAM User Guide.
We recommend using the aws:SourceArn and aws:SourceAccount global condition context keys in
resource-based policies to limit the permissions that Amazon Redshift gives another service to
the resource. If the aws:SourceArn value doesn't contain the account ID,
such as an Amazon S3 bucket ARN, you must use both global condition context keys to limit
permissions. If you use both global condition context keys and the
aws:SourceArn value contains the account ID, the
aws:SourceAccount value and the account in the
aws:SourceArn value must use the same account ID when used in the same
policy statement.
The following example shows a policy that you can apply to limit the confused deputy problem for Amazon Redshift.
{ "Version": "2012-10-17", "Statement": { "Sid": "ConfusedDeputyPreventionForRedshift", "Effect": "Allow", "Principal": { "Service": "redshift.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "ArnLike": { "aws:SourceArn": "arn:aws:redshift:us-east-1:123456789012:cluster:my-cluster" }, "StringEquals": { "aws:SourceAccount": "123456789012" } } } }
The following example shows a policy for Amazon Redshift Serverless.
{ "Version": "2012-10-17", "Statement": { "Sid": "ConfusedDeputyPreventionForRedshiftServerless", "Effect": "Allow", "Principal": { "Service": "redshift-serverless.amazonaws.com" }, "Action": "sts:AssumeRole", "Condition": { "ArnLike": { "aws:SourceArn": "arn:aws:redshift-serverless:us-east-1:123456789012:workgroup/my-workgroup" }, "StringEquals": { "aws:SourceAccount": "123456789012" } } } }
Access control
You can have valid credentials to authenticate your requests, but unless you have permissions you cannot create or access Amazon Redshift resources. For example, you must have permissions to create an Amazon Redshift cluster, create a snapshot, add an event subscription, and so on.
The following sections describe how to manage permissions for Amazon Redshift. We recommend that you read the overview first.
Overview of managing access permissions to your Amazon Redshift resources
Every AWS resource is owned by an AWS account, and permissions to create or access the resources are governed by permissions policies. An account administrator can attach permissions policies to IAM identities (that is, users, groups, and roles), and some services (such as AWS Lambda) also support attaching permissions policies to resources.
An account administrator (or administrator user) is a user with administrator privileges. For more information, see IAM best practices in the IAM User Guide.
When granting permissions, you decide who is getting the permissions, which resources they get permissions for, and the specific actions that you want to allow on those resources.
Amazon Redshift resources and operations
Amazon Redshift provides service-specific resources, actions, and condition context keys for use in IAM permission policies.
Amazon Redshift, Amazon Redshift Serverless, Amazon Redshift Data API, and Amazon Redshift query editor v2 access permissions
When you set up Access control, you write permission policies that you can attach to an IAM identity (identity-based policies). For detailed reference information, see the following topics in the Service Authorization Reference:
-
For Amazon Redshift, see Actions, resources, and condition keys for Amazon Redshift that use the
redshift:prefix. -
For Amazon Redshift Serverless, see Actions, resources, and condition keys for Amazon Redshift Serverless that use the
redshift-serverless:prefix. -
For Amazon Redshift Data API, see Actions, resources, and condition keys for Amazon Redshift Data API that use the
redshift-data:prefix. -
For Amazon Redshift query editor v2, see Actions, resources, and condition keys for AWS SQL Workbench (Amazon Redshift query editor v2) that use the
sqlworkbench:prefix.The query editor v2 includes permission-only actions that don't directly correspond to an API operation. These actions are indicated in the Service Authorization Reference with
[permission only].
The Service Authorization Reference contains information about which API operations can be used in an IAM policy. It also includes the AWS resource for which you can grant the permissions, and condition keys that you can include for fine-grained access control. For more information about conditions, see Using IAM policy conditions for fine-grained access control.
You specify the actions in the policy's Action field, the resource value
in the policy's Resource field, and conditions in the policy's
Condition field. To specify an action for Amazon Redshift, use the
redshift: prefix followed by the API operation name (for example,
redshift:CreateCluster).
Understanding resource ownership
A resource owner is the AWS account that created a resource. That is, the resource owner is the AWS account of the principal entity (the root account, an IAM user, or an IAM role) that authenticates the request that creates the resource. The following examples illustrate how this works:
-
If you use the root account credentials of your AWS account to create a DB cluster, your AWS account is the owner of the Amazon Redshift resource.
-
If you create an IAM role in your AWS account with permissions to create Amazon Redshift resources, anyone who can assume the role can create Amazon Redshift resources. Your AWS account, to which the role belongs, owns the Amazon Redshift resources.
-
If you create an IAM user in your AWS account and grant permissions to create Amazon Redshift resources to that user, the user can create Amazon Redshift resources. However, your AWS account, to which the user belongs, owns the Amazon Redshift resources. In most cases this method isn't recommended. We recommend creating an IAM role and attaching permissions to the role, then assigning the role to a user.
Managing access to resources
A permissions policy describes who has access to what. The following section explains the available options for creating permissions policies.
This section discusses using IAM in the context of Amazon Redshift. It doesn't provide detailed information about the IAM service. For complete IAM documentation, see What is IAM? in the IAM User Guide. For information about IAM policy syntax and descriptions, see AWS IAM policy reference in the IAM User Guide.
Policies attached to an IAM identity are referred to as identity-based policies (IAM policies) and policies attached to a resource are referred to as resource-based policies. Amazon Redshift supports only identity-based policies (IAM policies).
Identity-based policies (IAM policies)
You can assign permissions by attaching polices to an IAM role and then assigning that role to a user or group. The following is an example policy that containing permissions to create, delete, modify, and reboot Amazon Redshift clusters for your AWS account.
For more information about using identity-based policies with Amazon Redshift, see Using identity-based policies (IAM policies) for Amazon Redshift. For more information about users, groups, roles, and permissions, see Identities (users, groups, and roles) in the IAM User Guide.
Resource-based policies
Other services, such as Amazon S3, also support resource-based permissions policies. For example, you can attach a policy to an S3 bucket to manage access permissions to that bucket. Amazon Redshift doesn't support resource-based policies.
Specifying policy elements: Actions, effects, resources, and principals
For each Amazon Redshift resource (see Amazon Redshift resources and operations), the service defines a set of API operations (see Actions). To grant permissions for these API operations, Amazon Redshift defines a set of actions that you can specify in a policy. Performing an API operation can require permissions for more than one action.
The following are the basic policy elements:
-
Resource – In a policy, you use an Amazon Resource Name (ARN) to identify the resource to which the policy applies. For more information, see Amazon Redshift resources and operations.
-
Action – You use action keywords to identify resource operations that you want to allow or deny. For example, the
redshift:DescribeClusterspermission allows the user permissions to perform the Amazon RedshiftDescribeClustersoperation. -
Effect – You specify the effect when the user requests the specific action—this can be either allow or deny. If you don't explicitly grant access to (allow) a resource, access is implicitly denied. You can also explicitly deny access to a resource, which you might do to make sure that a user cannot access it, even if a different policy grants access.
-
Principal – In identity-based policies (IAM policies), the user that the policy is attached to is the implicit principal. For resource-based policies, you specify the user, account, service, or other entity that you want to receive permissions (applies to resource-based policies only). Amazon Redshift doesn't support resource-based policies.
To learn more about IAM policy syntax and descriptions, see AWS IAM policy reference in the IAM User Guide.
For a table showing all of the Amazon Redshift API actions and the resources that they apply to, see Amazon Redshift, Amazon Redshift Serverless, Amazon Redshift Data API, and Amazon Redshift query editor v2 access permissions.
Specifying conditions in a policy
When you grant permissions, you can use the access policy language to specify the conditions when a policy should take effect. For example, you might want a policy to be applied only after a specific date. For more information about specifying conditions in an access policy language, see IAM JSON policy elements: Condition in the IAM User Guide.
To identify conditions where a permissions policy applies, include a
Condition element in your IAM permissions policy. For example, you can
create a policy that permits a user to create a cluster using the
redshift:CreateCluster action, and you can add a Condition
element to restrict that user to only create the cluster in a specific region. For details,
see Using IAM policy conditions for fine-grained access control. For a list showing all of
condition key values and the Amazon Redshift actions and resources that they apply to, see Amazon Redshift, Amazon Redshift Serverless, Amazon Redshift Data API, and Amazon Redshift query editor v2 access permissions.
Using IAM policy conditions for fine-grained access control
In Amazon Redshift, you can use condition keys to restrict access to resources based on the tags for those resources. The following are common Amazon Redshift condition keys.
| Condition key | Description |
|---|---|
|
Requires users to include a tag key (name) and value whenever they create a resource. For more information, see aws:RequestTag in the IAM User Guide. |
|
Restricts user access to resources based on specific tag keys and values. For more information, see aws:ResourceTag in the IAM User Guide. |
|
Use this key to compare the tag keys in a request with the keys that you specify in the policy. For more information, see aws:TagKeys in the IAM User Guide. |
For information on tags, see Tag resources in Amazon Redshift.
For a list of the API actions that support the redshift:RequestTag and
redshift:ResourceTag condition keys, see Amazon Redshift, Amazon Redshift Serverless, Amazon Redshift Data API, and Amazon Redshift query editor v2 access permissions.
The following condition keys can be used with the Amazon Redshift GetClusterCredentials action.
| Condition key | Description |
|---|---|
|
Limits the number of seconds that can be specified for duration. |
|
Restricts database names that can be specified. |
|
Restricts database user names that can be specified. |
Example 1: Restricting access by using the aws:ResourceTag condition key
Use the following IAM policy to let a user modify an Amazon Redshift cluster only for a
specific AWS account in the us-west-2 region with a tag named
environment with a tag value of test.
Example 2: Restricting access by using the aws:RequestTag condition key
Use the following IAM policy to let a user create an Amazon Redshift cluster only if the
command to create the cluster includes a tag named usage and a tag value of
production. The condition with aws:TagKeys and the
ForAllValues modifier specifies that only the keys
costcenter and usage can be specified in the request.