How does Route 53 connect multiple public hosted zones to one domain name? - amazon-web-services

I have two public hosted zones in Amazon Route 53 for the same domain name (which has Route 53 as registrar), for the reason that Route 53 automatically created one when I registered the domain name and that the second one was created by Terraform.
As far as I can tell, DNS record sets in the second zone aren't applied, i.e. they're not returned for queries to the domain. Do I have to delete the first zone in order for record sets in the second zone to be active?

As far as I can tell, which hosted zone is active, meaning that its record sets are returned for queries to the domain, depends on the name servers registered with the domain. So, in order to make my second zone active I have to update the domain's name servers, in Route 53, to correspond to those of the desired hosted zone.

Following is an extract from the AWS Route 53 FAQ
Q. Can I create multiple hosted zones for the same domain name? 
Yes. Creating multiple hosted zones allows you to verify your DNS setting in a “test” environment, and then replicate those settings on a “production” hosted zone. For example, hosted zone Z1234 might be your test version of example.com, hosted on name servers ns-1, ns-2, ns-3, and ns-4. Similarly, hosted zone Z5678 might be your production version of example.com, hosted on ns-5, ns-6, ns-7, and ns-8. Since each hosted zone has a virtual set of name servers associated with that zone, Route 53 will answer DNS queries for example.com differently depending on which name server you send the DNS query to.
Click here for more details

How is Domain-Name, Namespaces, and Hosted-Zone connected?
Imagine you bought a new name from GoDaddy - example.com. Then you setup your website in your EC2 machine which has IP 100.0.0.10. To point example.com to your webserver, you will need to first choose a DNS resolver. AWS provides one - Route53. A DNS resolver translates names like example.com to IP address like 100.0.0.10.
AWS Route53 has a concept of Hosted Zones. You will need to create a hosted zone for example.com. Route53 will then give you nameservers (bunch of different URLs, AWS gives you 4). You will take these nameservers and go back to GoDaddy and there is a section to put those nameservers. This tells GoDaddy where to send the request to.
Why did we do above ^^^ ?
When you purchased the name from GoDaddy, GoDaddy became your registrator i.e. it registered your name with the DNS authorities. So whenever someone requests example.com to the DNS authorities, they will forward the request to GoDaddy. So GoDaddy needs to know where to send the request to. These nameservers tells GoDaddy that exact information.
After the request reaches AWS Route53, it knows that this domain name example.com needs to go to 100.0.0.10.
What if I create 2 Hosted Zones with the same domain name example.com?
A hosted-zone is nothing but Route53's way to define a set of route rules for a domain.
If you have 2 hosted-zone with the same domain name, you will have 2 sets of namespaces. For AWS, each set has 4 namespace, so total of 8 namespaces).
So now it depends which namespaces you give to GoDaddy. You can give it set A, in which case your second hosted-zone will not receive any traffic. You can give it set B, in which case your first hosted-zone will not receive any traffic. Or, you can give it a mixture of both set A and set B, in which case GoDaddy will send some requests to set A and some to set B, not both though.

Related

how to let web application use the purchased domain name through ROUTE 53 in AWS?

I have purchased a domain name through ROUTE 53.
2) I have created a EC2 instance and put my web application inside it that is supposed to be hosted.
3) I have configured the Gunicorn and nginx as my WSGI and web server.
How to use the purchased domain name to integrate with my application to see over the internet. I have seen many documents post on stackoverflow, and youtube videos. But I am not able to get the clear picture of what am suppose to do next.
I get that once the domain is registered I have 4 ns records generated inside the ROUTE 53. But where to use them? how to configure them.
It be helpful if somebody can give me exact steps to perform the tasks.
Thank you,
Route53 is similar to other DNS servers with extra features, in your case, you will need to assign your ec2 instance a public IP address and to be safe an Elastic IP to avoid IP change on reboot, then you need to grab this public IP and assign it to your domain root A record and www CNAME record to point to that domain
I get that once the domain is registered I have 4 ns records generated
inside the ROUTE 53. But where to use them? how to configure them.
Normally it's not required but it's helpful to control your DNS configuration from route 53 instead of the DNS registrar.
Create Hosted zone in route 53, for example if your domain name is example.com then create Hosted zone in route with name example.com, it will generate name server record.
Open newly created hosted zone and copy Name server (NS) record and replace the NS record in your DNS setting.
When you create a hosted zone, Route 53 automatically creates a name server (NS) record and a start of authority (SOA) record for the zone. The NS record identifies the four name servers that Route 53 associated with your hosted zone. To make Route 53 the DNS service for your domain, you update the registration for the domain to use these four name servers.
Add these record in DNS Name server, for example the below one is used for Godaddy
migrating-a-domain-to-amazon-route53

How can we make DNS entries using Route53 to a domain hosted with an external (third party) domain provider

We have purchased a domain lets say "xyz.com" from a third party domain provider. We have our resources in two AWS regions and we want to implement failover between the two regions using Route53.
We have created a hosted zone with the same name as of our domain i.e. "xyz.com" and created record sets in the hosted zone with failover as the routing policy.
But as our domain is external the record sets are not getting reflected.
Please suggest a way to achieve failover using route53 with domain hosted with an external provider without moving the DNS to Route53.
You won't be able to do this without switching to Route53 to host your domain. Route53 must be able to control the responses to queries according to the records you have configured. You'll have to delegate your domain to Route53 by setting the NS records to the values provided in the Route53 console.
If you don't change your DNS Nameservers to Route53 then that zone will have no effect.
You could however register a subdomain in Route53, e.g. myapp.xzy.com, and delegate that subdomain/zone in your third party domain provider to Route53. You may also add a CNAME in the main domain pointing to a record in the subdomain.
To Summarise:
Create a Hosted Zone in Route53 for myapp.xyz.com
In that zone add the two DNS records with a failover policy
In the root domain DNS, add the AWS provided NS Records to delegate a subdomain. e.g.:
myapp NS ns-123.awsdns-09.net.
If you created Apex A Records/Alias in step 2, use myapp.xyz.com
If you created CNAMEs in step 2, use mycname.myapp.xyz.com; or shorten by adding a CNAME in the root domain to resolve to that address.
Hope this makes sense.
You need to point the name servers for your domain to AWS name servers.
Basically, below are the steps -
Login to the website from where you have bought the domain.
Go to the domain DNS settings for your domain on the website.
Name Server records NS records must be pointed to the website name servers, change them to the name servers you have from AWS route53.
Wait for at least 24 hours to reflect this change.

Route 53 with external Domain Registrar?

I have created a Route 53 hosted zone which contains a SOA, an NS record and a A record.
The A record points to the web instance I have hosted on AWS.
On the registrar what do I need to use to get the domain to use Amazon Route 53, is it just Nameservers? Or do I need an A record or a CNAME?
Which Nameservers should I use the SO or the NS record?
Thanks
Just name server entries, here is AWS documentation on Migrating DNS Service for an Existing Domain to Amazon Route 53.
Which name servers? Here are steps on how/where to get them and add them in 3rd party server.
Step 5: Update Your Registrar's Name Servers
Step2: In the Amazon Route 53 console, get the name servers for your Amazon
Route 53 hosted zone:
Sign in to the AWS Management Console and open the Amazon Route 53
console at https://console.aws.amazon.com/route53/.
In the navigation pane, click Hosted Zones.
On the Hosted Zones page, choose the radio button (not the name) for
the hosted zone.
In the right pane, make note of the four servers listed for Name
Servers.
Alternatively, you can use the GetHostedZone action. For more
information, see GetHostedZone in the Amazon Route 53 API Reference.
Step3: Using the method provided by the registrar for the domain, replace the
name servers in the registrar's NS records with the four Amazon Route
53 name servers that you got in step 2.
Note Some registrars only allow you to specify name servers using IP
addresses; they don't allow you to specify fully qualified domain
names. If your registrar requires using IP addresses, you can get the
IP addresses for your name servers using the dig utility (for Mac,
Unix, or Linux) or the nslookup utility (for Windows). We rarely
change the IP addresses of name servers; if we need to change IP
addresses, we'll notify you in advance.
You are still using your registrar's Name Server.
Change it to AWS Route53 name server.
Just adding the name servers to the registrar's website, brought my domain up and running.

