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 回答
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
专家
已回答 1 个月前
profile picture
专家
已审核 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容