Amazon EC2 instance cannot resolve hostnames

amazon ec2nameserver

My free tier EC2 instance (ubuntu 11.04, created last year) is expired. I just created a new one (ubuntu 12.04), but found that the new EC2 cannot resolve any hostname. By checking /etc/resolv.conf.

The old one looks like:

domain ap-northeast-1.compute.internal
search ap-northeast-1.compute.internal
nameserver 172.16.0.23

Where the new one looks like:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

Is the nameserver configuration not automatically set up now? How should I configure the nameserver, through the AWS console? Do I have to use Route 53? I would rather use a free solution if it's not too complicated to set up.

Best Answer

I was curious so I just launched an instance using AMI "Ubuntu Server 12.04.2 LTS" and I have this in resolv.conf:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 172.16.0.23
search us-west-2.compute.internal

So maybe something went wrong when you created your instance. Try launching a new one.

Edit: Since your instance is inside a VPC, try Creating a DHCP Options Set with domain-name-servers=AmazonProvidedDNS, then assign the options set to your VPC.