115

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:

  1. I updated the Nameservers on my Godaddy domain with the ones from my Route 53 Hosted Zone.
  2. I created a new Elastic IP on the EC2 console.
  3. I went back to Godaddy and updated the DNS A @ field from their DNS Manager, with the EC2 Elastic IP one.
  4. 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?

nkr
  • 3,026
  • 7
  • 31
  • 39
Bob Bill
  • 1,159
  • 2
  • 8
  • 3
  • You're confusing various pieces of the puzzle and it would be easier for us to help if you could tell us your domain name. – jamieb Jul 22 '12 at 22:55
  • Do you have an IP address or just the URL URL: www.MY_SITE.elasticbeanstalk.com for your Elastic Beanstalk instance? – Mike_GoDaddy Jul 23 '12 at 20:06
  • Article about how to use custom domain names with Elastic Beanstalk https://docs.aws.amazon.com/ElasticLoadBalancing/latest/DeveloperGuide/using-domain-names-with-elb.html – Alexey Oct 21 '14 at 08:50
  • 1
    I voted to close this question because it is not a programming question. Questions about managing your servers should be asked on [sf] and questions about your website should be asked on [webmasters.se]. In the future, please ask similar questions in one of those more appropriate places. – Stephen Ostermiller May 02 '23 at 01:33

4 Answers4

124

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:

  1. Create a new Hosted Zone for your site in Route 53 console: enter image description here

  2. Open newly added domain name, find NS record and copy servers: enter image description here

  3. In GoDaddy's Domain Manager export records via "Export Zone File (Windows)".

  4. Import those records to Route 53 ("Import Zone File" button).

  5. In GoDaddy's Domain Manager set custom DNS nameservers, obtained on the 2nd step: enter image description here

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: enter image description here

starball
  • 20,030
  • 7
  • 43
  • 238
Vsevolod Krasnov
  • 1,482
  • 2
  • 13
  • 20
  • 1
    Thank you sir. Worked like a charm. – An Illusion Jul 31 '16 at 06:10
  • 5
    there is a . at every name in the 4 nameservers you've highlighted the image in red box, does that .uk'.' also have to be added, if not then i can add the name servers but if added i get invalid characters, sorry for this stupid query but i am new for this setup. I have added by the way the 4 nameservers as directed but still i get website not found error, how to debug as I can ping the www.mysitename.com – codelover Sep 28 '16 at 09:50
  • 4
    @VickyDhas It has been a while since I did it, but I think you don't need a dot at the end of nameserver name (i.e. `ns-1783.awsdns-30.co.uk`) – Vsevolod Krasnov Sep 29 '16 at 07:11
  • 2
    For those who try this for the first time: make sure you refresh your hosted zone table after importing the DNS records. The records don't show up automatically as you would think. Then click on the A record (probably the top row) and create the alias for that record as described above. This is definitely the way to do this. If you're working with a smaller number of records, these changes propagate pretty quickly. – jbcaveman Oct 19 '16 at 14:20
  • If I already set my domain name from godaddy for Google apps, would it screw my google apps configuration?? – Martin Valentino Nov 29 '16 at 02:42
  • When i try to do the last step (ie add alias target value as my elasticbeanstalk app url )name i will get the following error `Tried to create an alias that targets http\072\057\057xxxxxx.us-west-2.elasticbeanstalk.com\057., type A in zone Z38NKT9BP95V3O, but the alias target name does not lie within the target zone` – shamon shamsudeen Dec 29 '16 at 11:53
  • You the man!!!!!!! One slight complication was editing the zone file in GoDaddy - it wasn't completely pre-configured – pronoob Feb 08 '17 at 20:36
  • Correct/complete answer. +1 Thanks @VsevolodKrasnov – B. Shea Mar 07 '17 at 23:41
  • Hey this worked like a charm, in a few minutes! Thanks! – Leonardo Chaia Apr 09 '17 at 22:28
  • Does anyone have estimates on the cost of using route 53 for a small, lower traffic website? I moved to Beanstalk to get a free SSL for a small blog. – hamncheez Jun 09 '17 at 20:39
  • @hamncheez, Route 53 cost [depends](https://www.quora.com/What-is-Amazons-Route-53-charging-strategy) on EC2 instanceyou are using. [Here](http://calculator.s3.amazonaws.com/index.html) you can find official cost calculator. – Vsevolod Krasnov Jun 11 '17 at 02:26
  • 1
    I think that I already did this steps yesterday, does anybody know how much remaining time until I can see my domain pointing to the eb server? Or know if I did everything correctly? – Jose Palazuelos Jul 26 '17 at 17:32
  • Thanks man!!! You saved me a loooot of hours... To those who are thinking about the migration time, as i did, before setting it up, it was within minutes (for me).. – Vamsi Challa Nov 13 '17 at 04:43
  • Great answer! I know this is old, but I followed this to the dot and my GoDaddy domains successfully send traffic to my website, but the URL is still the root EBS link. It is a Wordpress website if that matters. Any ideas? – Seb G Dec 07 '17 at 21:22
  • In GoDaddy, I couldn't find "Export Zone File" option. Any ideas? – Pei Mar 17 '18 at 15:55
  • 2
    This is a great answer if you're working with a new unused domain but not great if you are already pointing to places through GoDaddy. In my case I have the www (and other email related) subdomain pointing at something through GoDaddy already but now need to point another subdomain to my elastic beanstalk. – Svet Angelov May 08 '18 at 15:38
  • Import zone file failed in Route 53, saying ` Error parsing zone file: Error in line 39: Invalid address: Parked (encountered after 1 correct records) `. Some posts say I need the beanstalk app IP in A value, still don't know how to do that – Logan Yang Jul 30 '19 at 22:33
41

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).

Cœur
  • 37,241
  • 25
  • 195
  • 267
sitiveni
  • 542
  • 3
  • 3
  • 1
    you can't add cname for domain, its only for subdomain –  Oct 29 '13 at 14:09
  • 1
    Inforwarding the first bullet point Forward Domain to www.mysite.com (forward only, without masking)? www.mysite.com is it the domain that you bought at godaddy or is it EB link ? – Hrishikesh Sardar Nov 09 '13 at 16:27
  • 1
    For me I had to change the A record **@**: to 184.168.221.3. – Felix May 22 '14 at 21:32
  • That's a double hop (forwarding to a forward) which can be bad for a multitude of reasons (SEO for one). I'd recommend going with this answer: http://stackoverflow.com/a/14158422/476228. Read down to the part about transferring your nameservers. – Southerneer Aug 18 '14 at 01:55
  • Didn't need to forward the qualified domain (www), just the main unqualified domain and had to put that specific forwarding ip address in the A record apart from adding the cname entry. – roopunk Feb 03 '15 at 08:52
  • How about if **A** points to **awseb-xyz.us-east-1.elb.amazonaws.com** directly? – SparkAndShine Apr 28 '15 at 18:02
  • @Felix mine was 184.168.221.18, so I think anything on 184.168.221.0/24 is used. If you go through the interface ("Set up domain forwarding") it does the A record for you. – Brian Brownton Mar 31 '16 at 17:24
  • @SparkandShine A records cannot contain hostnames, only IPs, which is why the question was asked in the first place. – Brian Brownton Mar 31 '16 at 17:25
  • 1
    This solution is not effective from the point of SEO. See below my answer, based on Amazon's documentation. – Vsevolod Krasnov Aug 23 '16 at 09:00
  • 1
    Fowarding to a CNAME is bad form as mentioned - and there is really no reason for it. Route 53 is the way to go.. for anything meaningful with regard to beanstalk. – B. Shea Mar 07 '17 at 23:38
  • After lot of searching, this answer was helpful – Bhavik Aug 24 '18 at 13:25
  • This is very bad for SEO. Answer by moffeltje is the correct one. – abelabbesnabi Aug 29 '19 at 13:59
10

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.

jaminto
  • 3,895
  • 3
  • 32
  • 36
3

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

wjin
  • 954
  • 1
  • 8
  • 13