S3 bucket with same CNAME as app? - amazon-web-services

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

Related

How to point a domain to Aws S3 static website

I have my domain registered and hosted at Hostpapa.
I have my web hosting in AWS S3. All set up as below:
Created a bucket in AWS S3 (named myDomain.org for example) with all the website content uploaded.
I'm able to access with URL like
http://myDOmain.org.s3-website.ca-central-1.amazonaws.com
The question is how do I point the domain in Hostpapa to AWS S3 website?
Thanks
The first thing to point out is that if you're trying to create a record for a root (or apex record) e.g. example.com you will need to ensure your domain service supports either ANAME or Alias records as traditionally only an A record (or AAAA for IPv6) will be supported for this record.
If your host supports one of these types (or is a subdomain e.g. subdomain.example.com in which case you can also use a CNAME record) you create the record and then use the CNAME provided as the value for your record.
If you are not able to configure in your current DNS provider, Route 53 does support Alias records so would be possible to add this for you.
It turns out straight forward.
In AWS S3
Create 2 buckets
myDomain.org
www.myDomain.org
Enable static web hosting in www bucket
Configure redirect for myDomain.org bucket to www
Upload website to www bucket
Copy www url (also called CNAME) like www.myDomain.org.s3-website.ca-central-1.amazonaws.com
In Hostpapa (or whatever the domain register)
Configure sub domain www to the above url (CNAME)
Wait couple of hours for propagation.
Works prefect!!!

Why my custom domain not showing S3 bucket data?

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?

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.

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.

AWS Route 53 - Elastic Beanstalk EC2 and S3 all under the same domain?

I have my Route 53 setup as follows
company.com A [EB Load Balancer]
www.company.com A [S3 Bucket]
S3 setup
Redirect all requests to another host name: company.com
I know I'm just not understanding something, but I can't wrap my head around having all S3 links go through company.com instead of company.com.s3-website-us-west-2.amazonaws.com
If your goal is to server assets (images, JS, css, etc) from within an S3 bucket, but using a custom DNS hostname, you can do the following:
Create an S3 bucket matching your intended hostname: assets.mycompany.com
Setup a DNS CNAME record for assets.mycompany.com in Route 53 => assets.mycompany.com.s3.amazonaws.com
This will allow you to load a file like http;//assets.mycompany.com/foo.jpg
Full documentation for S3 usage this way can be found here: http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html
If you need to serve S3/CloudFront content from your Apex aka "naked" domain (mycompany.com), you can configure an ALIAS record in Route 53 pointing at your S3 bucket or CloudFront host.
http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/CreatingAliasRRSets.html