Connect to AWS RDS Postgres database with python

0 votes

 connected to it using pgAdmin4 with the following configs of a read-only user:

host_name = "my-rds-table-name.123456.us-east-1.rds.amazonaws.com"
user_name = "my_user_name"
password = "abc123def345"

I have verified that I can query against the table.

However, I cannot connect to it using python:

SQLAlchemy==1.2.16
psycopg2-binary==2.7.6.1
mysqlclient==1.4.1

With:

import psycopg2
engine = psycopg2.connect(
    database="my-rds-table-name",
    user="my_user_name",
    password="abc123def345",
    host="my-rds-table-name.123456.us-east-1.rds.amazonaws.com",
    port='5432'
)
Feb 16 in AWS by Rahul
• 2,080 points
54 views

1 answer to this question.

0 votes
Here my-rds-table-name is the database instance name, not the database name, the default database name is postgres

import psycopg2

engine= psycopg2.connect(

database="postgres",

user="my-user-name",

password="abc123def345",

host="my-rds-table-name.123456.us-east-1.rds.amazonaws.com
answered Feb 16 by anonymous

Related Questions In AWS

0 votes
1 answer

Why can't I connect to AWS RDS?

Here your security groups are incorrect. If ...READ MORE

answered Feb 9 in AWS by anonymous
27 views
0 votes
1 answer

How can i copy tables from one database to other on AWS?

You can use AWS Data pipeline to ...READ MORE

answered Jul 5, 2018 in AWS by Priyaj
• 58,060 points
1,490 views
0 votes
1 answer
+1 vote
1 answer

How to add SSL certificate to AWS EC2 with the help of new AWS Certificate Manager service

refer this link  https://aws.amazon.com/certificate-manager/faqs/ You can't install the certificates ...READ MORE

answered Jul 19, 2018 in AWS by Priyaj
• 58,060 points
870 views
0 votes
1 answer
0 votes
1 answer

Deploy react app to AWS with pm2

Under 'tools' directory, in 'distServer.js' try to ...READ MORE

answered Feb 6, 2019 in AWS by Fatima
1,824 views
0 votes
1 answer

Migrate from aws rds aurora(postgres engine) to regular rds postgres

There are a couple of options you ...READ MORE

answered Feb 17 in AWS by anonymous
40 views
0 votes
1 answer

Add a new item to a Dynamodb using a AWS lambda function each time a function is executed with Cloudwatch

The problem here is that the PutItem ...READ MORE

answered Feb 14 in AWS by Rahul
• 2,080 points
42 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP