AWS Route 53 setting www prefix - amazon-web-services

I want to host a site on Amazon S3 servers (and use Route53 as a DNS).
I followed the tutorial from AWS page: https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html.
Say, that my website is ex.ample.pl. I want it to be reachable from ex.ample.pl and www.ex.ample.pl.
What I did:
in S3 created bucket for ex.ample.pl,
in S3 created bucket for www.ex.ample.pl and redirected it to ex.ample.pl,
in Route53 created hosted zones for ex.ample.pl and www.ex.ample.pl,
for domain registrar I gave NS records for ex.ample.pl,
in Route53 in zone www.ex.ample.pl settings are like in
this picture . NS are not like in ex.ample.pl
As an effect, I can access the site at ex.ample.pl, but I can't at www.ex.ample.pl. Bucket redirection works for sure, there must be some error in DNS setup. Do you know what may cause this problem?

Related

Route traffic to S3 hosted static website

Have two aws account.
Account-1 is having hosted zone abc.io
Account-2 contains the S3 bucket with static website.
How to create record set in Route53 in Account-1 so that my.abc.io routes the traffic s3 hosted website on another aws account.
You can create a DNS CNAME record in Route53 in your Account-1 for my.abc.io to a value of BucketName.s3.Region.amazonaws.com. where BucketName is your bucket name and Region is the region of the bucket.
This will let any caller redirecting DNS queries against your Route53 hosted zone towards Amazon's S3 DNS records, so this solution works on a DNS-level (not e.g. on HTTP redirect level).
Please note that a CNAME DNS record is just a textual value, that you can point to any domain name (even www.google.com). The value of a CNAME record does not need to be related to anything in your Account-1 or even anything related to an AWS resource anywhere.
Using a DNS CNAME record is just a way to tell a DNS requestor "hey, when you requested an A record for my.abc.io what you actually should be doing is requesting an A record for BucketName.s3.Region.amazonaws.com."
And AWS S3 buckets have a canonical naming scheme for their domain names.
See for further information:
https://docs.aws.amazon.com/AmazonS3/latest/userguide/WebsiteEndpoints.html#website-endpoint-dns-cname
https://docs.aws.amazon.com/AmazonS3/latest/userguide/VirtualHosting.html#VirtualHostingCustomURLs
You can create the HZ my.abc.io in the account with the website and create a NS record in the account with the top domain to it and set the values to the same as the NS record in the HZ in the account with the website.
After this you create all the records needed to route the traffic to your site in the account with the site. This design I think keep the accounts HZ cleaner and easier to read/follow.
I have been using this design and really need to do so due to that we not only have one account that we have connected to the "top domain account".

AWS S3 and route 53 not propagating

I purchased a domain on uniregistry (ka.beer) and I want to set it up to use S3 for hosting and using route 53 for the DNS.
Steps I have taken so far:
Create hosted zone on route 53 with the name of the root domain (ka.beer)
Taken the NS records generated from this zone and updated the NS records of the domain on uniregistry, verified that this is propagated correctly using whatismydns.net
Created 2 buckets with names ka.beer and www.ka.beer in S3
Set up the root bucket to be public using the bucket policy and uploaded a test index page
Set up both buckets for static web hosting, with the www bucket to redirect to the main domain
Created A records in route 53 for ka.beer and www.ka.beer as aliases with the alias target to be the S3 zone (s3-website.eu-west-2.amazonaws.com.)
Now what I want is when I visit www.ka.beer, for it to redirect to ka.beer and when I visit ka.beer for it to show the website uploaded to that S3 bucket and to keep the same domain name
What happens currently: www.ka.beer does not resolve and ka.beer redirects to ka.beer.s3-website.eu-west-2.amazonaws.com
Thanks
Very frustrating issue but it turns out that the nameserver records were cached on my router. Clearing local cache and using incognito did not solve the problem, I had to log in to my router and reset the cache on there and then it started resolving correctly.
It looks you were doing the AWS Example: https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
If that's the case, check your Route53 entries. The domain name should match the S3 bucket name.
ka.beer A http://ka.beer.s3-website-us-west-2.amazonaws.com
www.ka.beer A http://www.ka.beer.s3-website-us-west-2.amazonaws.com
have a look on below steps.
Login into aws console
I am assuming you have set your project on your public ip of EC2.
Go to the Route 53
Under DNS management: Click on Hosted zone
Create the new Hosted zone with specific domain(your domain)
After successful creation of hosted zone you will see NS and SOA entries with your domain name
Copy all the nameserver from here and update it under your domain DNS setting (Domain provider eg godaddy etc).
Note: Domain setting : You can visit here under your domain provider
After updating nameserver in your domain provider. It can take time for updation.
After that create A record under hosted zone under Route53 and assign the bucket or EC2 instance.
After some time your domain with point to that instance

Routing domain hosted in third-party to AWS S3

I am trying to direct a URL request to an AWS S3 bucket.
So far I have done the following:
Create a bucket with the name app-name.app (domain is .app)
Make the bucket public and set property as a static website.
Website works fine when directly accessed through the S3 ARN.
Now I need to direct my (Godaddy) hosted domain name to this S3 bucket.
These are the steps I've taken:
Create a hosted zone in Route 53
Create record sets for A, NS and SOA types.
This is how it looks like:
After that I set the same NS server names in to Godaddy domain. I then also received an email from Godaddy stating that the nameservers have been changed.
However, I am not able to access the site through the domain name. It times out.
Appreciate some help figuring out what step I am missing.
Thank you.
1-Make sure your DNS changed correctly, by ping and trace.
2-Use DNS tools like mxtoolbox to check the records.
3-Add CNAME record with your S3 website public URL(It's different as S3 general URL), for example, add www.

Domain name setup with AWS S3 bucket with static hosting

Im trying to link my domain name to a static website on aws S3
I have 2 buckets set up on S3 one is domain.com and the other is www.domain.com. doamin.com has static website hosting enabled
www.domain.com redirects to the domain.com
I can access my index page through: https://s3.us-east-2.amazonaws.com/domain.com/index.html
but it doesn't work with this url and I get an access denied message: https://s3.us-east-2.amazonaws.com/domain.com
I have 2 host records both are CNAME:
Host: #
Value: www.domain.com.s3-website-us-east-2.amazonaws.com
Host:www
Value: domain.com.s3-website-us-east-2.amazonaws.com.
In my browser it says "site can't be reached" when I have either of those cname values as my url. Also my domain is registered with NameCheap and I can't transfer it to route 53 as it is not old enough. I've never done this before so I really don't understand what I'm doing wrong.
You don't need to transfer the domain to AWS. All you need to do is create a hosted zone in AWS route 53. What you're going to do is set up a new DNS configuration inside AWS and then tell your registrar (NameCheap) to use the AWS nameservers.
Create the hosted zone with your domain name, domain.com
Create an A record for your domain. On the right side you'll see a radio button "Alias" choose yes, then click into the target box and wait for your bucket to appear under S3 Website endpoints. (More on this below).
Select your bucket and click create.
Head over to your registrar, NameCheap and configure the nameservers to use the AWS nameservers in the NS record from your AWS hosted zone.
In order for this to work you need to make sure your S3 bucket is named and configured correctly.
Your bucket name must match the domain name.
In the properties tab, you need to enable the static website hosting option and provide your index page.
In the permissions tab, click on bucket policy, then click the policy generator link at the bottom.
In the policy generator, select S3 as the type of policy
Set the principal to *
set the action to Get Object
set the ARN to the ARN for your bucket /*. For example arn:aws:s3:::domain.com/ *
Click Add statement, then generate policy and paste that into the bucket policy and save.
Finally upload your assets and you're done
Also my domain is registered with NameCheap and I can't transfer it to route 53 as it is not old enough.
You don't have to transfer it... the registration is locked, but the name server settings should not be... so you can use namecheap as registrar and still use Route 53 as authoritative DNS. And that is what you need to do. (You can transfer the registration to the Route 53 Registrar later, or never. Route 53 provides the two services, registrar and hosting, separately.)
Configure a new hosted zone in Route 53, configure it appropriately, and then change the authoritative nameservers at Namecheap to use the 4 nameservers that Route 53 assigned to your hosted zone.
It isn't possible to use S3 at the root (apex) of a domain that isn't hosted in a Route 53 hosted zone, because a CNAME at # is simply not a valid configuration. Some people will argue to the contrary, and some DNS providers even allow it, but it is still an entirely invalid configuration. This is why Route 53 introduced Alias A records. They are valid at the apex of a domain, and solve this issue.
Needed to have basicDNS on NameCheap and use www.domain.com as my main bucket and have domain.com redirect to the main bucket

Add www subdomain to S3 and Route 53

I have followed this article: http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html#root-domain-walkthrough-s3-tasks but I am unable to get my www domain to resolve.
I have completed the following:
Created two s3 buckets named after my domain. My content is in the www bucket which is configured to host a site and is functional from the aws endpoint. The apex bucket is configured to redirect to the www bucket and it is doing that correctly.
I have also created 2 hosted zones and given each of them an Alias record that points to their respective buckets.
Lastly, I have configured my domain (registered though Route 53) to point to the namespace servers that my apex hosted zone gives me.
At this point, everything is redirecting properly but my www domain does not resolve. I tried adding a CNAME to the hosted zone but the console will not allow it.
I know I am missing something, but I am not sure what. Any help is appreciated.
Thanks!
I have also created 2 hosted zones and given each of them an Alias record that points to their respective buckets.
You don't need two zones, just one. Delete then zone with www in it and create the www resource record in the remaining zone.