Redirect to domain from subdomain (AWS, Route53) - amazon-web-services

I have a hosted zone for my www.example.com domain (Route53), and I have a subdomain.example.com subdomain. I've bought another domain www.domain.com and I want my subdomain.example.com to point to www.domain.com. Is there any way to do that without adding another hosted zone for www.domain.com?

Just go to hosted zone www.example.com ; create a CNAME record for subdomain.example.com and put value as www.domain.com

From my understanding, you currently have an AWS Route 53 hosted zone named 'www.example.com' and a subdomain under this hosted zone with the name of 'subdomain.example.com.' You have recently purchased another domain (www.domain.com) and want to have your subdomain (subdomain.example.com) point to 'www.domain.com.'
Depending on where you purchased the 'www.domain.com' will result in two different solutions.
Solution #1: You purchased 'www.domain.com' from AWS
Make sure you have a hosted zone created for this domain [1].
Create an "A Record" using the "Create Resource Record Set" button when inside the 'www.domain.com' hosted zone. You can leave this as 'www.domain.com' as the name, and for the alias/value of this A Record, you will point it to the EC2 Instance that is running your site [2]. (If you are pointing your web site traffic to go through and ELB, S3 bucket, etc.. then you can follow this link below [3])
Go to the hosted zone for 'www.example.com' and make sure your subdomain (subdomain.example.com) is using a CNAME record. If not, then you will need to delete this resource record and add a new one with the same name and for the value, you will put in 'www.domain.com'.
Once this is complete, then you can verify that this is working as intended by placing 'subdomain.example.com' in your browser and seeing if it redirects to 'www.domain.com'. You can also run a dig [1] curl command to see if you are able to pull up the site and resource record information.
Solution #2: You purchased 'www.domain.com' from somewhere else that was not AWS
Make sure you have your hosted zone has the subdomains you want to use (such as 'www.example.com) to use the CNAME of 'www.domain.com'.
Update your NS record for the parent domain 'www.domain.com' to use the NS records that are for your Route 53 hosted zone 'www.example.com' (there will be 4 of them) [5].
If you run into any issues with what was stated here, then please let us know where you bought www.domain.com and what you are currently seeing as the issue with any results you can provide.
[1] http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingHostedZone.html
[2] http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-ec2-instance.html
[3] http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-aws-resources.html
[4] https://www.digwebinterface.com
[5] http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingNewSubdomain.html#UpdateDNSParentDomain

While #Deepak's answer works, you'll probably need to create a hosted zone for www.domain.com
One solution is to go to the DNS settings of your domain from your domain provider (if it's available), and add A Name records for it.

Related

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.

how to point AWS Route53 subdomain to AWS Lightsail instance?

I have setup a Wordpress on Lightsail, and have created a static IP which I can access WP ok.
I have migrated my .co.uk domain across to Route53 from another provider and am trying to point blog.example.co.uk to my Lightsail instance.
In Lightsail I have setup a DNS record like this:
A example.co.uk 12.34.56.78
A blog.example.co.uk 12.34.56.78
It then lists these DNS servers in Lightsail:
ns-849.awsdns-42.net
ns-1643.awsdns-13.co.uk
ns-341.awsdns-42.com
ns-1516.awsdns-61.org
I've taken those DNS servers and set on the root of my domain in Route 53 under Domains > Registered Domains
I am not sure if that was the correct thing to do, as I will have other subdomains eventually that will point elsewhere, should the Lightsail DNS servers be added at that level? If not, what do I set them back to be?
I have also created a Route53 Hosted Zone, and have created an "A" entry that links blog.example.co.uk to 12.34.56.78, is that required?
As mentioned in the comments, I was facing the same challenge.
What ended up working for me was simply creating an Alias Record (A) for my subdomain, subdomain.example.com, that points to the static IP of my Lightsail instance.
I did not add Lightsail's DNS servers anywhere on Route53.
I made sure that the NS entries for my root domain – example.com – pointed to the Name servers entries on my registered domain in Route53.
You can find the name servers associated with your Route53 registered domain by going to Registered domains > mydomain.com; they're located on the upper-right corner.

Lightsail instance works when you hit http://[domain].com, but not www.[domain].com, using Route 53 as DNS

I'm pretty new to DNS and this is the first time trying to connect a domain name to an IP, so I'm not sure what I'm missing here. I tried connecting both the www and non www NS records to the Lightsail name servers but only the non www option seems to be working. When I try to hit www.[domain].com, I get unresolved hostname. I also added an A record in each hosted zone that points directly to the IP and I'm not sure if they actually did anything, but I can only access the site from the IP or from http://[domain].com. I appreciate any help you guys can give me, hoping its something small.
Here is an album containing my hosted zone and each zone's settings
I think you don't need to use two separate hosted zone for www and the apex domain (non-www). You can have a single hosted zone and create resource record set for www and the apex domain using CNAME or Alias records. Since you already have an A-record for example.com, in the same hosted zone you can create a CNAME record for www.example.com and point it to example.com
Regardless, for the domain not found, it could be due to the TTL.
Hope this helps.
More information:
http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html#CNAMEFormat
http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-values-basic.html#rrsets-values-basic-ttl

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.

AWS Route 53 do I need two hosted zons one form domain with WWW and another wihtout?

I have problem with proper configuration of route 53.
I configured it as described here do I need route53 to bind domain to ec2? and for mydomain.com it works, but for www.mydomain.com not.
I created two hosted zones, is it the right way, or it is possible to be done with one configuration?
You only need to use one hosted zone for mydomain.com and just make sure that you add a record set of type CNAME with name set to www.mydomain.com and value mydomain.com. You can find more details in Creating and deleting resource record sets of the AWS documentation