Search code examples
amazon-web-servicesamazon-ec2dnsamazon-route53nameservers

Pointing sub domain only to AWS EC2 instance?


I am trying to migrate a PHP site to AWS.

I have created an instance with a specific AWS url and have configured an AWS Route 53 service.

Looking at the docs here: http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html#root-domain-walkthrough-update-ns-record

It says to update the Nameservers for the particular domain, however that would affect the live version of the site which is still being hosted on Digital Ocean.

What I want to do is:

  • Point a subdomain e.g. dev.mysite.com to the dev environment on AWS
  • Check everything is ok
  • Create a live environment on AWS
  • Point mysite.com to the live environment.

I am still new to this way of hosting, is what I am trying to achieve, feasible.

Or is there another way I should be tackling this.

Any suggestions welcome.

Thanks


Solution

  • That's absolutely fine. Within Route 53, you can create an a record for your Apex (www.site.com) to point to your EC2 (?) instance, and then another CNAME record which points to your dev.site.com

    Note that Alias records are free, and the preferred way of doing the above, but only work with certain types of AWS resources such as ELBs.