Why my custom domain not showing S3 bucket data? - amazon-web-services

I am trying to create a static website using Amazon S3 and Route 53 services. I created a bucket with my domain name only but after creating "A" record set in Route 53 hosted zone I am unable to access my data via domain name. And I updated name servers as well in hostinger (from where I purchased the domain).
I followed Example: Setting Up a Static Website Using a Custom Domain - Amazon Simple Storage Service even though I am facing the issue.
I enabled static website hosting as well and added a bucket policy which allow public to read my data.
Can you explain the resolution briefly?

Related

How to mask or reroute AWS S3 bucket name when syncing Google Domains with Amazon S3 Buckets?

I purchased my domain from Google Domains. I then created Amazon S3 buckets to store my files and set up Route 53 to do my routing. It all worked fine when I put the Route 53 name servers into my Google Domain portal.
However, my email associated with the domain stopped working and I got this message on my Google Domains screen: "It looks like you’ve changed your name servers. All settings for your domain (including website, email, synthetic records and resource records) are currently disabled. To enable these settings, you will need to restore the Google Domains name servers."
So, I reverted back to the original Google name servers and then used the Website Forwarding to point to my S3 bucket (XXX.org.s3-website-us-east-1.amazonaws.com). Although the website loads, the URL is the very long S3 bucket name and I am wondering how to mask that back to just my original domain (www.XXXX.org).
I tried doing CNAMES and Synthetic Records but did not have any luck.
The original google domain records were not migrated across.
The resolution is to export the records and import the zone file into Route 53.
Once this has been completed update name server records for your domain in google to use route 53 name servers.
Finally update dns for your domain to resolve to your S3 bucket

Connecting external domain name to AWS S3 website

I want to host a static website on Amazon S3. Created the relevant buckets - testing them ok.
Now I have a domain name i've registered with EuroDNS - www.gopropel.io - I can't find how to connect it to my AWS S3 bucket. Do I need to create a route 53 hosted zone? Went over the AWS documentation and they all assume you are registering your domain with them.
It is possible to route to host a static website without using S3.
Go to your S3 console and select your bucket.
Select the "Properties" tab, then select "Static web hosting".
Once this is setup you should see an endpoint url. Similar to this: "Endpoint :
http://xxxx.yyy.s3-website.xxxx.amazonaws.com"
Copy this url then create a CNAME record with EuroDNS and paste this link as the alias for "#" & "www" (optional). In the case of Eurodns set the host to your domain (gopropel.io & www.gopropel.io) and the canonical name as the url.
Allow a few minutes for the effect to go through and your domain should resolve to the s3 bucket.
This is not an ideal solution as it will limit certain features such as SSL (HTTPS).
The recommended approach is to go with Route53 it should cost less than $1.

S3 bucket with same CNAME as app?

I have the following setup:
Domain registered mydomain.com
App hosted on EC2 webserver on port 80 that's a accessible right now at mydomain.com/myapp
.csv files hosted on an S3 bucket named myapp at the following endpoint like so: s3-us-west-2.amazonaws.com/myapp/sample_file.csv
Route 53 to deal with CNAME for my domain and an Elastic IP
Everything works fine. However, now I want to update the URL's in my app to mask the longer AWS prefix and replace it instead with: mydomain.com/myapp/sample_file.csv
Every tutorial I've seen deals with subdomains like: myapp.mydomain.com/sample_file.csv which I DON'T want (since this particular app should only be accessed at the /myapp URL)
Is this possible?
You could point a custom domain name to your Amazon S3 bucket. The basic steps are:
Create an Amazon S3 bucket with a name that matches your domain name (eg dl.mydomain.com)
Activate Static Website Hosting on the bucket
Create a Record Set in Amazon Route 53 for the dl subdomain:
Type A
Alias = yes
Select the Static website for your bucket
Details: Example: Setting Up a Static Website Using a Custom Domain
Then, put objects in the bucket within the myapp directory, eg myapp/file.csv. You will then be able to access the file via: dl.mydomain.com/myapp/file.csv

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.

Redirecting route53 purchased domain to s3 bucket?

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