Configure domain on Godaddy to Amazon S3 bucket - amazon-web-services

I have the static website hosted on S3 which is displaying correctly using the Amazon s3 link.
As per Amazon docs, I created two buckets, example.io & www.example.io. The example.io has the content (files) for the website; the www.example.io bucket is redirecting to the phlo.io bucket.
I am trying to configure Godaddy Apex domain DNS settings to redirect to the S3 bucket. As an example, the domain is http://example.io & I entered the settings in Godaddy domain DNS in the following form:
Type: CNAME
Name: www
value: example.io.s3-website.eu-west-2.amazonaws.com
TTL: 1 hour
However, the website is not displaying on the link http://example.io. How do I configure the apex domain to display the static website?

You can't, sorry...
AWS do not provide an IP Address that you can add as the Apex A Record. This causes issues using S3, CloudFront, ELB, and API Gateway.
If you are using AWS Route53, you can set the Apex A Record as an "alias" to those other services in your AWS account. This is an AWS bespoke service to get around only being able to set an A Record IP Address as the Apex Address.
So you can either move your DNS to AWS, or use a www redirection service. This will provide you with an IP Address which will respond with a redirection to your www.example.io address. People often use services like wwwizer.com to do this for free: http://wwwizer.com/naked-domain-redirect
On further investigation, it turns out that GoDaddy offers http redirection in its DNS service. Here is a guide to setting up naked domain name redirection to the www sub domain: https://help.ghost.org/article/17-custom-domains-using-godaddy

Steps to follow to redirect all traffic from www.yourdomain.com to www.yours3bucket.amazonaws.com
Create a bucket with the same name as your domain name(in this case www.yourdomain.com), make it public and host it.
Go to Godaddy DNS Server and Enter a CNAME Entry with host as www, Points to as www.yours3bucket.amazonaws.com and TTL as default.
(This is to redirect all the traffic to your AWS S3 Bucket, It will only work with www.yourdomain.com and not with yourdomain.com if you do not set a forwarding as mentioned on step 3)
Now also add a 301 forwarding to http://www.yourdomain.com or https://www.yourdomain.com.
(This is to forward yourdomain.com to www.yourdomain.com)

Related

CNAME in Route 53 redirect to subfolder of domain

I have a domain zyx.com and I would like to point it to the page in abc.com/cba.
Is there a way in Route 53 to do this with either a CNAME or A record? Both of the domains are on AWS, but when I do a CNAME record pointing zyx.com to abc.com/cba, zyx.com points to abc.com instead of the subfolder of the domain.
Thank you in advance.
I created a CNAME record pointing zyx.com to abc.com/cba. I also created an A record for the same. Either way it does not take
You cannot use DNS to redirect to a specific page on the same domain or any other domain. Redirects occur within HTTP, not DNS.
Instead, on AWS, you can use an S3 bucket with static web hosting to configure a redirect. To redirect requests for a bucket website endpoint:
Open the Amazon S3 console at https://console.aws.amazon.com/s3/.
Under Buckets, choose the name of the bucket that you want to redirect requests from (for example, www.example.com).
Choose Properties.
4.Under Static website hosting, choose Edit.
Choose Redirect requests for an object.
In the Host name box, enter the website endpoint for your bucket or your custom domain. For example, if you are redirecting to a root domain address, you would enter example.com.
For Protocol, choose the protocol for the redirected requests (none, http, or https). If you do not specify a protocol, the default option is none.
Choose Save changes.
For more details, refer to the docs.

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!!!

Main domain for AWS S3 static hosting and sub domain for api

I purchased a domain from godaddy.com and I'd like to use the root domain for AWS S3 static hosting and sub domain for api.
The API server is running on an AWS EC server.
So the result should be:
- when enter mydomain.com in the browser: I should see the AWS S3 static hosting page.
- when I make a request to api.mydomain.com: all requests should be sent to AWS EC2 server.
I tried http://docs.aws.amazon.com/AmazonS3/latest/dev/website-hosting-custom-domain-walkthrough.html
As a result, the S3 hosting is working with the root domain.
But in my Godaddy domain settings page, I can't add a subdomain because the name servers are not managed by Godaddy.
Since you mention that the name servers are not managed by Godaddy, I assume that you are using AWS Route53 service. If so, that is where you should add all needed records/subdomains.
Also, by using Route53 with other AWS services, you can utilize additional benefits compared to other name service providers (ALIAS records).

AWS ELB DNS failover to S3

I am trying to stay sane here, but this config was checked several times now against several tutorials and it is just not working.
I am having a public facing ELB for my website with EC2 instance behind it. What I need is to setup a maintenance website, hosted from S3 bucket.
What I did is, I created dns entry A alias for healthcheck xxx-healthcheck.xxx.com pointing to ELB internal AWS domain name.
I created an A alias for my website xxx.xxx.com pointing to my ELB internal address. Then I marked settings as failover, added above healthcheck and marked this as evaluate its health.
I added next record - for my S3 bucket (S3 bucket name is xxx.xxx.com). Alias A, again. Name of alias is same as primary address, so xxx.xxx.com. I marked it as failover and secondary.
I turned service off on both instances, healthcheck is marked as unhealthy. It is timeing out, when I try to access the website - no under maintenance site.
Please.
Please, help.
Cheers
A
Are you using TLS/SSL? If your website from ELB is being served over HTTPS, the browser tries to use HTTPS even with S3 after the failover (this is normal and it's called HSTS). Your content will still be served if you use HTTP. To verity that, use a different browser or clear all history related to your domain (if that does't work, google "chrome delete hsts domain" if you're on Chrome), and open your domain using http://<domain>.
If you enabled static website hosting on S3 and added that static S3 URL (via A record Alias) as your failover secondary route in Route53, this will not work since S3 is not configured to receive traffic using HTTPS via your domain.
The solution for this is to create a CloudFront distribution and add your S3 bucket as the origin, add CNAME value in CloudFront as your domain name and attach/configure SSL certificates on CloudFront. Now, in your Route53, add the CloudFront distribution's URL as the failover entry (A record Alias).

Redirecting a custom subdomain to a static website hosted in AWS S3 bucket

I have a static website hosted in S3 inside the bucket client1.examplecorp.com with a corresponding R53 record client1.examplecorp.com. A ALIAS s3-website-us-east-1.amazonaws.com.
I want my client's (client1.com) webadmin to create a dns record for the subdomain quotes.client1.com which will point to AWS (The client1.com does not use R53).
Should it point to client1.examplecorp.com ?
Or directly at the S3 bucket endpoint ?
The concept is that, the final user will see only the quotes.client1.com subdomain and not know about client1.examplecorp.com .
I hope I describe it well enough...
I have read the AWS docs about Setting Up a Static Website Using a Custom Domain , Virtual Hosting of Buckets and also this SO post.
I have a feeling that what I am searching for is described here How to redirect domains using Amazon Web Services .
I just do not understand how the registrar of the client will redirect traffic for that specific subdomain (quotes.client1.com) to client1.examplecorp.com by adding the 4 nameservers.
Moreover, will the redirect affect only this subdomain or the whole client1.com .
Finally, will it be completely transparent? Meaning that, the client1.examplecorp.com will not be shown to the end user?
I have not a firm grasp on explaining it , so please bear with me.
Here are two possible solutions:
In these examples, the client's main domain is example.com.
Option 1:
Create a bucket whose name is the same as the desired hostname, and have the client create a CNAME record pointing to the web site endpoint for the bucket.
Bucket name:
quotes.example.com
Web site endpoint (assuming us-east-1 region):
quotes.example.com.s3-website-us-east-1.amazonaws.com.
Client DNS:
quotes.example.com. CNAME quotes.example.com.s3-website-us-east-1.example.com.
The client does not need to be using Route 53 for their DNS, but the bucket name must exactly match the hostname they are pointing to the bucket, because that is how S3 works.
Option 2:
Send the traffic through CloudFront. In this scenario, the bucket name does not matter, because CloudFront will translate it to the correct bucket name.
Bucket name:
example-bucket
Web site endpoint:
example-bucket.s3-website-us-east-1.amazonaws.com
New CloudFront Distribution system-assigned hostname:
djozxyqkexample.cloudfront.net
CloudFront Origin (do not select the bucket name from the dropdown list, type in the S3 website hostname as shown in the S3 console):
example-bucket.s3-website-us-east-1.amazonaws.com
CloudFront alternate domain name:
quotes.example.com
Client creates a DNS CNAME
quotes.example.com. CNAME djozxyqkexample.cloudfront.net.
This solution also does not require that the client use Route 53, and -- importantly -- the bucket name does not need to match the hostname -- the hostname simply needs to be configured as a CloudFront alternate domain name so that CloudFront recognizes the Host: header when it arrives.
If you want to reuse the same bucket for multiple sites, you can add more hostnames to the CloudFront alternate domain name setting, or you can create multiple distributions pointing to the same bucket.
Note also that using CloudFront in front of S3 is effectively free, because S3 will no longer bill you for bandwidth when you use CloudFront -- instead, CloudFront will bill you for bandwidth, at the CloudFront rate, which is often slightly lower that the S3 rate.
In both cases, above, the client does not need to use Route 53, because they hostname in question is not the zone apex hostname (the "naked domain"). To use a naked domain with either solution requires Route 53, but that isn't applicable here.
Unfortunately, I think this is not possible. I am assuming that you own the corporation domain in this case.
For you to use client1.corporation.com, you had to use Route 53, right?
You also could not configure some DNS record in your other NameServer and do the same.
Similarly, for you to use quotes.client1.com point to the S3 bucket, you also need to ask the client use Route 53.
Hope that helped
Cheers!