Ejabberd and Xmpp on EC2. Connection Timeout

I have been working on Ejabberd and Orbited for our Rails application for over 5 months and have installed and managed our servers (most of which run on the Amazon EC2 setup) for a while now, but my last installation left me stumped. The thing was my installation would go through perfectly and I would be able to access my ejabberd admin console on 5280 perfectly but was unable to connect to it through the console.

I would create my client and the connect call would wait forever before timing out

client= Jabber::Client.new(Jabber::JID.new("admin@jabber.example.com"))
Errno::ETIMEDOUT: Connection timed out - connect(2)
  from /usr/lib/ruby/gems/1.8/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:70:in
  from (irb):4

I tried reinstalling and looked everywhere I could have possibly goofed up.

The solution to the problem was on EC2 and not the installation. Its actually an EC2 security groups issue. You need to ensure for the instance your working with, if the security group has port 5222 and if your working with server-2-server 5269 open.

The way to get this done using elastic fox is

  • click on the instance you want the port to be open
  • click on the security groups tab
  • click on the group permissions -> grant permissions button (green button with a tick mark) which would open a popup box
  • add the port (in the port field) 5222.
  • Add for hosts to allow all.

Repeat the process and add it for 5269 if your working with server-2-server and your done.

Hope this is useful to someone.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s