AWS Route53 Error, trying to CNAME domain name to loadbalancer dns - amazon-web-services

Situation:
I have one loadbalancer which is serving a kubernetes cluster, and it has a dns name
I have my website domain, registered in route53 zone, and want to CNAME this to the dns of the loadbalancer
The initial records of the zone right after creation are:
Then I try to add the CNAME record of pointing mydomain.com to the loadbalancer DNS, and get the error shown in image:
My question is now:
How can I use mydomain.com to access the loadbalancer ? and still manage the dns records with route53 (i have other records for cdn etc in real domain aside root one that want to use for the loadbalancer serving the website)

I think that for this AWS specific solution, can use ALIASES instead of CNAME records to point the domain to a particular AWS Resource (loadbalancer in my case).
Aliases are DNS extensions for AWS system only
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html
Still this is very interesting question, and assuming no alias was possible, does it mean that you never can CNAME your bought root domain to some other domain ?

Related

How to route traffic from the Cloudflare root domain to an AWS elastic load balancer?

My Webservers are running on AWS.
I have created target groups and the load balancer.
I have the ALB domain but I want to customize that DNS to the Domain that is present in Cloudflare.
I wanna know how I can do that with the SSL certificates.
As I am not allowed to give CNAME records for the root domain. what are the other solution for this.
how can I route my traffic from the application load balancer to the domain present in Cloudflare?
CloudFlare has CNAME Flattening, which allows CNAME records on the root domain.
Here's my solution.
First we need to go to Route53 in aws console to create new hosted zone.
Then after we create the new hosted zone as per our given details, it will create an NS and SOA record in the R53.
WE need to add those NS records in our domain registrar. and then we need to create an Alias to our DNS which will Point to the ALB.
That's how we are able to create our customized domain name for the Application Load Balancer.
By Creating a hosted zone in R53 and adding the NS records to the domain registrar, we can delegate the DNS resolution of our custom domain to route53. Then by creating an alias to our ALB, we can map the custome domain to the ALB's DNS. This will allow us to access our ALB with our custom domain instead of using the ALB DNS.
IF THERE'S ANY OTHER SOLUTIONS THAN PLEASE FETCH YOUR ANSWERS.

How to use custom domain for ALB in front of ECS Fargate?

I have a couple of ECS tasks running in Fargate behind an ALB. I want to use a custom domain for the ALB so I created a hosted zone and an A record that points to the ALB but when navigating to the record name I get the "This page isn't working error". Is it mandatory to register the domain via the Route 53 or any other registrar or is the hosted zone and record enough for it to work? We have other ALBs with custom domains and when I navigate to the url the site comes up just fine. Settings look like mine so I am not sure if those are using a different registrar, which my hunch says they do.
Thanks for the help!
Is it mandatory to register the domain via the Route 53 or any other registrar or is the hosted zone and record enough for it to work?
The hosted zone is not enough for it to work. You absolutely have to register the domain with a domain registrar. You have to own the custom domain you are trying to use. You can use any registrar, not just Route53. You have to configure your Route53 hosted zone's NS records with the domain registrar before the hosted zone will work.

How can I point the root domain to Elastic Beanstalk?

I am trying to use the domain I just purchased in Route 53 to point to an application running in Elastic Beanstalk exy.elasticbeanstalk.com
If the domain I purchased is example.com and I want traffic to point to my application in Elastic Beanstalk, How can I achieve this?
So going to example.com launches the exy.elasticbeanstalk.com
In Route 53, alias records can be used at the root domain (also known as the zone apex) to refer to an Elastic Beanstalk Environment.
From Choosing Between Alias and Non-Alias Records:
Amazon Route 53 alias records provide a Route 53–specific extension to DNS functionality. Alias records let you route traffic to selected AWS resources, such as CloudFront distributions and Amazon S3 buckets. They also let you route traffic from one record in a hosted zone to another record. Unlike a CNAME record, you can create an alias record at the top node of a DNS namespace, also known as the zone apex. For example, if you register the DNS name example.com, the zone apex is example.com. You can't create a CNAME record for example.com, but you can create an alias record for example.com that routes traffic to www.example.com.
See https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html
For for more details regarding Alias records and Elastic Beanstalk see https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-values-alias.html#rrsets-values-alias-alias-target

Getting root to point to AWS ELB without using AWS nameservers

