Map a domain name to an AWS Elastic Beanstalk (EC2) instance

publish on

How to map your custom domain name to an AWS EC2 instance.

Because the IP address of an instance is not fixed (if you use a load balancer) you should not map your instance IP address directly into a DNS 'A' record. There is hopefully a workaround to this issue.

The first step is to find your environment URL in the Elastic beanstalk console:

Login to your Amazon Console

Then Navigate to the Elastic Beanstalk console:

And select your environment:

Now write down the environment URL:

And finally go to your registar, delete any A records you may have configured and add the following record to your DNS setting:

  1. Record type: CNAME
  2. Name:
  3. Value: {environment_url}

Wait a couple a minutes and try accessing your website using your custom domain.

Note: Don't forget to redirect (or make an alias) to the 'www' version of your domain (you  might also be interested in how to force Google to display domain name with www):

  1. Record type: CNAME
  2. Name: www
  3. Value:

comments powered by Disqus