How can I serve multiple subdomains using the same Elastic IP address in AWS using route 53?

I have one Elastic IP address in AWS, and I want to use this IP address to route traffic to several separate EC2 instances based on a subdomain. Basically, the same as virtual hosts on the Apache httpd server. For example:

  • example.com - ELB: xxx.xxx.xxx.xxx
  • test.example.com points to EC2 instance ID 1
  • build.example.com points to EC2 instance ID

All traffic for each domain will be sent to xxx.xxx.xxx.xxx, and then based on the subdomain name. Route 53 sends traffic to the correct instance.

I went through the Route 53 documentation and I don’t see how this is done. I also looked at Amazon ELB, but was not sure if this would work.

Does anyone know how to configure this only with AWS tools (Route 53 and / or ELB)? I would prefer not to use a script of it or use a reverse proxy if I can avoid it.

Any ideas or help would be great. Thanks in advance.

+4
source share
2 answers

You do not need an elastic ip for each server. Each server already has an IP address, so you can use it (if you really want to address the servers by IP address), but you most likely need to configure cname in your domain for each server, and then contact the server by DNS name , not by ip address.

i.e:.

server1.example.com
server2.example.com
server3.example.com 

etc.

EIP.

, , , IP-?

, AWS 5 EIP, , , EIP, , , , , 5 .

+4

1 IP- EC2, .

  • CNAME ALIAS example.com ELB.
  • EC2, , :
    • IP-.
    • , IP- EC2.
    • A Route 53, subdomain.example.com IP-.

. EC2 , .

0

Source: https://habr.com/ru/post/1625381/


All Articles