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¶
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.
-
RegionThe 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¶
Examples¶
# 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
)