Using a domain name for a website - amazon-web-services

I know this should be a pretty easy thing to do, but I'm having trouble.
Say I bought a domain name from 123-reg.co.uk "example12345.com". And I have a website hosted on AWS called something like http://lowcost-env.blahblahblah.us-west-2.elasticbeanstalk.com/.
I have read the following blog: https://www.thesitewizard.com/domain/point-domain-name-website.shtml and followed the steps, but still have 2 issues/questions:
1) I have configured "web forwarding" on 123-reg.com to forward requests to example.com to my convoluted AWS address, but when I type in example12345.com to a browser, it just says the DNS can't find that domain name. I set this up weeks ago, and did manage to see it work a couple of times, but weeks later it doesn't work anymore.
2) On the occasions I did see the web forwarding working, I notice that the browser displays the convoluted AWS address after the redirect happens. Is there a way to configure it so that users type in example12345.com into the browser, and then it's that address that is always displayed in the browser address bar whilst they are browsing around my website? Surely I need more than just web forwarding and a redirect?
Thanks!

You can use Route53 for pointing domain name to the AWS endpoint. Check the step 5 of this documentation :
http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html
In Route53 you can point your domain to alias whereas in other DNS you need to specify IP address/CNAME. As in your case you are using endpoint from AWS you can map it to your domain.
You will also need to modify the nameservers to point to AWS.

Related

Google Domain and AWS S3 Static Page

Good Afternoon,
I have followed a few tutorials on this topic and I have researched to see what I may be missing, but so far I haven't come up with anything. I'm sure it's a simple fix I just need a bit of help.
So I have the domain brandonkjones.dev that I purchased through Google Domains and I am trying to forward it to a static page hosted on S3. I created the hosted zone in Route 52 with the name brandonkjones.dev.
and I changed the Google Domain name servers to match those generated by the hosted zone.
I also added the additional records to forward the subdomain www to the root domain.
and Finally, I added the CNAME entry to the custom resource records on Google.
I'm sure this tutorial left off a step and I'm missing something because the original tutorial didn't even mention adding the CNAM resource within Google. Any help is greatly appreciated.
I had this same issue, tried with multiple browsers and triple checked that I'd done all the Route 53 and Google Domains steps correctly to no avail. Then I opened my terminal and tried:
curl http://my-domain.dev
and it returned my index.html that I uploaded to my S3 bucket, meaning I'd done everything correctly, but my browser wouldn't let me access the website over HTTP. In my devtools network tab, I could see that even if I explicitly typed in http://my-domain.dev it would do a 307 internal redirect to https://my-domain.dev. This is a security feature that browsers have to keep users from navigating to insecure sites over http.
Since the tutorials I followed for setting up S3 static hosting with a custom domain registered on Google Domains did not setup any SSL certificates for enabling HTTPS, the only way I could access my website was over HTTP. One way to fix this issue is to turn off HSTS as outlined here. Or, you could use something like AWS CloudFront to serve your S3 site over https, which you'll probably want to do if you want other people to access your site without this issue.

What am I missing in my AWS Route 53 S3 simple hosting setup?

I've got 5 records in my AWS Route 53 hosted zone:
First is an NS for my domain name.
Second is SOA for that domain.
Third is a validated CNAME for it.
Fourth is cloudfront distribution A alias for it with the www prefix.
Fifth is validated CNAME for the www version.
I don't yet have an SSL attached to it.
It works - well partially.
Trying to reach the unprefixed version of the domain from Chrome doesn't work, but if I type the domain with the www prefix it works.
Firefox automatically redirects the unprefixed domain to the www variant. I type the unprefixed name making sure it's not redirecting because the prefixed name is in the search history. When I hit enter, Firefox automatically redirects to the www.
I'd like the main name to be accessible, not just the www one. It's OK if someone types the www. They should get to the site, but the actual name has no www.
I'm inexperienced enough not to be certain about that www prefix or why it is necessary. This was the result of a long course on AWS services.
Can anyone tell me if I'm missing a needed record, or if I'm improperly using the Alias A record?
Edited to add this below after reading first three answers. Thank all of you who answered for your responses. I do appreciate them. Please see my comments on those answers. --
I'm attaching a screenshot of my Route 53 hosted zone settings to maybe help you get a clearer picture of where I am.
Please remember. I'm not starting with a domain with a site that I wanted to host on S3 and then redirect www.mydomain traffic to mydomain.
I began coding an app with no domain. Then I uploaded it to an S3 bucket. I then was able to access it's simple S3 hosting with the ugly url. Then I used CloudFront for a world-wide distribution, again with an ugly url. Only then did I try taking one of my owned subdomains and redirecting it to Route 53. It wasn't as clean and simple as buying a domain from Amazon. I had no SSL and had to make a request for the AWS Certificate Manager to process validation of my domain. I got all that.
My problem is as I tried to explain - Chrome won't recognize or redirect my main domain name without the www. It only recognizes if one types the www. in front of the domain name. On the other hand, Firefox automatically redirects no matter what you type (the www version or the one without the www). That redirection is to the www version (that is what shows in the url bar in the end - http://www.mydomain).
I think I may have figured out most of this. As I mentioned in my comment above, I noticed I didn't have an Alias record for my main domain. I also read in AWS documentation that my S3 hosting bucket should have the same name as the domain, so I did that.
After creating the new original S3 hosting bucket I had made another to keep the log files. I set up a CloudFront Distribution. Then I requested and got SSL certificates for my owned domain name and added another for the www version. With those successfully enabled, I transferred my registered DNS servers to AWS. That created the NS and SOA records when I created my R-53 hosted zone. I then created Alias records for both the man and www version and added the validated SSL certificates for both the main domain and the www version. So, a total of six records in the zone.
I created my new S3 bucket, naming it the same as my domain; copied the settings from the old one, set it up to host static single page site and generate logs. I had already created a bucket for the logs, so I just pointed the logs location for the new domain named bucket. I gave the regular logs a log prefix (folder) and the CloudFront logs a cdn one.
Everything works great except I discovered a new problem. I'll post a new question regarding that, something like XML error on browser refresh in child pages.
Thanks ALL!

