Cannot connect to RDS Postgres using the IAM Authentication

0

Steps taken:

  1. Created the IAM user rds-user which has the rds-db:connect permissions for the cluster.
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "rds-db:connect"
            ],
            "Resource": [
                "arn:aws:rds-db:eu-west-1:11111111111:dbuser:example-db/rds-test"
            ]
        }
    ]
}
  1. Enabled RDS IAM Authentication on the Cluster.
  2. Created the rds-test user inside postgres and granted the rds_iam role.
  3. Generated an AWS authentication token
export RDSHOST="example-db.eu-west-1.rds.amazonaws.com"
export PGPASSWORD="$(aws rds generate-db-auth-token --hostname $RDSHOST --port 5432 --region us-west-1 --username rds-test)"
psql "host=$RDSHOST port=5432 sslmode=verify-full sslrootcert=eu-west-1-bundle.pem dbname=postgres user=rds-test password=$PGPASSWORD"

Output:

FATAL:  password authentication failed for user "rds-test"

The SSL certificate is not expired.

1 Risposta
0

Hello.

I recommend that you first review all troubleshooting methods in the documentation below.
https://repost.aws/knowledge-center/aurora-postgresql-connect-iam

By the way, is the ARN set in the IAM policy correct?
If you try changing the ARN to "*" and are able to connect, the ARN may be incorrect.

"arn:aws:rds-db:eu-west-1:11111111111:dbuser:example-db/rds-test"
profile picture
ESPERTO
con risposta un mese fa
profile picture
ESPERTO
verificato un mese fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande