How to link godaddy domain with AWS Elastic Beanstalk environment? - amazon-ec2

I'm running into this problem trying to link my Godaddy domain with an AWS Elastic Beanstalk instance. I found a lot of documentation on how to link an EC2 instance with a domain on Godaddy but not for Elastic Beanstalk instance. So I ended up with this URL: www.MY_SITE.elasticbeanstalk.com
Here is what I did for an EC2 instance:
I updated the Nameservers on my Godaddy domain with the ones from my Route 53 Hosted Zone.
I created a new Elastic IP on the EC2 console.
I went back to Godaddy and updated the DNS A # field from their DNS Manager, with the EC2 Elastic IP one.
You normally have to wait 1h to 48h and it should work.
How can I do the same for a AWS Elastic Beanstalk instance, not an EC2 one? I can't see the instance I created from my EC2 console in order to link it to an Elastic IP.
Hope this is clear enough.. Any help?

No need to create a CNAME or do any forwarding - this is bad from the point of SEO and not recommended by Amazon. Even you should not point a record to IP directly - it will cause a lot of troubles in the future because IP can be changed any moment.
The most elegant way is to migrate DNS service from GoDaddy to Route 53. You still will be with GoDaddy, but handling requests for your site will be on Amazon's side.
Here is what you need to do:
Create a new Hosted Zone for your site in Route 53 console:
Open newly added domain name, find NS record and copy servers:
In GoDaddy's Domain Manager export records via "Export Zone File (Windows)".
Import those records to Route 53 ("Import Zone File" button).
In GoDaddy's Domain Manager set custom DNS nameservers, obtained on the 2nd step:
Migrating might take some time (even days).
Now you can link you domain with your Elastic Beanstalk site. To do so select/create proper A record type in Route 53 and set Alias for it:

Here's what I did when I was facing the problem of linking a GoDaddy domain with AWS ElasticBeanstalk.
DNS Manager:
A record #: 64.202.189.170 (that is GoDaddy's forwarding IP btw)
Cname www: AWS EB domain (e.g. awseb-xyz.us-east-1.elb.amazonaws.com)
Forwarding:
Forward Domain to www.example.com (forward only, without masking)
Forward Subdomain to AWS EB domain (e.g. awseb-xyz.us-east-1.elb.amazonaws.com) (with masking)
In order to access the site without www (e.g. http://example.com), I had to set up the forwarding of the domain to the www cname. This www cname then gets forwarded to the AWS EB domain (with masking in order to keep www.example.com in the address bar).

You should add a CNAME record to your Godaddy domain name that maps from www.yourGoDaddyDomain.com -> MY_SITE.elasticbeanstalk.com.
That will direct requests to your domain name to the load balancer that is running in your elastic beanstalk environment. You don't want to route your domain name to a specific server (i.e. an elastic IP), you want it to go to the load balancer and that will route requests to your server(s). Since AWS Load balancers don't use IPs (they use domain names), you don't want to set up an A record for this - a CNAME record maps domain names to domain names.
Look at the "Adding or Editing CNAMEs" section of the GoDaddy documentation on how to do this.

Your route53 configuration has to point to the load balancer, not the ec2 instance

Related

Transfer DNS management to Route53 while keeping subdomain pointing to a different server

I need to transfer DNS management to AWS Route53 so I can host multiple Wordpress sites with different domains on a Lightsail instance using Plesk Obsidian. I've already set up one domain and its website. The next domain I need to setup for a Wordpress site that'll run on the Lightsail instance has an existing subdomain that's used for an app running on an EC2 instance. That EC2 instance's URL doesn't use a Route53 zone, i.e., it just has an A record that associates the subdomain to the EC2's static IP address.
My question is whether I need to create a Route53 zone for the subdomain after I move DNS record management to Route53, or is just keeping the A record for the subdomain in the Route53 DNS records sufficient without creating a separate Route53 zone?
Hopefully my question/concern makes sense. My concern stems from whether Route53 behaves like any other DNS manager or if it has peculiarities I need to be aware of for what I want to do.
I figured I'd just have to learn by trial and error since no one answered.
I created the A record on Route53 to point to the subdomain and switched to AWS nameservers ... and voila, it worked without having to add the subdomain as a Route 53 zone. My security certificate even resumed working on the subdomain after a 10 minute period in which it couldn't find the CNAME record of the certificate issuer.
So long story short, Route53 works just fine for pointing to subdomains outside of the Route53 zone. One A record does the trick.

Wix Domain Route to AWS Instance

I have a domain at my WIX Account. I have an AWS EC2 Instance. For URL Masking, I approched this URL link: https://www.youtube.com/watch?v=tZh7sqs1YFo.
Therefore, I created a Hosted Zone in AWS Route53 as it says. I added A Record Set and CNAME Record Set. I changed domain Host points to in the Wix to the AWS EC2 Instance Public IP Address.
Wix Domain Host
Then when I wanted to change the Name Servers in the Wix, it said to not editable fields in the Name Servers.
Name Servers are not editable
So domain is working without the www. If I use www, it stays to the user on the WIX site otherwise it forwards to the AWS EC2 Instance site but I want to use www so I changed CName to my WIX Domain CNAME.
WIX CNAME
But www is not working for my AWS EC2 Instance, it stays the old one WIX Site URL and when I try to reach without www, it takes to the user on the AWS EC2 Site.
I want to know whether I am going to right way or if I am wrong please correct me in this problem.
Can you explain the problem you are trying to solve?
If you are trying to obscure web pages and create a proxy model then the best way to accomplish this it to use the wix-router capability.

Heroku redirect from example.com to www.example.com retaining HTTPS using AWS

I have a Heroku app set up with SSL certificates, and my DNS does not allow CNAME records at the Apex level. Meaning, I cannot point my A Record at my Heroku app URL (A level records can only be IP addresses and Heroku cannot provide a static IP).
There other methods (both here on stack and on heroku's guides) that recommend using other DNS providers, but I would like to try and solve this with AWS (Specifically Route53), while also retaining our https:// in the domain for SSL.
I found some guides on how to do this, but there seemed to be complications (headers messed up, cannot retain https etc). I will provide an answer below outlining how I achieved this, but encourage discussion on what repercussions my solution may incur.
I discovered this guide on the Heroku website:
Configuring Amazon Route 53 DNS for Your Heroku App
The outline of the solution is to create an S3 bucket as a static website host that simply redirects to your Route53 hosted zone. Here are the basic steps:
Create a new hosted zone on your Route 53 Management Console with your domain (example.com)
Create a CNAME entry for www.example.com with the value set as your heroku custom domain (www.example.com.herokudns.com)
Create an S3 Bucket with the same name as your domain (example.com), and set it as a static website host
In the settings for static website hosting set this to "Redirect Requests" and set the target as www.example.com and the protocol to https
Return to Route 53 and add an A Level Alias with the target as your newly created bucket
Finally point your DN Providers Name servers at your new Route 53 hosted zone (you can get the list of name servers from the sidepanel in your management console)
And that's it! After the TTL expires on your Name Servers your site should be up and running and both example.com and www.example.com

Adding a CNAME to an AWS EC2 Public Domain Name

I have a test application running at
http://ec2-34-215-196-193.us-west-2.compute.amazonaws.com/
(This is a Test application, it wont be live for long. When I try to add a CNAME to this, like the screenshot below
. is added by the DNS system.
However, my app seems to be accessible only via us-west-2.compute.amazonaws.com or us-west-2.compute.amazonaws.com.
I can make it to resolve it either one of them.
But adding anything, does not seem to resolve with a CNAME. It gives 503 Service Unavailable.
I am using AWS EC2 to host the app with a HAProxy Load Balancer.
Using Google Domains for DNS Name.
Any suggestions for troubleshooting this problem?
All dns entries have a dot in the end like subdomain.domain.com.
It's not suggested to create CNAMEs to your ec2 instance because that IP may vary in time and it's not reassignable, that's what elastic ip's are made for, just create an elastic IP, assign it to your ec2 instance and assign it as an A record on your DNS provider.
Amazon AWS documentation
First create elastic IP and assign to your instance. Then create A record and point IP. Your site should work normal.

How do I point my DreamHost DNS registered website to my EC2 instance?

I have a domain registered with Dreamhost
I have an EC2 instance with the site running (that I can access by its IP address)
I'm using Amazon Route 53 for a hosted zone
I have pointed my DreamHost name servers to the ones provided by Amazon (and it has been over 48 hours)
The only thing I don't understand how to enter is the SOA record provided by Route 53. There doesn't seem to be an option in the DreamHost DNS management console to add it.
Going to the website gives the standard "DNS record not found" from my service provider.
What am I missing? I will really appreciate any help :)
In Dreamhost:
Use the values in NS (provided from AWS Route53) with your domain registrar(dreamhost).
In AWS Route53:
Add an 'A Record' with IP of the EC2 instance in value.
To resolve www to the naked domain name you could use, CNAME record, I have attached an image with some values masked.
Hope this helps.

Resources