1. Packages
  2. AWS
  3. API Docs
  4. redshift
  5. getClusterCredentials
AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi

aws.redshift.getClusterCredentials

Explore with Pulumi AI

AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi

Provides redshift cluster temporary credentials.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = aws.redshift.getClusterCredentials({
    clusterIdentifier: exampleAwsRedshiftCluster.clusterIdentifier,
    dbUser: exampleAwsRedshiftCluster.masterUsername,
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.redshift.get_cluster_credentials(cluster_identifier=example_aws_redshift_cluster["clusterIdentifier"],
    db_user=example_aws_redshift_cluster["masterUsername"])
Copy
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/redshift"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := redshift.GetClusterCredentials(ctx, &redshift.GetClusterCredentialsArgs{
			ClusterIdentifier: exampleAwsRedshiftCluster.ClusterIdentifier,
			DbUser:            exampleAwsRedshiftCluster.MasterUsername,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = Aws.RedShift.GetClusterCredentials.Invoke(new()
    {
        ClusterIdentifier = exampleAwsRedshiftCluster.ClusterIdentifier,
        DbUser = exampleAwsRedshiftCluster.MasterUsername,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.redshift.RedshiftFunctions;
import com.pulumi.aws.redshift.inputs.GetClusterCredentialsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var example = RedshiftFunctions.getClusterCredentials(GetClusterCredentialsArgs.builder()
            .clusterIdentifier(exampleAwsRedshiftCluster.clusterIdentifier())
            .dbUser(exampleAwsRedshiftCluster.masterUsername())
            .build());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: aws:redshift:getClusterCredentials
      arguments:
        clusterIdentifier: ${exampleAwsRedshiftCluster.clusterIdentifier}
        dbUser: ${exampleAwsRedshiftCluster.masterUsername}
Copy

Using getClusterCredentials

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getClusterCredentials(args: GetClusterCredentialsArgs, opts?: InvokeOptions): Promise<GetClusterCredentialsResult>
function getClusterCredentialsOutput(args: GetClusterCredentialsOutputArgs, opts?: InvokeOptions): Output<GetClusterCredentialsResult>
Copy
def get_cluster_credentials(auto_create: Optional[bool] = None,
                            cluster_identifier: Optional[str] = None,
                            db_groups: Optional[Sequence[str]] = None,
                            db_name: Optional[str] = None,
                            db_user: Optional[str] = None,
                            duration_seconds: Optional[int] = None,
                            opts: Optional[InvokeOptions] = None) -> GetClusterCredentialsResult
def get_cluster_credentials_output(auto_create: Optional[pulumi.Input[bool]] = None,
                            cluster_identifier: Optional[pulumi.Input[str]] = None,
                            db_groups: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                            db_name: Optional[pulumi.Input[str]] = None,
                            db_user: Optional[pulumi.Input[str]] = None,
                            duration_seconds: Optional[pulumi.Input[int]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetClusterCredentialsResult]
Copy
func GetClusterCredentials(ctx *Context, args *GetClusterCredentialsArgs, opts ...InvokeOption) (*GetClusterCredentialsResult, error)
func GetClusterCredentialsOutput(ctx *Context, args *GetClusterCredentialsOutputArgs, opts ...InvokeOption) GetClusterCredentialsResultOutput
Copy

> Note: This function is named GetClusterCredentials in the Go SDK.

public static class GetClusterCredentials 
{
    public static Task<GetClusterCredentialsResult> InvokeAsync(GetClusterCredentialsArgs args, InvokeOptions? opts = null)
    public static Output<GetClusterCredentialsResult> Invoke(GetClusterCredentialsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetClusterCredentialsResult> getClusterCredentials(GetClusterCredentialsArgs args, InvokeOptions options)
public static Output<GetClusterCredentialsResult> getClusterCredentials(GetClusterCredentialsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:redshift/getClusterCredentials:getClusterCredentials
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ClusterIdentifier This property is required. string
Unique identifier of the cluster that contains the database for which your are requesting credentials.
DbUser This property is required. string
Name of a database user. If a user name matching db_user exists in the database, the temporary user credentials have the same permissions as the existing user. If db_user doesn't exist in the database and auto_create is True, a new user is created using the value for db_user with PUBLIC permissions. If a database user matching the value for db_user doesn't exist and not is False, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.
AutoCreate bool
Create a database user with the name specified for the user named in db_user if one does not exist.
DbGroups List<string>
List of the names of existing database groups that the user named in db_user will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.
DbName string
Name of a database that DbUser is authorized to log on to. If db_name is not specified, db_user can log on to any existing database.
DurationSeconds int
The number of seconds until the returned temporary password expires. Valid values are between 900 and 3600. Default value is 900.
ClusterIdentifier This property is required. string
Unique identifier of the cluster that contains the database for which your are requesting credentials.
DbUser This property is required. string
Name of a database user. If a user name matching db_user exists in the database, the temporary user credentials have the same permissions as the existing user. If db_user doesn't exist in the database and auto_create is True, a new user is created using the value for db_user with PUBLIC permissions. If a database user matching the value for db_user doesn't exist and not is False, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.
AutoCreate bool
Create a database user with the name specified for the user named in db_user if one does not exist.
DbGroups []string
List of the names of existing database groups that the user named in db_user will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.
DbName string
Name of a database that DbUser is authorized to log on to. If db_name is not specified, db_user can log on to any existing database.
DurationSeconds int
The number of seconds until the returned temporary password expires. Valid values are between 900 and 3600. Default value is 900.
clusterIdentifier This property is required. String
Unique identifier of the cluster that contains the database for which your are requesting credentials.
dbUser This property is required. String
Name of a database user. If a user name matching db_user exists in the database, the temporary user credentials have the same permissions as the existing user. If db_user doesn't exist in the database and auto_create is True, a new user is created using the value for db_user with PUBLIC permissions. If a database user matching the value for db_user doesn't exist and not is False, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.
autoCreate Boolean
Create a database user with the name specified for the user named in db_user if one does not exist.
dbGroups List<String>
List of the names of existing database groups that the user named in db_user will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.
dbName String
Name of a database that DbUser is authorized to log on to. If db_name is not specified, db_user can log on to any existing database.
durationSeconds Integer
The number of seconds until the returned temporary password expires. Valid values are between 900 and 3600. Default value is 900.
clusterIdentifier This property is required. string
Unique identifier of the cluster that contains the database for which your are requesting credentials.
dbUser This property is required. string
Name of a database user. If a user name matching db_user exists in the database, the temporary user credentials have the same permissions as the existing user. If db_user doesn't exist in the database and auto_create is True, a new user is created using the value for db_user with PUBLIC permissions. If a database user matching the value for db_user doesn't exist and not is False, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.
autoCreate boolean
Create a database user with the name specified for the user named in db_user if one does not exist.
dbGroups string[]
List of the names of existing database groups that the user named in db_user will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.
dbName string
Name of a database that DbUser is authorized to log on to. If db_name is not specified, db_user can log on to any existing database.
durationSeconds number
The number of seconds until the returned temporary password expires. Valid values are between 900 and 3600. Default value is 900.
cluster_identifier This property is required. str
Unique identifier of the cluster that contains the database for which your are requesting credentials.
db_user This property is required. str
Name of a database user. If a user name matching db_user exists in the database, the temporary user credentials have the same permissions as the existing user. If db_user doesn't exist in the database and auto_create is True, a new user is created using the value for db_user with PUBLIC permissions. If a database user matching the value for db_user doesn't exist and not is False, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.
auto_create bool
Create a database user with the name specified for the user named in db_user if one does not exist.
db_groups Sequence[str]
List of the names of existing database groups that the user named in db_user will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.
db_name str
Name of a database that DbUser is authorized to log on to. If db_name is not specified, db_user can log on to any existing database.
duration_seconds int
The number of seconds until the returned temporary password expires. Valid values are between 900 and 3600. Default value is 900.
clusterIdentifier This property is required. String
Unique identifier of the cluster that contains the database for which your are requesting credentials.
dbUser This property is required. String
Name of a database user. If a user name matching db_user exists in the database, the temporary user credentials have the same permissions as the existing user. If db_user doesn't exist in the database and auto_create is True, a new user is created using the value for db_user with PUBLIC permissions. If a database user matching the value for db_user doesn't exist and not is False, then the command succeeds but the connection attempt will fail because the user doesn't exist in the database.
autoCreate Boolean
Create a database user with the name specified for the user named in db_user if one does not exist.
dbGroups List<String>
List of the names of existing database groups that the user named in db_user will join for the current session, in addition to any group memberships for an existing user. If not specified, a new user is added only to PUBLIC.
dbName String
Name of a database that DbUser is authorized to log on to. If db_name is not specified, db_user can log on to any existing database.
durationSeconds Number
The number of seconds until the returned temporary password expires. Valid values are between 900 and 3600. Default value is 900.

getClusterCredentials Result

The following output properties are available:

ClusterIdentifier string
DbPassword string
Temporary password that authorizes the user name returned by db_user to log on to the database db_name.
DbUser string
Expiration string
Date and time the password in db_password expires.
Id string
The provider-assigned unique ID for this managed resource.
AutoCreate bool
DbGroups List<string>
DbName string
DurationSeconds int
ClusterIdentifier string
DbPassword string
Temporary password that authorizes the user name returned by db_user to log on to the database db_name.
DbUser string
Expiration string
Date and time the password in db_password expires.
Id string
The provider-assigned unique ID for this managed resource.
AutoCreate bool
DbGroups []string
DbName string
DurationSeconds int
clusterIdentifier String
dbPassword String
Temporary password that authorizes the user name returned by db_user to log on to the database db_name.
dbUser String
expiration String
Date and time the password in db_password expires.
id String
The provider-assigned unique ID for this managed resource.
autoCreate Boolean
dbGroups List<String>
dbName String
durationSeconds Integer
clusterIdentifier string
dbPassword string
Temporary password that authorizes the user name returned by db_user to log on to the database db_name.
dbUser string
expiration string
Date and time the password in db_password expires.
id string
The provider-assigned unique ID for this managed resource.
autoCreate boolean
dbGroups string[]
dbName string
durationSeconds number
cluster_identifier str
db_password str
Temporary password that authorizes the user name returned by db_user to log on to the database db_name.
db_user str
expiration str
Date and time the password in db_password expires.
id str
The provider-assigned unique ID for this managed resource.
auto_create bool
db_groups Sequence[str]
db_name str
duration_seconds int
clusterIdentifier String
dbPassword String
Temporary password that authorizes the user name returned by db_user to log on to the database db_name.
dbUser String
expiration String
Date and time the password in db_password expires.
id String
The provider-assigned unique ID for this managed resource.
autoCreate Boolean
dbGroups List<String>
dbName String
durationSeconds Number

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.
AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi