Linux – Load Balancing and Securing Server for Custom TCP Protocol on EC2

amazon ec2linuxload balancingreverse-proxytcp

We've developed a custom TCP protocol to interface with iPhone clients over sockets and I am looking to layout our production server. We'll be running our server written in erlang on a single debian EC2 instance as well as most likely running mysql on a separate instance (I'm guessing this would be recommended?).

I'm looking to secure and load balance connections to our TCP server and was looking at EC2's ELB, HAProxy, LVM and nginx. nginx seems to be http only, and since we're using a custom protocol I was looking for some input on the design of such a system. I am also wondering what the implications of router/firewall blocking on cellular networks ISPs will be.

My current design idea would be putting everything over port 80 to ELB and route this to the TCP server. I'm not completely sold on ELB, so I was wondering:

  1. What other options are out there for non http reverse proxy,
  2. Can SSL be run on the reverse proxy or does this also need to be run on the TCP server
  3. Any recommendations for firewall/router workarounds for cellular networks other than going over port 80.

Best Answer

Well, neither haproxy or ELB are HTTP only; they'll both do arbitrary TCP connection proxying. But why would you possibly want a proxy? Just run an L3 load balancer instead; it's much cleaner. It might not work in AWS, but I'd call that a limitation of AWS.