Redirecting route53 purchased domain to s3 bucket? - amazon-web-services

I've just purchased a domain from Route 53 and created corresponding buckets in AWS s3. I've followed the instructions from: Example: Setting Up a Static Website Using a Custom Domain.
Let's say my custom domain is called customdomain.com.
I've created customdomain.com and www.customdomain.com buckets in s3 and allowed static website hosting on customdomain.com and enabled redirecting from www.customdomain.com to the customdomain.com bucket.
When I enter the endpoint for customdomain.com it works just fine, meaning my bucket policies are working correctly.
Next, in Route 53, I've set up Hosted Zone for customdomain.com.
I've also created a record set in that hosted zone with the name:
customdomain.com, type A, aliasing to customdomain.com's endpoint (which I chose from the dropdown menu). I left everything else as default then saved it. I added the record for www.customdomain.com but had it alias to customdomain.com
When I try to access customdomain.com, Chrome states that the site can't be reached.
Did I miss a step somewhere or does it take time for my site to be up due to DNS propagation or something?

Fixed it.
Apparently, the domain's name servers weren't the same as my hosted zone's name servers

Related

Route 53 Alias record not pointing to S3 static hosted website

I have bought a domain sandesh.link from route 53, created a publicly accessible S3 bucket with the same name, created a hosted zone and created an alias record pointing to the S3 static hosted website.
When accessing the domain, it shows that the domain is still parked at gandi.
I have updated the nameservers of the domain to the ones given in the hosted zone nameservers(can be seen at whois). I've also verified the domain through email.
How can I get this working?
Based on the comments.
The domain provided, when tested worked fine. It correctly showed:
Welcome folks Welcome
The reason it did not work before, could be that DNS changes were not fully propagated.

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

Static website on S3 with route 53 - Site can't be reached

I have hosted a static website on S3 with suitable bucket policy set. Viewing the "endpoint" in another tab works perfectly fine. After this I created a Hosted zone in route 53 to give it a desirable human readable address.
After creating the hosted zone, I have two records in my newly created hosted zone, One being of type NS and the other being of type SOA. So far so good. I go ahead to create a new record set.
I add the name as desired, enter type as 'A' - IPv4 Address tick yes for Alias, where in the drop down (Alias Target) i can see my previously created bucket endpoint.
I set the routing policy to be simple and Evaluate Health Target set to no. The record set is created successfully. However when i enter this name in another tab, I get the "Site can't be reached". I try and test the record set using the functionality provided by AWS. Here the response code i get is "NOERROR" which i assume is a positive response. Am I missing something here.
I have also referred to this video. Am I missing something. Also, I have not created the Hosted Zones myself.
A hosted zone is not the same as domain. You have to update the NS values for your domain registrar to point to the NS values as generated by Route53.
From the docs:
When you create a hosted zone, Amazon Route 53 automatically creates a
name server (NS) record and a start of authority (SOA) record for
the zone. The NS record identifies the four name servers that you give
to your registrar or your DNS service so that DNS queries are routed
to Amazon Route 53 name servers.
[...]
After you update the settings with your domain registrar to include
the Amazon Route 53 name servers, Amazon Route 53 responds to DNS
queries for the hosted zone even if you don't have a functioning
website.
NS transfer may take from 1 to 24 hours, depending on the registrar.
I faced the same issue. I bought domain thevegfoodies.com through AWS Route 53, created simple index.html page and uploaded to bucket thevegfoodies.com and set bucket for Static website hosting ,added public policy. created second bucket www.thevegfoodies.com and redirect to thevegfoodies.com, created aliases everything , read through documents everything. But nothing worked.
Until, i realized that my redirect bucket www.thevegfoodies.com was not set for public read access. I set it too Read bucket permissions for Everyone. (Note my primary bucket thevegfoodies.com already has public access.) and i could load my website using my domain name.
Now, I have read through AWS document again just to see if I missed this step of setting up public access for redirection bucket.
https://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html and all other steps to setup static website.
if you check Step 2.3: Configure Your Website Redirect, it is not mention that we need to set public access.
POINT- AWS Documentation is not clear. One need to have public access to redirect bucket too.

Domain DNS: move from AWS to Heroku

I had a static page on aws with a custom-domain.com and everything worked fine. Then, I wanted to use that domain for another site deployed on Heroku. I neeeded to unbound the domain from aws, intuitively I just deleted the buckets from the aws console. Now I have:
404 Not Found
Code: NoSuchBucket
Message: The specified bucket does not exist
I contacted domain provider company. In their answer I identified, that the domain name uses aws DNSs, but not heroku. They also added that all the changes should be made in aws, unfortunately I do not have the buckets to work with.
What should I try to do next? I can buy another domain (it is not sufficient), but it will mean that I am defeated. I want to win, will you help me to conquer the "web bug"?
When Setting Up a Static Website Using a Custom Domain, the following configurations are made:
A bucket is created with a name name matching the domain (eg custom-domain.com)
Static Website Hosting is activated on the bucket, which provides a DNS name (eg customer-domain.s3.amazonaws.com)
A DNS entry is made in Route 53 or another DNS service that is a CNAME record pointing to the DNS name of the static website
Since your configuration was working, we can assume that all the above configurations had been made. Then, when you deleted the bucket, the domain name kept pointing to S3. With no bucket to display, S3 gave you the NoSuchBucket error.
If your intention is to point custom-domain.com to a different service (eg Heroku), you will need to modify the DNS entry for that domain name:
If your domain name is hosted by Route 53, go the the Route 53 management console, find the domain and enter a new CNAME or IP address
If your domain name is hosted elsewhere (eg GoDaddy), go to their control panel and enter a new CNAME or IP address
Bottom line: You want to change the DNS entry.

Amazon Route 53 Alias not working

For some reasons I am not able to set up my static website in S3.
I am trying to resolve this from last 2 weeks but its not working for me.
What I have done is:
Uploaded files within S3 bucket.
Set up routing policy - thats fine.
Alias target dropdown - I can see the S3 endpoints.
Created Hosted zones.
Set up both the alias with and without WWW.
Result - When I am typing URL in the address bar, it throws an error..either site is down or DNS related errors.
I tried implementing the same steps 6-7 times,No problems at all but domains are not working in the end. Absolutely clueless where I am going wrong?
Your hosted zone and domain name servers could be out of sync:
In Route 53, verify the Name Servers (NS) generated by your Hosted Zone match what's listed under your Registered Domains.
SCREENSHOT: AWS Route 53 Top Left Menu - Hosted vs Registered Domains
Click on "Hosted Zones"
Select your domain (example.com)
Select the "Record Set" with type NS
Copy each line item / name server from the value box
ns1.amazon.com
ns2.amazon.org
ns3.amazon.net
ns4.amazon.co.uk
Now click on "Registered Domains"
Select your domain
Past each entry in the upper right hand corner
SCREENSHOT: Paste example.com Name Server Entries
The major steps to create an Amazon Route 53 alias to an Amazon S3 bucket are:
Create a bucket with the DNS name (eg images.my-company.com) -- note that the Bucket Name must match the DNS that you wish users to enter when accessing the URL
Activate Static Website Hosting on the Amazon S3 Bucket
In Route 53, create a Hosted Zone or use an existing Hosted Zone
Create a Record Set in the Hosted Zone
Name: Match the subdomain to the name of your S3 Bucket
Type: A
Alias: Yes
Alias Target: Select your S3 website from the pull-down list
See: Setting Up a Static Website Using a Custom Domain
The most important part is that the Bucket must have the same name as the Route 53 domain name (eg images.my-company.com).
If problems are experienced, first try to access the content via the Static Website URL. If that works, resolve the URL (eg via DNSLOOKUP or PING) and compare the IP address to a resolution of your domain name. They should both return the same IP address.
I find a solution.
It seems I deleted my hosted zone which was created by amazon first time against my domain name.
Later when i created my hosted zone again against same domain name I am supposed to update nameservers in the hosted zone page which resolved the conflict of name server resolution
In my case it was a silly Error, I was using my earlier bookmark which was using HTTPS. As soon as I used HTTP, it worked. (ps: Prior to trying this I was routing via cloud front.)
As AWS documentation,
https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/RoutingToS3Bucket.html
An S3 bucket that's configured as a website endpoint doesn't support
SSL/TLS, so you need to route traffic to the CloudFront distribution
and use the S3 bucket as the origin for the distribution.