Cannot set custom domain name with Route 53

I have a custom domain name, let's say example.co.uk. I originally purchased it through 123 Reg but have now transferred to Route 53. I have setup a Hosted Zone for that domain name.
I have been looking at many guides but for the life of me I cannot set the custom domain name, I can only access my site through the Elastic IP.
How can I get this to work?
Did you fully transfer the domain to Route53 or did you just change the name servers in 123reg to point to the Route53 name servers? If you fully transferred the domain, make sure you update the name server records in the Hosted Zone to match the name server records listed in the Route53 Registered Domains section.
To point your domain to your server you simply need to create an A record in the Hosted Zone that points to the Elastic IP. You also could have done that in 123reg without using Route53 at all.

How can I create a subdomain in AWS Route53 when the parent domain is also configured in Route53?

I have one domain name registered in an AWS Hosted zone. It comprises of 5 records viz A, SOA, NS (4 ns addresses), MX and CNAME. But now, I want to create a Subdomain : static.domain.com. I have read Creating a Subdomain That Uses Amazon Route 53 as the DNS Service without Migrating the Parent Domain article from AWS doc but clearly that is not my case. My domain name is configured in the Route53 itself.
So if I have to create a hosted zone for the static.domain.com and update the NS records in the parent's hosted zone domain.com then I can just do that but I am confused if that's gonna work or destroy my whole configuration!
So guys, please tell me how to create the subdomain static.domain.com when my parent domain domain.com is also in the Route53?
FYI : I am creating this subdomain to serve static content from an s3 bucket which will be configured as an static website and will be aliased against this subdomain static.domain.com so that all static requests are can be fetched as http://static.domain.com/resources/path/to/dir/image.png etc.
Thanks very much
All you need to do is create a record set in your Hosted Zone, for your desired sub domain.
Go to your Hosted Zone
Click the 'Create Record Set' Button
In the dialog that appears on the right, enter your desired subdomain in the 'name' field. If you want static.domain.com, just enter 'static' in the name field.
Choose the Type of DNS Record you want eg, A, CNAME
Enter a custom TTL if desired, enter value(s) for your record and change the routing policy if also desired.
You have two options:
Create records in the existing hosted zone for the domain
Create an additional (dedicated) hosted zone for the subdomain, and create records in this dedicated hosted zone.
Both are explained below.
Option 1 (without a dedicated hosted zone)
In this case all we possibly can do is to change the list of the DNS records. And I believe primary record types to be configured are:
The A record type. It's like a [domain name to IP address] record.
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html#AFormat
or the CNAME record type. This one is like a [domain name to another domain name] record
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html#CNAMEFormat
Note: NS record should not be changed, its value should remain default and is used as a primary link between the name servers and the hosted zone. The hosted zone itself is kinda named AWS container for DNS records (i. e. a thing that can be referenced within AWS ecosystem).
Option 2
Create a hosted zone that has the same name as the subdomain that you want to route traffic for, such as acme.example.com.
Create records in the new hosted zone that define how you want to route traffic for the subdomain (acme.example.com) and its subdomains, such as backend.acme.example.com.
-> You get the name servers that Route 53 assigned to the new hosted zone when you created it.
Create a new NS record in the hosted zone for the domain (example.com), and you specify the four name servers that you got after step #2.
Option 2 pros: having a dedicated hosted zone provides more flexibility for configuration and managing access to this configuration for other AWS users (IAM permissions). "Flexibility" here can be for example having not the same DNS service used for the domain and for the subdomain
Option 2 cons: "small" performance impact to this configuration for the first DNS query from each DNS resolver. The resolver must get information from the root-domain's hosted zone first and then get information from the subdomain's hosted zone. But there is a caching mechanism regulated by TTL (Time to live) value.
Reference: 'Routing traffic for subdomains'
Mon Oct 24 19:59:40 PDT 2022
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-routing-traffic-for-subdomains.html
See also an option-2-related article: https://aws.amazon.com/premiumsupport/knowledge-center/create-subdomain-route-53/
Hope it helps and is somewhat educational.