I am trying to create a simple client/server application using Thrift which is going to be run on EC2.
The example I created works awesome for localhost, but when I try to make the RPC call across two different machines on ec2 (both of which have separately allocated elastic IP addresses), it does not work with the following error:
raceback (most recent call last):
File "SocialQClient.py", line 25, in <module>
transport.open()
File "/usr/local/lib/python2.6/dist-packages/thrift/transport/TTransport.py", line 150, in open
return self.__trans.open()
File "/usr/local/lib/python2.6/dist-packages/thrift/transport/TSocket.py", line 90, in open
raise TTransportException(type=TTransportException.NOT_OPEN, message=message)
thrift.transport.TTransport.TTransportException: Could not connect to <MY-ELASTIC-IP>:9090
I have my security group set up for 0.0.0.0/0 for port 9090 on both machines for TCP. I tried UDP also and it did not fix it. What am I doing wrong?
Update:
I am hazarding a guess that when one of your ec2 instance (“node1”) attempts the RPC call to the other ec2 instance (“node2”), node2 returns its internal IP address instead.
Reference – http://alestic.com/2009/06/ec2-elastic-ip-internal
Quote:
And here’s some examples which illustrates how dig returns different values, comparing the scenario where you use a machine outside of Amazon to ping an ec2 instance, versus when you use an ec2 instance to ping another ec2 instance:-