on-internet
← Community

How to connect to Amazon redshift cluster from within my Amazon EC2 instance

Stack Overflow ·

I have a Redshift Cluster in my AWS account. I am able to connect to it in python and when I run the script locally, it runs perfectly fine: import psycopg2 con = psycopg2.connect(dbname='some_dbname', host='hostname.us-east-2.redshift.amazonaws.com', port='port#', user='username', password='password') cursor=con.cursor() query = "select * from table;" cursor.execute(query) data = np.array(cursor.fetchall()) cursor.close() con.commit() con.close() But, when I copy the above script to my EC2 instance (Amazon Linux AMI), and then try running it, I get the following error: conn = _connect(dsn, co

Comments

Sign in or sign up to comment and upvote.

No comments yet.