What would be best way to achieve such thing:
I have limited amount of elastic ips, and I have bunch on EC2 instances to launch small apps.
I have an idea to have load-balancer or an EC2 instance that could route traffic to any other EC2 instances.
For example there would be 3 instances:
- Instance 1 (ec2-00-00-0-01.eu-west-2.compute.amazonaws.com)
- Instance 2 (ec2-00-00-0-02.eu-west-2.compute.amazonaws.com)
- Instance 3 (ec2-00-00-0-03.eu-west-2.compute.amazonaws.com)
I would want to use Public IPv4 DNS of these instances.
So for example how could I have single place that could route traffic based on domain name.
EC2 instance (nginx reverse proxy) or A load-balancer in AWS would listen for requests of domains:
- instance1.com (would route traffic to ec2-00-00-0-01)
- instance2.com (would route traffic to ec2-00-00-0-02)
- instance3.com (would route traffic to ec2-00-00-0-03)
What would be your approach to handle such scenario?