Pointing a subdomain to an ec2 instance


#1

I’m doing some development work for a client, and I’m eventually going to have to install a full LAMP stack server at their site.

Given the latter requirement, I’m doing the development work on an ec2 instance. I’d like them to be able to access the dev site as subdomain.mydomain.com, where mydomain.com is a domain that is hosted here at DH.

Can I just do the following and everything will work? Or am I missing something?

  1. create the subdomain (in the Panel)
  2. create a CNAME record pointing to the ec2 public IP (in the Panel)
  3. create a VirtualHost block for subdomain.mydomain.com (on the ec2 instance)

Thanks


#2

Skip step 1. You only need to create a subdomain on our end if you want us to do something with the subdomain (like hosting it).

Otherwise that looks good.


#3

Great. Thanks andrewf.

Will that be subject to the normal DNS dissemination delays? Or are those delays averted because DNS already knows where to find mydomain.com?
What if the ec2 instance goes down, and I have to change the CNAME record to a new instance IP?

Thanks again


#4

[quote=“coolgeek, post:3, topic:57337”]Will that be subject to the normal DNS dissemination delays? Or are those delays averted because DNS already knows where to find mydomain.com?
What if the ec2 instance goes down, and I have to change the CNAME record to a new instance IP?[/quote]

It should be a matter of minutes max (local queue time), as any domain request is already querying the DNS here.


#5

DNS caching is the issue at hand. If you’re querying our nameservers directly, you’ll see the new record show up promptly, but if your ISP (or your customers’ ISPs) have the records cached, they may continue to see the original value until the cached value expires, which may take up to four hours.


#6

OP indicates he hasn’t actually ‘hosted’ the subdomain yet so it should be ultra quick, yeah?

Maybe I’m just missing something obvious (need moah coffeez) :smiley:


#7

It was a little confusing because I was asking about both situations.

If I understand correctly, it sounds like it should propagate within minutes for the initial creation, but if I need to repoint, it could take up to 4 hours for caches to refresh.


#8

Ahh yes! I only answered one question when you had asked two. Definitely time for coffee :smiley:


#9

Caching can actually be a problem for nonexistent subdomains as well — many ISPs perform “negative caching” on DNS, so it may take some time for a new subdomain to appear if you’ve requested it before it was fully created.


#10

Yeah, negative caching should only occur if the subbie doesn’t exist on the DNS when the request is made. I s’pose the best way to get a new one up and running ASAP would be to create the entries, wait a bit™, then issue a lookup from the DH shell locally. Once it exists on DH then you should be safe to fire up the browser.


#11

No worries there - I didn’t try navigating to the subdomain yet.

One last clarification - in my initial post I referred to the “public IP”. It appears that I conflated “Public DNS” address with “Elastic IP” address. I should use the Elastic IP address in the CNAME record, right?

Thanks