I have a simple question which I am not finding in Stackoverflow even though this process of generating a db auth token has been asked many times but would like clarification on this if anyone can help.
This is all being tested currently and the process is like so:
CREATE USER 'readonly'@'%' IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS';
GRANT SELECT ON *.* TO 'readonly'@'%';
ALTER USER 'readonly'@'%' REQUIRE SSL;
FLUSH PRIVILEGES;
aws rds generate-db-auth-token --hostname rds-dev-mysql56.lock.internal --port 3306 --region us-east-1 --username readonly
Once I grab the token to sign in through my Datagrip IDE, I receive this error:
[28000][1045] Could not connect to address=(host=rds-dev-mysql56.lock.internal)(port=3306)(type=master) : (conn=107783568) Access denied for user 'readonly'@'IP' (using password: YES) Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding' [28000][1045] (conn=107783568) Access denied for user 'readonly'@'IP' (using password: YES) Current charset is UTF-8. If password has been set using other charset, consider using option 'passwordCharacterEncoding'
I then followed this where the AWS RDS MySQL passwordCharacterEncoding
should be added with utf8
like in this post: MariaDB - Cannot connect to MariaDB instance from Dbeaver using correct password. However, with this change I get a new error:
[28000][1045] Could not connect to address=(host=rds-dev-mysql56.lock.internal)(port=3306)(type=master) : (conn=107785323) Access denied for user 'readonly'@'IP' (using password: YES) [28000][1045] (conn=107785323) Access denied for user 'readonly'@'IP' (using password: YES)
It's only when I directly grab the Writer instance Configuration endpoint that this works where I am able to sign in.
So my question is, Do CNAME records work with generating the db auth token? I have read online that CNAME records don't work well with SSL/TLS encryption since I enabled REQUIRE SSL
. Would appreciate any help.
EDIT: Added the error output in my Datagrip IDE and added link following instructions on the passwordCharacterEncoding
.
EDIT 2: In the Datagrip IDE, I have SSL enabled and the following information. The token that is created is pasted where Password
which does not work with the CNAME record:
However, as for how I get it to work with the Writer instance Configuration Endpoint, I enter the following to generate the token:
aws rds generate-db-auth-token --hostname rds-dev-mysql56.cluster-23423423fd.us-east-1.rds.amazonaws.com --port 3306 --region us-east-1 --username readonly
This allows me to grab the token and successfully enter the database. I hope this is enough information.
I don't think there is any easy way to figure this out but I guess CNAME records don't work with RDS IAM Authentication which is annoying. The only way for this is to work is to do the following:
User
:
I just wanted a simple way to connect using CNAME but this will do the trick instead.