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, 2022 in AWS by Rahul
• 2,080 points
3,458 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, 2022 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, 2022 in AWS by anonymous
486 views
0 votes
0 answers
0 votes
0 answers

Convert oracle UDF function with to_number and value_error expection in it to AWS RDS maria db

create or replace FUNCTION num_check (p_string IN ...READ MORE

Dec 14, 2022 in AWS by Tejashwini
• 3,820 points
406 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,100 points
4,754 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,100 points
1,844 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, 2022 in AWS by anonymous
819 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, 2022 in AWS by Rahul
• 2,080 points
576 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP