Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.09 KB

README.md

File metadata and controls

55 lines (40 loc) · 1.09 KB

rdsauth

CI

rdsauth is a tool to generate an auth token used to connect to a db with IAM credentials.

Download

https://github.com/kanmu/rdsauth/releases/latest

Usage

Usage: rdsauth <url> [flags]

Arguments:
  <url>    Database URL

Flags:
  -h, --help       Show help.
  -e, --export     Output as environment variable.
      --version

PostgreSQL

$ MY_DB_HOST=database-1.cluster-abcdef012345.us-east-1.rds.amazonaws.com
$ $(rdsauth -e postgres://scott@$MY_DB_HOST)
$ psql -h $MY_DB_HOST -U scott
...
postgres=>

MySQL

$ MY_DB_HOST=database-1.cluster-abcdef012345.us-east-1.rds.amazonaws.com
$ $(rdsauth -e mysql://scott@$MY_DB_HOST)
$ mysql -h $MY_DB_HOST -u scott --enable-cleartext-plugin
...
mysql>

CNAME support

$ dig +short cname my-db.example.com
database-1.cluster-abcdef012345.us-east-1.rds.amazonaws.com

$ $(rdsauth -e postgres://scott@my-db.example.com)
$ psql -h my-db.example.com -U scott
...
postgres=>