HTTPS connections to cloudfront / S3 using godaddy domain

I'm following the serverless-stack guide and have a website hosted in an Amazon S3 bucket. I purchased a domain using GoDaddy and I have set up cloudfront to work with this bucket, then have used AWS certificate manager to generate SSL certificates for my domain (both www.my_domain.com and my_domain.com).
In GoDaddy I then configured DNS forwarding to point to my cloudfront resource.
This all works nicely, and if I go to my_domain.com in a browser then I see my website.
However, I can't get SSL working. If I go to the https:// version of my website then I see a not secure error in the chrome address bar which shows a certificate pointing to shortener.secureserver.net rather than my own website.
Could someone point me at a way around this? Looking through S.E. and using google it seems that Amazon's route53 might be able to help, but I can't figure out how to do this.
Thanks!
(edit) To make things more clear, this is what I see in Chrome if I connect to https://my_website.com or to https://www.my_website.com
The warning message:
The certificate details:
What I do not understand is why, after configuring an AWS certificate for my domain, I see a certificate for shortner.secureserver.com rather than a certificate for my_website.com.
Go daddy has problems and does not redirect to https, There are two ways, the first is to change domain registrar and the second is the easiest, which is: Create a hosted zone on AWS router 53 with your domain name
Create 2 type A records, one for the root (of your domain) and one for www that point to your cloudfront. Router 53 allows you to create a type A record without having an IP, because it directly points to a cloudfront instance that you indicate, that's the best
Then in go daddy it gives you the option to change name servers and puts the ones assigned by aws in hosted zone with the record that says NS and you put those 4 in Godaddy, replacing the ones that had
Note: SAVE THE NAME SERVERS THAT YOU HAVE IN GO DADDY BEFORE REPLACING THEM, IN CASE YOU HAVE ANY PROBLEM, YOU CAN REPLACE THEM AGAIN
You have to wait at least a few hours until all the name servers are updated, you can use the who.is page to see if the DNS have already been updated with those of aws.
It turns out that this is not possible with GoDaddy. If anyone else reading this has a similar problem, only current solution is to cancel your domain registration and register with someone else.
(edit) As #aavrug mentions in their comment, Amazon now have a guide for this.
When you defined your CloudFront you can defined whether you want to use, and you can choose HTTPS only. In this case HTTP requests will be automatically redirected to HTTPS. Have in mind CloudFront changes may take a while to be replicated and your browser cache it as well, so the best way is to make a change, wait for the deployment and then check it in a new cognito browser.
It goes without saying that your certificate must be valid and verified as well.
It might be something wrong with your certificate or with your domain.
If you serving your content over HTTPS you must provide a SSL Certificate in Cloudfront. Have you done that?
Have you added your domain on Alternative Domain Names (CNAMEs)?
Please have a look on the image below:
-> AWS provides Free SSL Certificates to be used with Cloudfront, so you might want to use it (easier than you import your SSL from go daddy).
You can create a free SSL certificate on AWS and easily attach it to your cloudfront distribution.
-> You can also transfer your domains to AWS Route53. It is easy to integrate with any AWS Service and easy to use/maintain :)
I wrote a complete guide on my blog telling how you can add Custom SSL and attach custom domain to Cloudfront distribution, it might be useful :)
https://lucasfsantos.com/posts/deploy-react-angular-cloudfront/

Google Domain and G-Suite with AWS instance

I have been looking around the internet and I have come across a few different ways to link my AWS EC2 instance to my domain name. It looks like I could do it using Route 53 but I am not entirely sure on that process. The other way is to map it from google. These seem like the best instructions I have found for that: link a Google Domain to Amazon ec2 server
The question that I can not seem to find is what about my email address. I pay google so that I can have some email addresses name#mydomain.com. Now these work fine and I have had them up and running for months. But now I want to have my website (it is a web app) point to it. Because currently when you go to mydomain.com it says This site can’t be reached mydomain.com’s server IP address could not be found.
Some help here on how to do this would be great. I am afraid that I am going to set this up incorrectly and then lose access to my gmail account which I cannot have happen.
Your domain's email is configured via MX DNS records. You would point your domain to your EC2 instance by adding A or CNAME DNS records. The two configurations are completely separate. You will not break your current email setup by adding an A or CNAME record that points to the EC2 instance. You simply need to add that record in your DNS settings, wherever your DNS is currently hosted. You don't need to make any changes in your Gmail account configuration, and you don't really need to use Route53 either (although it does add some nice features). You had to configure the MX records somewhere at some point, to setup your G-Suite account for your domain. You just need to go into that same DNS configuration (most likely still hosted at the company where you initially purchased the domain name) and add an additional record.

link a Google Domain to Amazon ec2 server

I am using an Amazon EC2 instance to serve a node.js app. I recently purchased a domain name through Google Domains and I want to use that domain name to access my node.js app.
The Google Domains console allows you to forward your domain traffic to another website. I set it to forward traffic to the public IP address of my EC2 instance. I can access my app just fine now, but when I type www.myDomainName.com into a web browser, the URL bar immediately changes and displays the digits of my EC2 IP address.
I would like the URL bar to display the name of my domain instead.
Note:
I have read a few SO questions related to this and can't figure it out. Some of them are a bit over my head. Many of them say to use an Amazon Elastic IP, but I don't understand why this is necessary if the public IP of my EC2 instance seems to work just fine. If the solution here is to use Amazon Elastic IP, I would really appreciate an explanation as to why that is necessary,
It sounds like you are using Google Domains to redirect to another site once the request has hit the Google servers. This is fine and dandy if you have another domain you are wanting to redirect to.
If you want it to stay under your domain name, but point to another location you need to actually change the DNS entries for your domain.
Go to Google Domain services and change your master(*) (A) record, as well as your WWW (A) record, to point at your public IP address. That way when a DNS request is sent for your domain it will just ask Amazons' servers what to do instead of using a redirect from Google.
Exact Steps:
From the Google Domain Website, click the Middle Tab () to open DNS settings
Fill out the form near the bottom of the page titled, Custom Resource Record
Name: In this scenario we want to use "#" or "www"
# is the root record (or anything not specifically set)[all]
www is the record for when people type www.example.com
Type: There are two types; A refers to IPv4 address and AAAA refers to IPv6 address
You can set both of them separately, generally you want to use the A [IPv4]
TTL: Time to live, recommend leaving 1hr (this is an advanced attribute)
Data: The actual IP address you are wanting to point to (your website)
Example: 8.8.8.8 [Google Nameserver]
Now that are the blanks are filled out, press the "Add" button
Wait for the records to be updated publicly
This will take approx. 1hr (as long as you kept TTL at 1hr)
This step can take longer depends on Google's servers
Check your website www.example.com to confirm it has updated
Addendum to Zax's Answer
While Zax's answer is fully accurate, it looks like it wasn't sufficient to help out the OP, and maybe not for others, too.
When you go to Google Domains (at least as of March 2017), you'll see several different tabs. The middle tab, which looks like is the tab to configure the DNS. Chose that tab.
Near the bottom of the page on the DNS tab you'll see a section Custom resource records. Within that section, you can add more entries. An entry consists of:
Name: this is briefly described by Google, but in short, likely you'll either want to use # or www, where the former means "root level" and the latter means "www subdomain".
For instance, if you registered imsocool.com, then # points to imsocool.com whereas www points to www.imsocool.com.
Type: you'll probably either want A which is an IPv4 Address or you'll want AAAA, which is an IPv6 Address. (That's assuming you're trying to point to a website, not an e-mail server or whatever else.)
TTL: time-to-live, I don't think you'll need to worry about it much, so just use the 1h (one hour) default.
data: again, presuming you are pointing to a website, that will be the actual IP address. E.g., 54.49.66.128, or whatever your IPv4 (or v6) server address is.
Once you've filled in all the blanks, simply hit the blue "Add" button.
Wait a while for the DNS update to happen.
The most it should take is 1 hour, if that's what you had placed above. But it could potentially be much quicker.
Then check to see that all is working by visiting your site using the name, e.g., imsocool.com.
In your google domain admin dashboard, select the dns configuration of your domain name.
Go to Custom resource records and set a new record with the subdomain you require: for the site webapp.example.com use webapp and select Type A. Leave blank the ttl field and add you public IP from the amazon EC2 instance. Then just browse the site webapp.example.com and it will retrieve the site on your EC2 under the domain name.
If you need to redirect the www.example.com domain then just add a record with www, also selecting the type A and adding your public IP from your EC2 instance.