rds_build_auth_token: Return an authentication token for a database connection

Description Usage Arguments Details Request syntax Examples

Description

Return an authentication token used as the password for a database connection.

Usage

1
rds_build_auth_token(endpoint, region, user, creds)

Arguments

endpoint

[required] Hostname and port needed to connect to the database: <host>:<port>.

region

[required] AWS region the database is located in.

user

[required] User account within the database to sign in with.

creds

Credentials to be signed with.

Details

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

Request syntax

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
svc$build_auth_token(
  endpoint = "string",
  region = "string",
  user = "string",
  creds = list(
    access_key_id = "string",
    secret_access_key = "string",
    session_token = "string"
  )
)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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(
  endpoint = sprintf("%s:%s", host, port),
  region = "us-east-1",
  user = user
)
conn <- DBI::dbConnect(
  drv = RMariaDB::MariaDB(),
  user = user,
  password = token,
  host = host,
  port = port,
  client.flag = RMariaDB::CLIENT_SSL
)
## End(Not run)

paws.database documentation built on Aug. 23, 2021, 9:18 a.m.