0

I'm trying to use redshift_connector by AWS to connect to my Redshift cluster.

To be able to connect, I first need to set up a proxy. Since redshift_connector doesn’t seem to have a dedicated parameter for proxy, I created and set an environment variable before creating the connection:

os.environ['HTTPS_PROXY'] = 'proxy_url'

However, the connection creation often times out, and it seems this is because of the proxy setting.

When I try using boto3 with redshift-data, and I supply the proxy inside the Config object:

config = Config(proxies={...})

…it works just fine.


Question:

Is there any other way to set up a proxy for redshift_connector?

I’d prefer using redshift_connector over boto3 so I can avoid active waiting for results.

1 Answer 1

0

I think you may be looking for an ssh tunnel. This is an edge ec2 instance as an internet visible ssh enpoint that can tunnel the connector port to you private Redshift instance. Does this sound like it addresses your need?

https://repost.aws/knowledge-center/private-redshift-cluster-local-machine

I've done this many times and works well since Redshift connections are done on a single port. If you have long running queries you may need to have to set up some "keep alive" packets to keep the port open as some network routers will time out active connections if they are idle too long. Not hard just something to watch out for. If this sounds right and the article doesn't help you get this set up just reach out.

Sign up to request clarification or add additional context in comments.

1 Comment

I am not able to setup ssh tunnel on the machine where the code should run.. I also found out that redshift_connector is unusable with SQLAlchemy for connection pooling (because the sqlalchemy-redshift is dead project). Given these two issues, I will use other solution than redshift_connector.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.