I am trying to connect ec2'instance Postgres DB from my PC (windows) thru Python.
Steps i have taken before this :
I am running Amazon Linux AMI EC2 instance.
I have installed Postgres SQL following the below command :
sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs
sudo vim /var/lib/pgsql9/data/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 0.0.0.0/0 trust
# IPv6 local connections:
host all all ::1/128 trust
My pg_hba.conf file:
sudo vim /var/lib/pgsql9/data/postgresql.conf
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all
# (change requires restart)
port = 5432 # (change requires restart)
sudo su - postgres
psql -U postgres
sudo service postgresql start
CREATE DATABASE hacker_news WITH OWNER postgres;
I am not sure where i am doing wrong for the connectin g the postgresSql db in in my running ec2 instance.
Any help /Directions appreciated.
Basically i want to connect to my postgresql db n my remote device so that i can insert data base into it by python.
Thank you .