Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . rds ]

generate-db-auth-token

Description

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

See 'aws help' for descriptions of global parameters.

Synopsis

  generate-db-auth-token
--hostname <value>
--port <value>
--username <value>

Options

--hostname (string) The hostname of the database to connect to.

--port (integer) The port number the database is listening on.

--username (string) The username to log in as.

See 'aws help' for descriptions of global parameters.

Examples

To generate an IAM authentication token

The following generate-db-auth-token example generates IAM authentication token to connect to a database.

aws rds generate-db-auth-token \
    --hostname mydb.123456789012.us-east-1.rds.amazonaws.com \
    --port 3306 \
    --region us-east-1 \
    --username db_user

Output:

mydb.123456789012.us-east-1.rds.amazonaws.com:3306/?Action=connect&DBUser=db_user&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIEXAMPLE%2Fus-east-1%2Frds-db%2Faws4_request&X-Amz-Date=20210123T011543Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=88987EXAMPLE1EXAMPLE2EXAMPLE3EXAMPLE4EXAMPLE5EXAMPLE6

For more information, see Connecting to your DB instance using IAM authentication in the Amazon RDS User Guide and Connecting to your DB cluster using IAM authentication in the Amazon Aurora User Guide.