I've set up my application on AWS Elastic Beanstalk. I added a load balancer and pointed a CNAME for 'www' to it. But now I need to get root pointed there too. I can't use Route53 and use AWS nameservers because the client wants to use theirs. How can I get root to my app? Can I redirect the traffic? The tech lead I'm working with suggested setting up a server to do the redirect?
Since AWS ELB's only offer DNS Record (Instead of IPs) you need to use a CNAME mapping. However with DNS, CNAMEs do not allow root domain to point to it. To overcome this AWS has provided Alias Records (Custom implementation to AWS) to point root domain to ELBs.
If your client want to use their nameservers still you can use, AWS Route53 in between to solve this with following steps.
First create a Public Hosted Zone in Route53 for your domain.
Then create a record set inside the Hosted Zone for the root domain to point to the ELB with Type = A - IPv4 Address, Alias = Yes with ELB CNAME as for the Alias value.
In the external domain management service, create a NS record to point the root domain to Route53 nameservers.
Then when the DNS resolution happens, the root DNS query will first go to external nameservers(Managed outside of Route53) and then it will be forwarded to route53 where it will resolve the ELBs IP address and sent back.
You can set up a machine with a single static IP address that does nothing but redirect requests to the www host. Then you can put an A record on the bare domain at the apex of the DNS zone pointing to that machine.
There is at least one service, http://wwwizer.com/naked-domain-redirect, that will do this for you. (I'm not affiliated with this service, but it appears to do what it claims and will serve your purpose. There are probably others like it.)
Ideally, though, you'd persuade your client to change the authoritative nameservers to point to a Route 53 hosted zone that you create for them. They are still the registrant and "owner" of their domain, and can take control back from you by simply changing the nameservers to something else.
I generally persuade clients with the explanation that our load balancer infrastructure is integrated with the DNS servers so that if a balancer node fails, or we need to add or scale up capacity, or experience a traffic surge or DDoS event, the load balancer system will automatically update the DNS records for their domain to try to mitigate the issue and keep the site up. To do otherwise is to do things in such a way that removes those layers of redundancy.
Ideally, you can set up a apache server with a static IP, and install a free SSL certificate on that web server at first.
Second you need to redirect your root domain name request to AWS ELB.
Then go to your DNS management and set up your apex point to the server you created.
It is now possible to setup a Network Load Balancer and allocate one or more Elastic IP Addresses to it (one per Availability Zone). The Network Load Balancer can have an Application Load Balancer as a target. The Application Load Balancer would target the Elastic Beanstalk. An A record can then be created in the external DNS for each Elastic IP Address of the Network Load Balancer.
If you don't need the functionality that the Application Load Balancer provides, you may be able to target Elastic Beanstalk or whatever application directly from the Network Load Balancer.
Since AWS ELB's only offer DNS Record (Instead of IPs) you need to use a CNAME mapping. However with DNS, CNAMEs do not allow root domain to point to it. To overcome this AWS has provided Alias Records (Custom implementation to AWS) to point root domain to ELBs.
If your client want to use their nameservers still you can use, AWS Route53 in between to solve this with following steps.
First create a Public Hosted Zone in Route53 for your domain.
Then create a record set inside the Hosted Zone for the root domain to point to the ELB with Type = A - IPv4 Address, Alias = Yes with ELB CNAME as for the Alias value.

AWS ELB and GoDaddy Domain working

I have registered a domain in goDaddy.com and want the traffic to be sent to AWS route53. I have a ELB created I did the following steps
In Route 53, created a HostedZone for my godaddy domain name which in turn gave me a NS record with 4 amazon DNS server names and an SOA record.
Created a new "A" record with just the naked domain and Aliased it with Elastic LB
In godaddy , in DNS management, If I use the ELB DNS name for "A" record, I get an error "Enter a valid IP address" where as if I give the EC2 public IP address for "A" record , I can see the index page . I have still not given the 4 NS record DNS server names in godaddy.
Questions :
How do I use ELB instead of using EC2 Public IP.
If I use the NS values, does that means the domain is ported to AWS Route53 and I will be charged every month at AWS? If I use the EC2 IP address only in goDaddy ,then I will not be charged by AWS ?
Hope I am clear on my question, if not please let me know I can explain further
First of all AWS ELB does not provide a A record with an IP address and instead it provides a CName. Unfortunately a CName cannot be mapped to a naked domain in DNS configurations and as a work around, AWS provides an Alias for A record.
However using Godaddy DNS, Alias to AWS resources such as ELB is not possible which limits using naked domain mappings to ELB. Therefore you need to delegate DNS management to Route53 hosted zone(Or atleast for the naked domain) having the name server forwarding which cost you around $0.5 per hosted zone month for the first 25 hosted zones.
Since an IP address is available for an EC2, if you directly point an A record in Godaddy, it won't cost for DNS at AWS.