Skip to content

Build Auth Token V2

rds_build_auth_token_v2 R Documentation

Generates an auth token used to connect to a db with IAM credentials.

Description

See IAM Database Authentication for MySQL and PostgreSQL for more information on using IAM database authentication with RDS.

Usage

rds_build_auth_token_v2(DBHostname, Port, DBUsername, Region)

Arguments

DBHostname

[required] The hostname of the database to connect to.

Port

[required] The port number the database is listening on.

DBUsername

[required] The username to log in as.

Region

The region the database is in. If NULL, the client region will be used.

Value

A presigned url which can be used as an auth token.

See Also

rds_build_auth_token

Examples

## Not run: 
# This example gets an authentication token for an RDS database, then
# connects to the database using the token.
host <- "database-1.cluster-abcdef123456.us-east-1.rds.amazonaws.com"
port <- 3306
user <- "jane_doe"
token <- svc$build_auth_token_v2(
  DBHostname = host,
  Port = port,
  user = user
)
conn <- DBI::dbConnect(
  drv = RMariaDB::MariaDB(),
  user = user,
  password = token,
  host = host,
  port = port,
  client.flag = RMariaDB::CLIENT_SSL
)

## End(Not run)