You're right--that wouldn't work at all. I was foolishly confused in thinking that not only was the SQL server running in AWS, but it was listening to an AWS RServer connection. I blame holiday stupor. Does looking at the form of the Python request provide any clues?
Can you share your pg_hba.conf content, have in mind that the first matching rule in this file is going to be applied regardless of the next ones. Other things to consider are that IPv6 only clients require a specific rule to match and lately the postgres user is not allowed to be passwordless and uses scram-sha-256 for encoding by default
Error in postgresqlNewConnection(drv, ...) :
RPosgreSQL error: could not connect postgres@databasespot1.c1jl5uf8n4xl.us-east-1.rds.amazonaws.com:5432 on dbname "basedatos": SCRAM authentication requires libpq version 10 or above
Well, finally, after wiping out R, and all of the packages, I started installing everything from scratch and installed RPostgreSQL package and I was able to connect to the server.
for some strange reason, libpq, besides from having the 16.1 version, RPostgreSQL links to a previous version (that I couldn't find but got rid of it wiping out everything)
Thanks for your help. Now I'm able to execute SQL queries on the AWS Postgres Server from my mac laptop!