Static site on S3, DNS in Route53, error on CNAME - amazon-web-services

I am moving several sites to S3 to host them as static sites and have moved DNS here as well. I followed the AWS guide step by step, but continually get an error on the CNAME setup for WWW. Here is my setup:
Created bucket jeremyandlauren.com and set up static hosting and permissions.
Endpoint is now jeremyandlauren.com.s3-website-us-west-2.amazonaws.com and this works fine.
Pointed nameservers for this domain to Route 53.
Created an A record pointing to the Alias Target jeremyandlauren.com.s3-website-us-west-2.amazonaws.com.
Created a CNAME pointing www to jeremyandlauren.com.s3-website-us-west-2.amazonaws.com.
Now when you hit the URL either with or without www you get:
Code: NoSuchBucket
Message: The specified bucket does not exist
BucketName: www.jeremyandlauren.com
Does anyone have any ideas how to fix this? I have tried a couple options for the CNAME, but nothing seems to take.
Thanks in advance.

It looks like jeremyandlauren.com works, however, www.jeremyandlauren.com does not work. The reason you are probably running into this is that your DNS name needs to match your bucket name. You probably do not have a bucket with the name of www.jeremyandlauren.com. There are two way easy ways to fix this.
Create a bucket www.jeremyandlauren.com and redirect it to jeremyandlauren.com. (More info here: http://aws.amazon.com/about-aws/whats-new/2012/10/04/web-page-redirects-on-amazon-s3-hosted-websites/)
Create a CloudFront distribution with the origin of jeremyandlauren.com.s3-website-us-west-2.amazonaws.com. Add www.jeremyandlauren.com & jeremyandlauren.com as a CNAME. Update DNS for www.jeremyandlauren.com & jeremyandlauren.com to be an A type alias to your CloudFront Distribution.
Keep both www.jeremyandlauren.com & jeremyandlauren.com buckets in sync with the same data.

Its working fine for me - both with and without the 'www' if its not working for you, it may be because your dns is cached locally, or the propagation has just not made it to your servers yet - give it time.
If you are using chrome you can try clearing your local dns cache:
Navigate to chrome://net-internals/#dns and press the "Clear host cache" button.

Related

I'm getting ERR_NAME_NOT_RESOLVED from my website

I have a domain that I got from NameCheap: www.app.flerr.io.
I configured the domain in AWS with Route53, CloudFront and S3.
I uploaded the static website to the relevant S3 bucket.
When I try to reach my website, I get the following error: ERR_NAME_NOT_RESOLVED.
Although, when I reach the website through S3 static website hosting it's working:
Any ideas?
EDIT:
Route53:
I have one A record that traffics to <id>.cloudfront.net:
I have one NS record that traffics to 4 NS URLs.
I have one SOA record.
I have one CNAME record.
ERR_NAME_NOT_RESOLVED usually refers to a DNS problem.
You already verified that S3 URL is working correctly.
Now, verify that Cloudfront is working correctly by pasting the Cloudfront URL in your browser (<id>.cloudfront.com or something similar).
If both of them are working, means that your problem is indeed DNS (and therefore Route53) related.
Use any DNS Lookup page to see if your domain (flerr.io) is correctly set up.
https://mxtoolbox.com/SuperTool.aspx?action=a%3awww.app.flerr.io&run=toolpage
With the information given that's the best we can do, if you share your Route53 Hosted Zones we could see if anything is wrong
If you bought flerr.io. - you dont need to create a new zone for app.flerr.io. (you can, but its not required - this is called DNS delegation). You just need to create a record named www.app inside flerr.io. as an A or CNAME to your destination.
When i use dig to test the DNS i get the following results:
dig flerr.io. shows A records
dig app.flerr.io. shows A records - and appears to be its own DNS delegation zone (was that deliberate)?
dig www.app.flerr.io. does not return any records - this is why you cant resolve your site.
I think the solution for you is to create the www.app records in the flerr.io. zone and ignore the app.flerr.io. zone you created. If your trying to use the zone app.flerr.io. (and its been setup properly in flerr.io.) you would just create the www record.

AWS S3 web site ACM Cloudfront: how to redirct to subdomain

My goal is this:
host a website on an S3 bucket
access it via https
redirect requests from domain.com to www.domain.com
So far I have done these steps:
hosted the domain on AWS
created a zone in R53 for that domain
copied the name servers from the zone to the domain
and that all seems to work fine
I think that I have the mechanics of how to create and set things OK.
I attained the same goal in the past so I have some idea of what I'm doing.
And today I kind of have it working: domain.com responds with
files from the www.domain.com bucket
So here, patient reader, is my question:
How do I set this up?
do I need two buckets?
do I need to add the domain and the subdomain to the certificate?
do I need two Cloudfront distributions?
how do I set up Alternate Domain Names in the distribution(s)?
What should the A records in R53 alias?
And one more question: I created an origin request policy when I created the distribution and it worked
will using the origin request policy secure my bucket sufficiently
or will I need to do something else?
Please, thank you, and with my kindest regards,

What am I missing in my AWS Route 53 S3 simple hosting setup?

I've got 5 records in my AWS Route 53 hosted zone:
First is an NS for my domain name.
Second is SOA for that domain.
Third is a validated CNAME for it.
Fourth is cloudfront distribution A alias for it with the www prefix.
Fifth is validated CNAME for the www version.
I don't yet have an SSL attached to it.
It works - well partially.
Trying to reach the unprefixed version of the domain from Chrome doesn't work, but if I type the domain with the www prefix it works.
Firefox automatically redirects the unprefixed domain to the www variant. I type the unprefixed name making sure it's not redirecting because the prefixed name is in the search history. When I hit enter, Firefox automatically redirects to the www.
I'd like the main name to be accessible, not just the www one. It's OK if someone types the www. They should get to the site, but the actual name has no www.
I'm inexperienced enough not to be certain about that www prefix or why it is necessary. This was the result of a long course on AWS services.
Can anyone tell me if I'm missing a needed record, or if I'm improperly using the Alias A record?
Edited to add this below after reading first three answers. Thank all of you who answered for your responses. I do appreciate them. Please see my comments on those answers. --
I'm attaching a screenshot of my Route 53 hosted zone settings to maybe help you get a clearer picture of where I am.
Please remember. I'm not starting with a domain with a site that I wanted to host on S3 and then redirect www.mydomain traffic to mydomain.
I began coding an app with no domain. Then I uploaded it to an S3 bucket. I then was able to access it's simple S3 hosting with the ugly url. Then I used CloudFront for a world-wide distribution, again with an ugly url. Only then did I try taking one of my owned subdomains and redirecting it to Route 53. It wasn't as clean and simple as buying a domain from Amazon. I had no SSL and had to make a request for the AWS Certificate Manager to process validation of my domain. I got all that.
My problem is as I tried to explain - Chrome won't recognize or redirect my main domain name without the www. It only recognizes if one types the www. in front of the domain name. On the other hand, Firefox automatically redirects no matter what you type (the www version or the one without the www). That redirection is to the www version (that is what shows in the url bar in the end - http://www.mydomain).
I think I may have figured out most of this. As I mentioned in my comment above, I noticed I didn't have an Alias record for my main domain. I also read in AWS documentation that my S3 hosting bucket should have the same name as the domain, so I did that.
After creating the new original S3 hosting bucket I had made another to keep the log files. I set up a CloudFront Distribution. Then I requested and got SSL certificates for my owned domain name and added another for the www version. With those successfully enabled, I transferred my registered DNS servers to AWS. That created the NS and SOA records when I created my R-53 hosted zone. I then created Alias records for both the man and www version and added the validated SSL certificates for both the main domain and the www version. So, a total of six records in the zone.
I created my new S3 bucket, naming it the same as my domain; copied the settings from the old one, set it up to host static single page site and generate logs. I had already created a bucket for the logs, so I just pointed the logs location for the new domain named bucket. I gave the regular logs a log prefix (folder) and the CloudFront logs a cdn one.
Everything works great except I discovered a new problem. I'll post a new question regarding that, something like XML error on browser refresh in child pages.
Thanks ALL!

Namecheap domain not forwarding to AWS s3 bucket

I have two AWS buckets
The www one hosts a static website and the # one redirects to the www one.
My namecheap's domain Advanced DNS settings are configured like this
I've waited about 12 hours, but when I go to my Namecheap domain, I get an ERR_CONNECTION_TIMED_OUT
I've deleted all of the original CNAME & A records, did I make a mistake doing this?
What am I doing wrong?
As #stdunbar suggested:
It seems to be working fine - perhaps you've got the old address
cached in your environment.
I cleared my cache and it now works without any problems!

AWS S3, CloudFront and SSL

I have tried setting up a static hosting solution for our web platform by using AWS S3 and CloudFront. It is required to use https, and it needs to be accessed via a custom subdomain.
This is my S3 bucket:
These are the settings for the CloudFront:
The certificate settings look ok to me:
And finally my DNS record is like this:
CNAME: "static" -> "d1fd407fp9coo4.cloudfront.net."
edit: using my default domain provider for DNS, not Route 53.
The aim is to have the resource available at static.dmaglobal.com/logo-frontpage.png via https. It loads fine without (http://static.dmaglobal.com/logo-frontpage.png), but the https-version (https://static.dmaglobal.com/logo-frontpage.png) gives an SSL-error stating the current certificate is for *.s3.eu-west-2.amazonaws.com instead of *.dmaglobal.com. I do not understand where this mismatch comes from, as it seems like the current certificate is correctly set up for our custom domain.
Anyone able to give some pointers on how to proceed from here with this issue?
As you have noticed your DNS record resolves to S3 still.
Instead of CNAME you should create an ALIAS record to Cloudfront distribution. In static record pick A type record, check Yes for Alias and pick the Cloudfront distribution on the dropdown.
The reason for this: ALIAS records are free of charge and they resolve faster.
To answer my own question: In the end, it was the proper CNAME value that had not propagated properly yet (as it was initially pointing to S3 before I was aware that CloudFront was required for SSL). As soon as it was, the settings in the OP worked perfectly.