IB Gateway Docker Deployment Timeout Error on EC2 Instance #167
-
Hello everyone, I am experiencing an issue with running IB Gateway in a Docker container on an EC2 instance, which works perfectly fine on my local machine. However, when deployed on EC2, I encounter a timeout error when sending API requests to the IB Gateway running inside the Docker container. The logs of the docker container in EC2 instance ``(ubuntu@ip-172-31-34-58:~/ib-gateway-docker$ docker-compose up --build [+] Building 36.7s (17/17) FINISHED docker:default => [ib-gateway internal] load build definition from Dockerfile 0.0s ` Possible Issue Identified by ChatGPT from the above log: The automatic change of the TrustedIPs setting from 0.0.0.0 to 127.0.0.1,0.0.0.0 could be causing the gateway to only accept connections from localhost, blocking external requests.
The solutions I tried Modified config.ini File: I adjusted the TrustedTwsApiClientIPs parameter in the stable/config/ibc/config.ini.tmpl file to ensure it was set to 0.0.0.0, allowing connections from all IPs.
Updated jts.ini File: I also set TrustedIPs=0.0.0.0 in the stable/config/ibgateway/jts.ini.tmpl file to ensure the gateway is configured to accept external connections.
Can someone please help me? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
I don't see anything wrong on the container, it build running and logged in. ports seems to be mapped correctly. TrustedIPs AFAIK does not work, that's why socat is needed. If you have a problem it must be between your code and your instance, the container is working fine. can you connect to VNC(after enabling it)? |
Beta Was this translation helpful? Give feedback.
-
Hi, Thank you so much for your reply. Yes, I can connect to my container using VNC. |
Beta Was this translation helpful? Give feedback.
-
I even tried GCP(Google cloud platform) but I am facing the same issue. |
Beta Was this translation helpful? Give feedback.
-
Is my docker compose file correct? `name: algo-trader
Thank you so much for your time. |
Beta Was this translation helpful? Give feedback.
-
If it helps my code to connect to the `ibgateaway
Error logs `(ibkr) C:\shri_code\IBKR>python main.py During handling of the above exception, another exception occurred: Traceback (most recent call last): The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Beta Was this translation helpful? Give feedback.
Please don't take me wrong. What you are doing is not sound from a security stand point
Please read this https://github.com/gnzsnz/ib-gateway-docker?tab=readme-ov-file#security-considerations