From: Hannah Huang <hannah.huang.y@gmail.com>
To: aditya desai <admad123@gmail.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: SSL connection getting rejected on AWS RDS
Date: Wed, 30 Sep 2020 21:17:37 +1000
Message-ID: <C162BDBD-570C-4738-9812-6258CFFFEFB0@gmail.com> (raw)
In-Reply-To: <CAN0SRDHEy=RQEt2Mjh=r_kPFA4XVAa74D9EZR05o6LODLHwF3g@mail.gmail.com>
References: <CAN0SRDHEy=RQEt2Mjh=r_kPFA4XVAa74D9EZR05o6LODLHwF3g@mail.gmail.com>
> On 30 Sep 2020, at 5:19 pm, aditya desai <admad123@gmail.com> wrote:
>
> Hi,
> We have AWS RDS and we are trying to connect to DB remotely from EC2 instance.as <http://instance.as/; client connection using psql. We are trying to set up IAM roles. We did all the necessary settings but got below error. Could you please advise?
>
> Password for user lmp_cloud_dev:
> psql: FATAL: PAM authentication failed for user "testuser"
> FATAL: pg_hba.conf rejects connection for host "192.168.1.xxx", user "testuser", database "testdb", SSL off
>
> Regards,
> Aditya.
>
Hi Aditya,
See the below example of me connecting to RDS from an EC2 instance:
You need to change the $RDSHOST value
you need to replace my “app_user” to your “testuser” and database “postgres” to your “testdb”
[ec2-user@ip-172-31-13-121 ~]$ export RDSHOST="mypg.cfvvs1nh3f7i.ap-southeast-2.rds.amazonaws.com"
[ec2-user@ip-172-31-13-121 ~]$ export PGPASSWORD="$(aws rds generate-db-auth-token \
--hostname $RDSHOST \
--port 5432 \
--username app_user)”
[ec2-user@ip-172-31-13-121 ~]$ psql "host=$RDSHOST port=5432 sslmode=require dbname=postgres user= app_user"
psql (11.5, server 12.3)
WARNING: psql major version 11, server major version 12.
Some psql features might not work.
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=>
Thanks,
Hannah=
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: hannah.huang.y@gmail.com, admad123@gmail.com, pgsql-performance@lists.postgresql.org
Subject: Re: SSL connection getting rejected on AWS RDS
In-Reply-To: <C162BDBD-570C-4738-9812-6258CFFFEFB0@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox