Reputation: 105
I have a single Elastic IP address on AWS and I want to use that IP address to route traffic to multiple distinct EC2 instances based on the sub-domain. Basically, in the same manner as virtual hosts in an Apache httpd server. For example:
All traffic for each of the domains would go to xxx.xxx.xxx.xxx and then based on the sub-domain name Route 53 would send traffic to the correct instance.
I've been through the documentation for Route 53 and I can't see how this is done. I also looked at Amazon ELB but was unsure if that would work.
Does anyone know how to set this up just using the AWS tools (Route 53 and/or ELB)? I'd rather not have to script it or use a reverse proxy if I can avoid it.
Any ideas or help would be great. Thanks in advance.
Upvotes: 4
Views: 3146
Reputation: 46879
You don't need an elastic ip for each server. Each server already comes with an IP, so you can use that (if you actually want to address servers by ip address) - but what you likely should be doing is setting up a cname on your domain for each server, and then addressing the server's by the dns name, not by the ip address.
i.e.:
server1.example.com
server2.example.com
server3.example.com
etc
You don't need to use any EIP's.
Maybe you could explain better why you think all the traffic needs to go thru a single IP address?
I can't say for sure why AWS limits you to just 5 EIPs, but I am pretty sure its because if you find out you need hundreds of EIP's then you are probably doing it wrong - and forcing you to request more than 5 gives them the ability to open up a discussion with you and help you do it a better way.
Upvotes: 4
Reputation: 36113
You'll need 1 Elastic IP address for each distinct EC2 instance that you want to redirect traffic to.
Note: Since your EC2 instances need to be accessed directly, they will need to reside inside a public subnet.
Upvotes: 0