Issue
I'm using Amazon Aurora PostgreSQL in VPC. I created an EC2 instance as a bastion host to connect via pgAdmin. When I first connect to the DB with "Connection" and "SSH Tunnel" tabs filled out, it works. But then when I close pgAdmin and try to connect again, it asks for a password to my EC2 key-pair which I don't have. Has anyone else run into this?
Solution
When you create an EC2 key-pair (or any key-pair) you can specify a password for the identity file to enhance security. I suspect you did not (quite a common thing to do but also a very bad idea, see WARNING below) and so your password is effectively unset/an-empty-string i.e. just click 'OK' and it will connect.
PGAdmin will allow you to save the password for an identity file but there is a curious safety-feature/bug/oddity that you cannot save an empty password. This means every time you logon you have to click 'OK' to the mysterious question. There is a bug/issue on this one that got closed without fixing it: https://github.com/pgadmin-org/pgadmin4/issues/6032
WARNING: If you do not specify a password for your key-pair/identity-file then anybody who can get to your file system can steal your PEM file and use it. Or if you share it with someone on an insecure channel i.e. email, messaging etc. It's like having a strong password (very long) just sitting in a file waiting to be abused. Liken it to leaving your car keys on your door mat!
Answered By - Oly Dungey Answer Checked By - Marilyn (WPSolving Volunteer)