How do I associate my domain name with my AWS applications?

Jim Tough picture Jim Tough · Sep 5, 2011 · Viewed 18.3k times · Source

I've just starting using the Amazon Web Services (AWS) and I'm still learning about how it works and what features it provides. I have successfully built two of the sample Java webapps and uploaded them to hosted instances on AWS. If I go to the Elastic Beanstalk tab in my AWS Management Console, I can see each of my hosted webapps, including a URL link to each webapp. The URLs are of the format:

http://myinstancename.elasticbeanstalk.com

I also own a personal domain name. Let's call it "mydomain.com". The domain registrar provides a DNS maintenance page where I can change the A and CNAME records for my domains.

QUESTION: Is it possible for me to configure my domain DNS in conjunction with my AWS account such that I can make my AWS-hosted webapps appear with URLs like this:

http://myinstancename.mydomain.com

EDIT in 2020

This question did not age well over the last 9 years! :)

AWS services are vastly different now in 2020. The DNS service for AWS is named "Route53". It is the first place you should look when your goal is to configure a custom domain name to work with your AWS services.

The person who originally answered this question also mentioned "Elastic IP". That is still a thing in AWS. You can associate an Elastic IP with an AWS server to give that server a public IP address that will not change as long as you (the AWS account holder) continue to own that specific Elastic IP. Then in Route53, you associate your DNS entry with the Elastic IP.

I don't use Elastic Beanstalk anymore in 2020. AWS has better options now.

Answer

Cédrics picture Cédrics · Sep 6, 2011

First, I don't know if you use an Elastic IP, it's great:

  • create and attach an elastic IP to one of your instance
  • you have your static IP
  • add a new * sub-domain in your DNS zone, and register a A record with your static IP
  • wait from few hours to 2 days for the DNS propogation

What is really cool with Amazon Elastic IP is that you can rapidly remap it to any other instance and your domain will work instantly without having to change again your DNS zone and waiting for the propagation.

(Elastic IP is free of charge. You pay a small fee only if you don't use it).

Then, if you want to map $1.yourdomain to $1.elasticbeanstalk, personally I will use a proxy/load-balancer like nginx or haproxy, and add a proxy pass. Do you already choose/use one? Which one?