Continuing on with my Adventures with AWS, I needed to point a subdomain to Amazon Web Services, while keeping my primary domain and it’s DNS handled at another host.

I would consider this is a relatively common need, you have your primary domain hosted somewhere that is handling your DNS for you, but you want to host certain parts somewhere else. This gives you flexibility to add new hardware, utilize cheaper / free hosting, and a whole host of other benefits based on your situation.

For the purposes of this example, the subdomain we’re going to point is aws.

It may seem complicated but we can do it in just a few steps as long as you have an Elastic IP already configured and added to your EC2 instance. If you don’t, check out my tutorial on setting up your Elastic IP’s first.

Pointing a Subdomain to AWS

  1. Log into your hosting account that handles your DNS for the domain you want to point. This may be where you registered the name, or it may be your current hosting provider.
  2. Open up your DNS zone and add an A record for the new subdomain. It should look something like: aws.yourprimarydomain.com. 43200 IN A {{ELASTIC IP}}
  3. If your hosting provider gives you a user interface to change your DNS settings, you’ll want to add a new record, or row with the name as aws (or your subdomain), the type as A and the data or value as the Elastic IP you have pointing to your EC2 Instance.

This can take some time to propagate, up to 72 hours, but if it’s a new subdomain it’s likely to propagate much quicker.