GetCredentials
Returns a database user name and temporary password with temporary authorization to log in to Amazon Redshift Serverless.
By default, the temporary credentials expire in 900 seconds. You can optionally specify a duration between 900 seconds (15 minutes) and 3600 seconds (60 minutes).
The AWS Identity and Access Management (IAM) user or role that runs GetCredentials must have an IAM policy attached that allows access to all necessary actions and resources.
If the DbName
parameter is specified, the IAM policy must
allow access to the resource dbname for the specified database name.
Request Syntax
{
"customDomainName": "string
",
"dbName": "string
",
"durationSeconds": number
,
"workgroupName": "string
"
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- customDomainName
-
The custom domain name associated with the workgroup. The custom domain name or the workgroup name must be included in the request.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 253.
Pattern:
^(((?!-)[A-Za-z0-9-]{0,62}[A-Za-z0-9])\.)+((?!-)[A-Za-z0-9-]{1,62}[A-Za-z0-9])$
Required: No
- dbName
-
The name of the database to get temporary authorization to log on to.
Constraints:
-
Must be 1 to 64 alphanumeric characters or hyphens.
-
Must contain only uppercase or lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.
-
The first character must be a letter.
-
Must not contain a colon ( : ) or slash ( / ).
-
Cannot be a reserved word. A list of reserved words can be found in Reserved Words in the Amazon Redshift Database Developer Guide
Type: String
Required: No
-
- durationSeconds
-
The number of seconds until the returned temporary password expires. The minimum is 900 seconds, and the maximum is 3600 seconds.
Type: Integer
Required: No
- workgroupName
-
The name of the workgroup associated with the database.
Type: String
Length Constraints: Minimum length of 3. Maximum length of 64.
Pattern:
^[a-z0-9-]+$
Required: No
Response Syntax
{
"dbPassword": "string",
"dbUser": "string",
"expiration": number,
"nextRefreshTime": number
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- dbPassword
-
A temporary password that authorizes the user name returned by
DbUser
to log on to the databaseDbName
.Type: String
- dbUser
-
A database user name that is authorized to log on to the database
DbName
using the passwordDbPassword
. If the specifiedDbUser
exists in the database, the new user name has the same database privileges as the the user named inDbUser
. By default, the user is added to PUBLIC.Type: String
- expiration
-
The date and time the password in
DbPassword
expires.Type: Timestamp
- nextRefreshTime
-
The date and time of when the
DbUser
andDbPassword
authorization refreshes.Type: Timestamp
Errors
For information about the errors that are common to all actions, see Common Errors.
- InternalServerException
-
The request processing has failed because of an unknown error, exception or failure.
HTTP Status Code: 500
- ResourceNotFoundException
-
The resource could not be found.
HTTP Status Code: 400
- ValidationException
-
The input failed to satisfy the constraints specified by an AWS service.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: