redshiftcredentials

package module
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 12 Imported by: 0

README

redshift-credentials

Documentation Latest GitHub release Github Actions test License

a command line tool for Amazon Redshift temporary authorization with AWS IAM

Usage
as Basically CLI
$ redshift-credentials --endpoint default.012345678910.ap-northeast-1.redshift-serverless.amazonaws.com --output json    
{
  "WorkgroupName": "default",
  "Endpoint": "default.012345678910.ap-northeast-1.redshift-serverless.amazonaws.com",
  "Port": "5439",
  "DbPassword": "<temporary password>",
  "DbUser": "<temporary user>",
  "Expiration": "2022-07-16T12:59:09.059Z",
  "NextRefreshTime": "2022-07-16T14:44:09.059Z"
}

The endpoints can be from a provisioned cluster.

If you do not specify anything, will be asked to which Redshift you want to temporarily authenticate

$ redshift-credentials
[1] default     provisioned cluster     default.xxxxxxxxxxxx.ap-northeast-1.redshift.amazonaws.com
[2] default     serverless workgroup    default.012345678910.ap-northeast-1.redshift-serverless.amazonaws.com
Enter number: 

For more convenient use

$ eval `redshift-credentials --prefix PG --endpoint default.012345678910.ap-northeast-1.redshift-serverless.amazonaws.com`
$ psql -U $PGUSER -h $PGHOST -p $PGPORT -W dev
as Wrapper
$ redshift-credentials --endpoint default.012345678910.ap-northeast-1.redshift-serverless.amazonaws.com -- your_application_command    

It also works as a wrapper command.

In this case, the retrieved temporary authentication information is passed as the following environment variable

  • $REDSHOFT_DB_PASSWORD
  • $REDSHOFT_DB_USER
  • $REDSHOFT_ENDPOINT
  • $REDSHOFT_PORT
Install
Homebrew (macOS and Linux)
$ brew install mashiike/tap/redshift-credentials
Binary packages

Releases

Options
redshift-credentials is a command-like tool for Amazon Redshift temporary authorization
version: current

usage: redshift-credentials [options] [-- user command]

  -cluster string
        redshift provisioned cluster identifier
  -db-name string
        redshift database name
  -db-user string
        redshift database user name (provisioned only)
  -duration-seconds int
        number of seconds until the returned temporary password expires (900 ~ 3600)
  -endpoint string
        redshift endpoint url
  -log-level string
        redshift-credentials log level (default "info")
  -output string
        Specifies the output format of the credential when not driven in wrapper mode. If not specified, the output is formatted for environment variable settings. [env|json|yaml] (default "env")
  -prefix REDSHIFT_
        Prefixes environment variable names when writing to environment variables (e.g., REDSHIFT_) (default "REDSHIFT_")
  -workgroup string
        redshift serverless workgroup name

LICENSE

MIT License

Copyright (c) 2022 IKEDA Masashi

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewFromConfig

func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client

func (*Client) GetCredentials

func (client *Client) GetCredentials(ctx context.Context, input *GetCredentialsInput) (*GetCredentialsOutput, error)

type GetCredentialsInput

type GetCredentialsInput struct {
	Endpoint          *string
	WorkgroupName     *string
	ClusterIdentifier *string
	DbUser            *string
	DbName            *string
	DurationSeconds   *int32
	// contains filtered or unexported fields
}

type GetCredentialsOutput

type GetCredentialsOutput struct {
	WorkgroupName     *string    `json:",omitempty" yaml:"workgroup_name,omitempty"`
	ClusterIdentifier *string    `json:",omitempty" yaml:"cluster_identifier,omitempty"`
	Endpoint          *string    `json:",omitempty" yaml:"endpoint,omitempty"`
	Port              *string    `json:",omitempty" yaml:"port,omitempty"`
	DbPassword        *string    `json:",omitempty" yaml:"db_password,omitempty"`
	DbUser            *string    `json:",omitempty" yaml:"db_user,omitempty"`
	Expiration        *time.Time `json:",omitempty" yaml:"expiration,omitempty"`
	NextRefreshTime   *time.Time `json:",omitempty" yaml:"next_refresh_time,omitempty"`
}

type Options

type Options struct {
	Filter             func([]string) (string, error)
	Logger             *log.Logger
	ProvisionedOptions *redshift.Options
	ServerlessOptions  *redshiftserverless.Options
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL