Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

docs - IAM auth note on postgresql (#66212)

Jeff Bruemmer367bb055ba54
diff --git a/docs/databases/connections/aws-rds.md b/docs/databases/connections/aws-rds.md
index 297a1dc5e67..9199b46ffaf 100644
--- a/docs/databases/connections/aws-rds.md
+++ b/docs/databases/connections/aws-rds.md
@@ -21,6 +21,70 @@ Here's how to get connection information for databases on Amazon's RDS:
- **Database Name**. Find this under Configuration Details.
- **Password**. Ask your database administrator for the password.
-## Database routing
+## IAM authentication
-See [Database routing](../../permissions/database-routing.md).
+{% include plans-blockquote.html feature="IAM authentication" self-hosted-only="true" %}
+
+You can connect to RDS Aurora PostgreSQL and MySQL instances using AWS IAM authentication instead of a password.
+
+To set up IAM authentication:
+
+1. [In AWS, enable IAM authentication on your RDS instance](#in-aws-enable-iam-authentication-on-your-rds-instance)
+2. [In AWS, set up an IAM policy](#in-aws-set-up-an-iam-policy)
+3. [In your database, create a database user](#in-your-database-create-a-database-user)
+4. [In your Metabase environment, configure AWS credentials](#in-your-metabase-environment-configure-aws-credentials)
+5. [In Metabase, select IAM authentication](#in-metabase-select-iam-authentication)
+6. [In Metabase, configure SSL](#in-metabase-configure-ssl)
+
+### In AWS, enable IAM authentication on your RDS instance
+
+[Enable IAM authentication on your RDS instance](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Enabling.html) in the AWS console.
+
+### In AWS, set up an IAM policy
+
+Add a policy with the `rds-db:connect` action. The policy resource must specify the [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) of your database user in the format:
+
+```
+arn:aws:rds-db:region:account-id:dbuser:DbiResourceId/db-user-name
+```
+
+When entering the username in Metabase, you'd just enter your `db-user-name`, not the full ARN.
+
+See [Creating IAM policy for IAM database access](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.IAMPolicy.html).
+
+### In your database, create a database user
+
+Create the database user with IAM authentication enabled. The database username must match exactly (case-sensitive) with the `db-user-name` portion of your IAM policy [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html).
+
+**PostgreSQL:**
+
+```sql
+CREATE USER your_username;
+GRANT rds_iam TO your_username;
+```
+
+**MySQL:**
+
+```sql
+CREATE USER 'your_username'@'%' IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS';
+```
+
+See [Setting up for IAM database authentication](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.DBAccounts.html).
+
+### In your Metabase environment, configure AWS credentials
+
+Authentication credentials must be available via one of the methods supported by the [AWS SDK credentials chain](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials-chain.html), typically either:
+
+- Environment variables (`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`)
+- AWS credentials file (`.aws/credentials`), automatically available if running in [Elastic Container Service (ECS)](https://docs.aws.amazon.com/ecs/)
+
+### In Metabase, select IAM authentication
+
+When adding or editing a database connection in Metabase, click **Use an authentication provider** and select **IAM Authentication**.
+
+### In Metabase, configure SSL
+
+Use a secure connection (SSL):
+
+- **PostgreSQL**: Set the SSL Mode to **require**. See [PostgreSQL SSL options](./postgresql.md#ssl-mode).
+- **MySQL**: The SSL Mode will be automatically set to **verify-ca**. If you manually change the SSL Mode, it must be set to **verify-ca**. See [MySQL SSL options](./mysql.md#use-a-secure-connection-ssl).
diff --git a/docs/databases/connections/mysql.md b/docs/databases/connections/mysql.md
index cd7e5490720..7a60c6ed9db 100644
--- a/docs/databases/connections/mysql.md
+++ b/docs/databases/connections/mysql.md
@@ -42,6 +42,16 @@ The database username for the account that you want to use to connect to your da
The password for the username that you use to connect to the database.
+### Use an authentication provider
+
+{% include plans-blockquote.html feature="Authenticating with a provider" %}
+
+Instead of a password, you can authenticate with a supported provider. Only for self-hosted Pro and Enterprise plans.
+
+#### IAM authentication
+
+To connect to Amazon RDS instances using IAM authentication instead of a password, see [IAM authentication for AWS RDS](./aws-rds.md#iam-authentication).
+
### Use a secure connection (SSL)
You can paste your server's SSL certification chain.
diff --git a/docs/databases/connections/postgresql.md b/docs/databases/connections/postgresql.md
index 01cb5a710c4..bcae8702348 100644
--- a/docs/databases/connections/postgresql.md
+++ b/docs/databases/connections/postgresql.md
@@ -77,6 +77,10 @@ To use Oauth as a provider, you'll need to input your:
- Auth token URL
- Auth token request headers (a JSON map)
+#### IAM authentication
+
+To connect to Amazon RDS instances using IAM authentication instead of a password, see [IAM authentication for AWS RDS](./aws-rds.md#iam-authentication).
+
### Schemas
You can specify which schemas you want to sync and scan. Options are: