Skip to content

kishaningithub/rdapp

Repository files navigation

rdapp - Redshift Data API Postgres Proxy

Build Status Go Reference Go Report Card Latest release Buy me a lunch

Use your favourite postgres tools to query redshift via the redshift data api.

Table of contents

Architecture

Architecture

Installation

Using Homebrew

brew install kishaningithub/tap/rdapp

Using docker

pulling the image

docker pull ghcr.io/kishaningithub/rdapp:0.5.6

running the image in interactive mode (volume mounted aws folder for config)

docker run -it -v "${HOME}/.aws:/root/.aws" ghcr.io/kishaningithub/rdapp:0.5.6

Others

Head over to the releases page and download a binary for your platform

Examples

  • Ensure aws credentials are setup in your env. Refer aws cli configuration guide for more info.
  • Interactive mode - This loads an interactive view where you can pick and choose clusters to connect to
    • This mode requires permissions to list provisioned clusters, work groups, namespaces and secrets (we do not read secret values, only requires list permission to choose secret ARN).
rdapp --listen ":15432"
  • Normal Mode - Here you specify redshift connection config as cli args
    • For proxying redshift serverless run command
rdapp --listen ":15432" --database "<<db name>>" --workgroup-name "<<work group name>>" --secret-arn "<<secret arn>>"
  • For proxying redshift provisioned run command
rdapp --listen ":15432" --db-user <<db user>> --cluster-identifier "<<cluster identifier>>" --database "<<db name>>"
  • If you notice above other than --listen which is the address rdapp listens to all other parameters are exactly the same as aws cli's execute statement command this is intentional and will be maintained that way in the future. This also helps people who are currently using the cli to migrate to rdapp
  • Once the proxy is up, use your favorite postgres tool to interact with your redshift database, the tool will connect to the address specified in the --listen and connects to it. If the parameter is not given it defaults to :25432
    • My favourite pg tool being pgcli below is an example of using the same
pgcli -h localhost -p 15432

> select * from employee limit 1;
+-------+-----------+
| id    | name      |
|-------+-----------|
| 1     | john doe  |
+-------+-----------+
OK 1

Usage

$ rdapp -h
Use your favourite postgres tools to query redshift via redshift data api

Usage:
  rdapp [flags]

Flags:
      --cluster-identifier string
      --database string
      --db-user string
  -h, --help                        help for rdapp
      --listen string                (default ":25432")
      --secret-arn string
      --verbose                     verbose output
      --workgroup-name string

Contributing

See CONTRIBUTING.md

Thanks

Special thanks to @jeroenrinzema for creating psql-wire without which this project might not have been possible.