Step 4: Create a database user and database groups
Optionally, you can create a database user that you use to log in to the cluster
database. If you create temporary user credentials for an existing user, you can
disable the user's password to force the user to log on with the temporary password.
Alternatively, you can use the GetClusterCredentials
Autocreate option to
automatically create a new database user.
You can create database user groups with the permissions you want the IAM database
user to join at login. When you call the GetClusterCredentials
operation, you can specify a list of user group names that the new user joins at
login. These group memberships are valid only for sessions created using credentials
generated with the given request.
To create a database user and database groups
-
Log in to your Amazon Redshift database and create a database user using CREATE USER or alter an existing user using ALTER USER.
-
Optionally, specify the PASSWORD DISABLE option to prevent the user from using a password. When a user's password is disabled, the user can log on only using temporary credentials. If the password is not disabled, the user can log on either with the password or using temporary credentials. You can't disable the password for a superuser.
Users need programmatic access if they want to interact with Amazon outside of the Amazon Web Services Management Console. The Amazon APIs and the Amazon Command Line Interface require access keys. Whenever possible, create temporary credentials that consist of an access key ID, a secret access key, and a security token that indicates when the credentials expire.
To grant users programmatic access, choose one of the following options.
Which user needs programmatic access? To By IAM Use short-term credentials to sign programmatic requests to the Amazon CLI or Amazon APIs (directly or by using the Amazon SDKs). Following the instructions in Using temporary credentials with Amazon resources in the IAM User Guide. IAM Use long-term credentials to sign programmatic requests to the Amazon CLI or Amazon APIs (directly or by using the Amazon SDKs). (Not recommended)
Following the instructions in Managing access keys for IAM users in the IAM User Guide. The following example creates a user with password disabled.
create user temp_creds_user password disable;
The following example disables the password for an existing user.
alter user temp_creds_user password disable;
-
Create database user groups using CREATE GROUP.
-
Use the GRANT command to define access privileges for the groups.