Search code examples
node.jsreactjsamazon-web-servicesamazon-elastic-beanstalk

AWS: Pointing sub-domains to different elastic beanstalk environments


Using Amazon AWS, I have two Elastic Beanstalk environments. One hosts my React client, and the other hosts a Node.js API for the client.

I own some-domain-name.com and I would like to use two sub-domains:

  • app.some-domain-name.com
  • api.some-domain-name.com

I would like app.some-domain-name.com to point to the React environment, and api.some-domain-name.com to point to the API environment.

Is there a great way to do this using Route 53 and hosted zones? In the past, I've rerouted traffic on different sub-domains to different ports on the same server. I have not, however, been able to route requests to different servers depending on the sub-domain. Thanks!


Solution

  • Just create 2 CNAME records in whatever DNS host you are using, one for each subdomain. This is the most basic way of using DNS, so any DNS host will support this, no need for Route53 unless you are already using it.