AWS: I can't link my route 53 configuration to my S3 bucket - amazon-s3

I have 2 route53 hosted zone, let's call them myfirsturl.com and mysecondurl.com.
For both of them, I have created a bucket in S3 named after my domain names. I have verified it multiple times letter by letter.
Both of my buckets have static content, available from the S3 endpoint, with the fine policy etc: the 2 endpoints work perfectly.
The 1st hosted zone has been bought in route53 and when I connect to it, it opens my static website, all is good.
My second domain name has been transferred to Amazon last month, and in route 53 I can find the S3 bucket in the list of targets when I create the recordset, but it doesn't reach the static website
Another point: I have created a WP site a few days ago, behind a load balancer etc, and I linked wp.myfirsturl.com to it: it worked perfectly
I tried the same with wp.mysecondurl.com, to the same load balancer, it never worked.
I can't find any idea has I can't see any difference between my 2 domain name, except where I bought it.
Another difference:
The 1st is something like sometexte.info
The 2nd is something like sometext-othertext.fr
Maybe the hyphen is a problem? (it's not, pertaining to the doc)
Someone has a lead, please?

The bucket must have the same name as your domain or subdomain in Route53. For example, if you want to use the subdomain acme.example.com, the name of the bucket must be acme.example.com. Have a look at this documentation for more information.

Related

Setting up a custom domain with Amazon S3

I bought a domain name through iwantmyname.com and got stuck setting up the static website hosting though S3 when following this guide: http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
What I want is to set everything up so that when someone goes to mydomain.com they see my index.html file hosted on S3 and the URL should not change to something else like mydomain.com.s3-website-us-west-2.amazonaws.com I just want it to be mydomain.com
I got stuck on everything past Step 3.2 where it has me configure the Route 53 stuff. Does anyone have a better step by step guide for this? Amazon didn't do a very good job, possibly on purpose to entice people to buy their support.
Figured this out on my own. Here is what needs to be done:
buy your domain, example.com
go to the Amazon S3 console and create a bucket named example.com
add your index.html file to it and provide read permissions
enable static website hosting for the bucket, using example.com in the field
go to the R5 routing part of the console and add a Type A record set (IPV4)
Select Yes for Alias and choose the endpoint from the drop down, it will be something like
example.com..s3-website-us-west-2.amazonaws.com
Hit 'Create'
Go back to Hosted Zones and click the example.com zone, on the right you will see 4 namespaces that look something like this:
ns-XXXX.awsdns-54.org
ns-XXX.awsdns-15.com
ns-XXXX.awsdns-45.co.uk
ns-XXX.awsdns-27.net
Copy these namespaces to a notepad or something
The Amazon side is now configured, we just need to do the domain side, so in my case I went to iwantmyname.com
Go to edit namespaces, and change them to the ones you copied from step 8
We're done! Just be patient as it does take some time to configure all of this. In my case it took about 15 minutes. You can ping the website or use nslookup to check up on the progress through your console:
ping example.com
nslookup example.com
pinging is inferior to nslookup with S3 since Amazon blocks them

MX record and Amazon S3

I'm having an issue with setting up my Google Apps account.
I believe that my S3 bucket is causing the problem.
I configure the MX records like Google asked me to and today mij DNS providers acknowledged that the records where propagated.
Now when I try to continue the setup of my Google Apps account it's stuck and doesn't provide any info. I have hosted a a static website on a Amazon S3 Bucket.
Trying to see if the MX records are available I used this tool MX Toolbox
to see if my MX records where available but they weren't. Anybody with the same problem or some professional advice?
BTW: the domain name is xntriek.be
What I suspect you will have to do is as follows:
1.) change the settings at your DNS registrar to use a different name server. For my registrar, namecheap, I go to manage -> transfer Name Server to 3rd party (or some variant) -> (leave this screen up - there should be a set of 5+ blank records)
2.) Set up Amazon Route 53.
3.) "Create Hosted Zone" for your domain name in the Route 53 console
4.) This hosted zone should be associated with a "Delegation Set" (right side of R53 console) - 4 records which you will paste into the screen you found in (1) above.
5.) Save that, and configure Route 53 as you would have configured records with your DNS provider. (CNAME aliasing and mx forwarding)
The reason this must be done in R53 and not at the Registrar is that setting the cname record alias to, say, www.yourdomain.com.aws.us-east.amazon blah blah blah tells mx traffic to go to amazon for instructions about what to do. Of course, there are no further instructions for that traffic if you have not set up Route 53.
I hope this helps!

How to setup CNAME for Amazon S3 at Namecheap

I am using amazon S3 to host one of my static sites and wanted to link it to my domain name (domainname.co.uk). So I went into namecheap account-all host records and did something like this,
However, It still doesnt work and throws 404 when I go the website url. By the way, under the "www" option, I am using my S3 url like this, conxxxxxxxxxxx.co.uk.s3-website-eu-west-1.amazonaws.com..
Notice the dot in the end, which is automatically added by Namecheap whenever I try to save, even without the dot. I am not sure if that's causing the issue but it just doesn't work for me.
Going directly to my AWS URL works fine, which implies that something is wrong with my CNAME setup.
Anyone know what am doing wrong here? Namecheap support had absolutely no clue either.
You can only use custom CNAMEs for Amazon S3 if the bucket name matches the CNAME.
For example, if your bucket is named:
files.example.com
and is therefore accessible by default at:
files.example.com.s3-website-us-east-1.amazonaws.com.
A CNAME from files.example.com to the full bucket domain name will allow you to use your custom domain.
However, if your bucket name is not exactly the same as the CNAME you are trying to define, it will not work. In your screenshot, you are trying to use www.... as your CNAME, but the (redacted) bucket name does not contain www.. Note that "exactly" includes case-sensitivity; your bucket name must be all lowercase for a CNAME to work.
The full documentation of this feature is here: http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html#VirtualHostingCustomURLs
If you want/need multiple CNAMEs, and/or a CNAME that does not match the bucket name, Amazon CloudFront allows you to specify arbitrary CNAMEs for a deployment.
Its been a while since this questions was asked , but if anyone looking for NameCheap CNAME setup for static website in amazon AWS s3 bucket then please refer screenshot below.
This setup for AWS S3 bucket hosting + NameCheap DNS record is working for me as of Jul 2019.
This setup is for pointing AWS S3 static website endpoint to your custom domain in NameCheap.
Please note if you are using AWS CloudFront SSL certificate then your CNAME record value will be the CloudFront domain name ( not the static website endpoint).

Is it possible to setup DNS for s3 using multiple buckets for a single domain?

Is there a way to use another bucket name when hosting a site (or indeed any content) than just www.example.com.s3-region.amazonaws.com? I want to use multiple buckets so that when I update the site I can rollback a version if problems arrise and so that updates are an atomic switch between site versions. I only want one bucket used for a domain at a time.
I.e. something like
Bucket Names:
www.example.com.bucket1
www.example.com.bucket2
Procedure:
www.example.com currently points to -> www.example.com.bucket1.s3-region.amazonaws.com
New site version is uploaded to www.example.com.bucket2.
Once verified DNS is changed so that www.example.com points to -> www.example.com.bucket2.s3-region.amazonaws.com
This should not work because S3 looks at the hostname of the request (www.example.com) to find out what bucket you're trying to access so the bucket has to have the same name.
But it is possible to achieve what you want with Amazon CloudFront. There are two options:
You can create a single distribution and only update the origin of it (the S3 bucket).
You can create two different distributions and update the DNS settings to point to the desired distribution. You would also need to update the CNAME properties in both of the distributions (remove www.example.com from the old distribution and add it to the new one).

Cloudfront dist on top level domain

Is it possible to point a top level domain like http://example.com to a amazon cloudfront distribution?
I know it's possible with CNAMEs, but as far as I know, I need to set an A-name record for the top level domain in the DNS settings.
As explained by #dgeske, this can be done.
In my case, I had not purchased the domain from Route 53, and hence had to do extra configuration.
Scenario: You have the following
Cloud front distribution
A second-level domain (example.com) not purchased from Amazon Route 53. It was Google domains in my case, but the idea will work for other providers also.
You want to point the second-level domain (example.com) to the cloud front distribution (as opposed to a subdomain like www.example.com)
Your nomenclature is slightly inaccurate. example.com is not a TLD (top-level domain), it is what is called a second-level domain. See the following image.
Steps to do this.
Create a hosted zone in Route 53.
Route 53 will now give you a list of name servers that you have to set in the domain settings panel of the provider from which you purchased the domain (Google domains in my case).
Go back to Route 53 dashboard, and create an A - Alias record for this hosted zone (use create record set option). Remember to select 'Yes' radio button. Make sure you leave the subdomain part empty (since we are only interested in creating record for second-level domain).
Now you should be able to access your cloudfront distribution at http://example.com.
Depending on your DNS server, it may take a while to get records updated.
You may configure your system to use a public DNS server such as 8.8.8.8 to verify if you are able to access the cloudfront distribution using the URL. I used firefox's DNS over https feature for this. This makes firefox use cloudflare's (not cloudfront) DNS servers. You can also use dig command line utility dig #8.8.8.8 example.com (My domain was fightcoronapune.com, hence, dig #8.8.8.8 fightcoronapune.com) (telling dig to use 8.8.8.8 DNS server to resolve names)
You may additionally get Access Denied error, in which case you will have to configure the default root object for your cloudfront distribution. So that when you visit http://example.com the file http://example.com/index.html is served to you (assuming you specified index.html as default root object). This error has nothing to do with the steps we did above, and you will still get this error even if you directly use your cloudfront distribution's URL given by Amazon (eg. when you go to http://abcd.cloudfront.net directly, instead of going to http://example.com).
Q. Can I point my zone apex (example.com versus www.example.com) at my Amazon CloudFront distribution?
Yes. Amazon Route 53 offers a special type of record called an ‘Alias’ record that lets you map your zone apex (example.com) DNS name to your Amazon CloudFront distribution (for example, d123.cloudfront.net). IP addresses associated with Amazon CloudFront endpoints vary based on your end user’s location (in order to direct the end user to the nearest CloudFront edge location) and can change at any time due to scaling up, scaling down, or software updates. Route 53 responds to each request for an Alias record with the IP address(es) for the distribution. Route 53 doesn't charge for queries to Alias records that are mapped to a CloudFront distribution. These queries are listed as “Intra-AWS-DNS-Queries” on the Amazon Route 53 usage report.
Source: Amazon Route 53 FAQs
My understanding is that you cannot create an A record for Cloudfront.
Amazon provides you with a domain name like YourName.cloudfront.net. They need to manage the DNS resolution for that domain name behind the scenes in order to route each request to the nearest edge server.
you can if you add alias in cloudfront
then select A or AAAA(ipv6 if enabled on cloudfront)