Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JBoss + Amazon EC2 + IP Binding

 
Marcus Gough
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

Currently I run JBoss 6 on a dedicated server. Remote clients connect via EJB and all is well. To start the server, i run a command like:

run.sh -b {{server ip address}}

The key here is that the server ip address must be set for the remote connections to work (0.0.0.0 is no good).

I am keen to migrate my solution to Amazon EC2. I have managed to get setup, but unfortunatly I cannot start the JBoss server with the public (elastic) IP address binded as I would on a dedicated server. I have spent two days experimenting and googling to find a solution to my problem but without luck

Does anybody have any experience of overcoming this issue? Any pointers would be hugely appreciated.

Many Thanks,

Marcus.

 
Karthik Shiraly
Bartender
Posts: 1194
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EC2 and elastic IP behaviour don't correspond exactly to that of a dedicated server with a static IP address.
In a regular dedicated/virtual server with static IP address, if you do an ifconfig, you'll see the static IP address in there.
But in EC2, you won't see the elastic IP.
That's because the elastic IP is never assigned to the instance, as a normal static IP would be.
EC2 uses NATting to map elastic IP to the private IP of EC2 instance it's currently bound to.
Since elastic IP is never assigned to the instance, you can't do run.sh -b <elasticIP>

Instead just execute with private IP or 0.0.0.0:
1. run.sh -b <privateIP>
OR
run.sh -b 0.0.0.0

2. The EC2 firewall should be configured to allow access to JNDI/RMI ports, etc.
For that, check which security group is applied for your instance (you can get this from AWS console when you select the instance)
In the sidebar "Security Groups" page, select this security group and add appropriate inbound rules for each port you want (JNDI and RMI are the only two needed, I guess...never tried remote EJB on EC2, just tried web server).

Now when your client accesses remote EJB on EC2, the routing will be
client --> elastic IP -> EC2 firewall -> EC2 NAT -> [Elastic IP to private IP] -> EC2 instance
 
Carrie Coy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which port numbers, specifically, need to be open on the EC2 firewall? I followed these instructions and opened ports 8080, 1098-1099, 4444-4445, 8009, 8083, and 8093 and I still can't connect to http://elastic-ip:8080... Jboss is running and bound to the private IP. Any tips on how to diagnose this?
 
Carrie Coy
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I neglected the obvious. As soon as I opened outbound port 8080, I was able to connect.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic