I try to connect on my Aurora Postgres database with IAM user form my local machine but i have the following error :psql: FATAL: PAM authentication failed for user "test-rds"
Command for create user on db :
CREATE USER test-rds WITH LOGIN;
GRANT rds_iam TO test-rds;
I have create this policy and attach it to my IAM user.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"rds-db:connect"
],
"Resource": [
"arn:aws:rds-db:eu-west-1:$account:dbuser:$db-id/test-rds",
]
}
]
}
Then test the following commands :
export PGPASSWORD=$(aws rds generate-db-auth-token --hostname $db-host --port $db-port --username test-rds --region eu-west-1)
psql "host=$db-host port=$db-port sslmode=require sslrootcert=rds-combined-ca-bundle.pem dbname=postgres user=test-rds"
If i try with an postgresql user i can access to my db but not with iam users i don't understand why.
Please help me ^^ !
The problem was solved when I adapted the following command :
export PGPASSWORD=$(aws rds generate-db-auth-token --hostname $db-host --port $db-port --username test-rds --region eu-west-1)
I have add AWS_PROFILE in my command.
export PGPASSWORD=$(AWS_PROFILE=test-rds aws rds generate-db-auth-token --hostname $db-host --port $db-port --username test-rds --region eu-west-1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With