Search code examples
dnsamazon-route53ubuntu-20.04amazon-lightsailreverse-dns

ping: subdomain.example.com: Temporary failure in name resolution - Ubuntu Lightsail Instance and Route53 with Public Hosted Zone


I have been searching solution since last 2 days and tried my best to solve myself, but I think I need help now.

Here is my setup

  • AWS Lightsail Ubuntu 20.04 instance with Public/Static IPenter image description here

  • Route53 Public Hosted Zone with following setup enter image description here

  • I also tried to test record using Route53 Test Record option and everything seems to work fine.enter image description here

Problem
When I ping my lightsail instance public/static ip, it works fine.
When I try to ping subdomain.example.com or example.com, I get "Temporary failure in name resolution". I have configured nginx server and I am expecting a page in response to request to my subdomain.

  • Do I need to setup something in my Lightsail server instance??
  • OR am I missing something in Route53 configuration ??

Help will be highly appreciated.


Solution

  • After spending hours of searching and understanding the main cause, I found out the solution.

    So the main problem was mismatch NameServer values in Registered Domain, and the NameServer provided by the Hosted Zone.

    I purchased the domain from Amazon using Route53. This means my DNS provider is Amazon and it also creates a Hosted Zone for you first time, using which you can create records and define routing. I had deleted the Hosted Zone after domain purchase.

    If you delete your hosted zone and recreate later, then you get different DNS setting which mismatches with your First-time created DNS settings.

    Later, I created the Hosted Zone again.

    Now, here is my current situation.

    • Route53 -> Domains -> Registered Domains enter image description here

    • Hosted Zone DNS settings enter image description here

    Look at the RED rectangular sections and you will find out that DNS values are different. This was the main problem

    This happens when we delete / create / delete again / re-create the hosted zones but the DNS values remains same in the Domain -> Registered Domains.

    Solution: Copy DNS values of Hosted Zone, and update to the Registered Domain section.

    Read the reply here, its helpful: https://forums.aws.amazon.com/thread.jspa?threadID=236377

    Hope this would help others as well. :)