4

I am at the point in playing around with EC2 that I have launched a webserver. Right now, the website URL looks like http://ec2-<some numbers>.compute-1.amazonaws.com/

I am evaluating the usefulness of these services for my small business purposes; is there a way I can get my URL to look something more like http://<mybusiness>.com. Ideally, I would like to get it to look cleaner, and furthermore I would rather not have "amazonaws" as part of it. Is this possible?

I'm a newb to AWS, so apologies if this is an easy question

Jay
  • 6,544
  • 25
  • 34
Sarah
  • 41
  • 1
  • 2
  • Just use something like freedns and setup some domain with ip number to your machine. You need elastic IP for this. – Andrew Smith Jun 29 '12 at 22:05

2 Answers2

5

This actually has very little to do with AWS, so you can apply this more generally where you next have hosting.

To solve this, you should setup DNS. At this point, you just add the corresponding entries:

mybusiness.com.  IN A 1.2.3.4
www.mybusiness.com. IN CNAME mybusiness.com

so that (www.)mybusiness.com will work as expected. 1.2.3.4 is the (elastic) IP that Amazon gives you (i.e. the one that ec2-<some numbers>.compute-1.amazonaws.com resolves to).

Jay
  • 6,544
  • 25
  • 34
  • 1
    to be clear, the DNS will be controlled by your name registrar (like GoDaddy) and you should be able to control where it points from there. Here is the first link I could find describing how: http://www.brangle.com/wordpress/2010/11/mapping-amazon-aws-s3-to-a-custom-domain-name/ – jhayes Jun 29 '12 at 21:17
3

Your EC2 instance has a public IP address and DNS name. Using your normal domain provider, you can create either an A record pointing to the public IP address, or a CNAME record pointing to the DNS name.

However, if you stop and restart your instance (either intentionally or unintentionally), both your public IP address and DNS name will change. If this happens, you'll have to update your DNS entry for mybusiness.com. This may cause a problem because DNS entries may be cached. You'll have to wait (sometimes 48 hours) for the cache to refresh.

To avoid this problem, there are 2 possible solutions: (a) Use an Elastic IP address. If you do this, you can regain your public IP address and DNS name if your instance is stopped. (b) Use Route 53 to host your mybusiness.com DNS and update your records programmatically when your instance starts. For this to work, you'll need to use a short TTL (time-to-live) on your DNS entries.

Matt Houser
  • 10,053
  • 1
  • 28
  • 28