Point non-www domain with CNAME Record - amazon-web-services

I am using Heroku for my webapp. After adding a domain, Heroku provides with a url to be pointed to from the domain which looks something like this xxx-xxxx-xxxxxxxx.herokudns.com.
Now this has to be added to my DNS management console as Alias A record or CNAME record. I have options to use either AWS Route53 or Godaddy DNS manager for this. For domain with www.myapp.com, I am able to do this.
But for the domain without www, on AWS Route53, AWS doesn't allow CNAME record to be added for Apex domain (domain without www) in the zone. While trying to do the same as Alias for the A record, it shows error that the value is invalid as the value is not from any of the AWS Services.
On doing the same with GoDaddy, it's not allowing the value '#' in the host field for a CNAME record. And there's no option to add alias of A record.
What are my options here?

Related

How to redirect the root domain to a sub domain in AWS route53?

I'm using AWS route53 as my DNS server.
I have an A Record pointing a webserver for the sub-domain www and CNAME for the root "#" subdomain which points to the www sub-domain, so when I try to get mydomain.com or www.mydomain.com I should get the same result and It works fine in Godaddy DNS and NameCheap DNS servers but in route53 the www record works fine but the # doesn't work and I have to type the full www.mydomain.com for me to get the site back.
In this situation, you don't need to include the # symbol when creating record sets for your domain.
According to the docs,
If you're creating a record that has the same name as the hosted zone, don't enter a value (for example, an # symbol) in the Name field.

Using A record or CNAME for cloud front distribution

My setup: On AWS lightsail Wordpress Instance and lightsail DNS zone
I'm not using Route53. Lightsail DNS zone does not support Alias or ANAM record.
I have set up A record for example.com and CNAME for www.example.com pointing to example.com. I have force redirect http to https
I'm still trying to figure out how the distribution work. How can I best set up the distribution for custom domain name without Alias or ANAM record?
Referring to the screenshot from AWS, If I were to set up A record for example.com to point to default domain werhjk3yfhdsfljdsf.cloudfront.net, will there be any downtime if I were to reset cache, disable distribution or change distribution origin?
If I were to set up an A record or CNAME record for www.example.com to point to werhjk3yfhdsfljdsf.cloudfront.net, do I have to disable force redirect for distribution and google analytics to work?
If your DNS provider does not support Alias/ANAME records then you cannot use CloudFront for your root/ape record (example.com).
You can however use it for any subdomain (e.g. www.example.com), this is done by creating the record itself as a CNAME.
A key difference between A records and CNAME records is that an A record accepts an IPv4 address as the value for its record, whereas CNAME (or canonical name) accepts a domain as its value.
If you disable the distribution, yes there would be downtime as you're disabling it. Other changes are gracefully rolled out to the edge locations so you might experience different behaviour where you are in the world.

Why do we need to create the DNS A record for API Gateway custom domain?

According to the tutorial, after we create a custom domain name for our API Gateway, we need to create a Route 53 DNS A record, which basically routes the traffic to the custom domain name to the target domain. I'm curious why AWS doesn't do it automatically and what happens under the hood when we create the custom domain name.
This section explains it well:
An alias record is a Route 53 extension to DNS. It's similar to a CNAME record, but you can create an alias record both for the root domain, such as example.com, and for subdomains, such as www.example.com. (You can create CNAME records only for subdomains.
First, the DNS record is a special resource record only supported by AWS route 53, and it supports both the root domain, and subdomains. Normal DNS uses CNAME records, which don't work at the root domain.
Secondly, as to why it's not automatically created for you, well I'm not sure. But its easy to do manually. Select the alias record type, and it will bring up the list of available resources to alias.

How to set bare domain CName record to point to S3 bucket without effecting MX record

I have a static site hosted in a S3 bucket and a domain registered at Namecheap (e.g mydomain.com)
I would like people to access my site using the bare domain, (i.e without subdomain)
I added a DNS record like so..
Type = CName
Host = #
Value = [URL to S3 bucket]
This works but now emails to mailboxes on that domain (e.g hello#mydomain.com) don't work. I've read that this is because if a CNAME is used to specify the bare canonical name for a host you are not allowed to have any other resource records (e.g MX) for that host.
How can I get around this? I don't want to resort to adding a subdomain like www.
It isn't a valid configurarion to have a CNAME at the apex of a zone like this. The DNS provider should not even allow you to create it. Yes, it breaks your MX if you try it.
That's why Route 53 introduced A-record aliases. See the link mentioned in comments for an explanation. Alias records appear to behave like what people commonly assume a CNAME does, but they aren't CNAMEs and are not invalid at the apex.
To do this right, you need to use Route 53 as your authoritative DNS hosting provider.
One workaround is to create a bucket with www. at the beginning instead of the one you have now, create a www CNAME pointing to it, and then set your # A record to the value provided by a service like http://wwwizer.com, which redirects example.com → www.example.com.
I am not affiliated with that service but I have seen it used for this purpose.

Cant create CNAME Record in AWS

I have a domain (mydomain.com). I use AWS Route 53 to point this comain to a server hosted on EC2.
I was able to add a CNAME record for 'www.mydomain.com' or 'someprefix.mydomain.com'.
Route 53 has SOA and NS record for 'mydomain.com' and does not allow to add a CNAME record for 'mydomain.com'.
I need this record to be able to type the domain with or without the leading 'www' in the browser.
More important, I plan to run a mail server on the machine and I believe mail clients need to resolve the 'mydomain.com' part of my user email addresses (e.g. user#mydomain.com).
How do I do that?
To make it all hang together...
Set up
A mydomain.com # Sets up your main domain
CNAME www.mydomain.com # Sets up your www domain. (you may want to
redirect one to the other to avoid duplicate content
NS ns.whatever.com
ns2.whatever.com
MX mail.mydomain.com
This is assuming your not using ELB
A CNAME cannot point to the root domain. Same DNS services will allow it, but a CNAME should point to a service on the domain. ie - the www service in the above case.