Reputation: 211
I can connect to the MySQL RDS database using IAM authentication from the SQL command line tool. But the same I need to achieve connections with SQL clients like DBeaver or some other clients. I don't have the provision of passing tokens in SQL client.
This document explains connecting RDS using MySQL workbench/j but I am unable to download the MySQL workbench/j due to a forbidden error. https://aws.amazon.com/blogs/database/use-iam-authentication-to-connect-with-sql-workbenchj-to-amazon-aurora-mysql-or-amazon-rds-for-mysql/
Could someone help me in connecting RDS using IAM authentication from an SQL client?
Upvotes: 2
Views: 3877
Reputation: 11
Create a default connection with the host, username and save the profile without entering a password. After that:
export TOKEN="$(aws rds generate-db-auth-token \
--hostname <hostname> \
--port <port> \
--region <region> \
--username <db-user-name>)"
open -a "DBeaver.app" --args -con "driver=mysql|name=<ProfileName>|connect=true|database=<DatabaseName>|password=$TOKEN|create=false"
And also you can add custom driver to dbeaver like the AWS JDBC: https://github.com/awslabs/aws-mysql-jdbc?tab=readme-ov-file#using-the-driver-with-a-database-client-dbeaver
Upvotes: 1
Reputation: 2340
In fact you could use the aws rds command to generate each time a new token to use as your password to authenticate the database. But since you want to do it with deaver, looks like its available (https://dbeaver.com/docs/wiki/AWS-Credentials/) but only in Enterprise edition (not the community edition)
Upvotes: 0
Reputation: 275
If you're going to use DBeaver The proper connection details :
Upvotes: -3