2

I have bought a domain from Godaddy and hosted my app on AWS EC2 instance. Currently I have A Record in Godaddy pointing to IP address of my EC2 instance which is working fine.

Now I wish to convert my site to https and here is what I have done so far. Created a load balancer which successfully redirects http and https requests to my EC2.

What changes do I need to make on my godaddy domain settings so that it redirects https requests to my loadbalancer?

tejpratap
  • 21
  • 1
  • 2
  • 1
    Do you already have an SSL certificate? If so, there shouldn't be any DNS changes you need to make in GoDaddy. DNS doesn't care about http/https. – Dominic O'Connor Aug 24 '16 at 14:02
  • 1
    Yes, I have created a certificate in AWS Certificate manager and created a listener in LoadBalancer to listen on 443 using that certificate. So basically I need to somehow redirect both http and https requests to my loadbalancer. – tejpratap Aug 24 '16 at 14:09
  • 1
    You need to point the domain at the load balancer. If you're using an ELB this is a bit tricky because the IPs can change. You're better off using AWS Route53 as your DNS provider in this case. – ceejayoz Aug 24 '16 at 14:30
  • I missed the fact that you were moving your DNS from the EC2 instance to the ELB. jstell's answer is right...using AWS Route53 will make managing DNS easier and you can point your apex record at the ELB as an Alias. – Dominic O'Connor Aug 24 '16 at 21:04

2 Answers2

2

You must create a CNAME record that maps your host name to the "DNS Name" of your Amazon Elastic Load Balancer. Since the IP address of load balancers may change, you cannot use an A record. Delete your existing A record.

Note that none of this has anything to do with the protocol (http/https), this is only about resolving host names.

Since both http and https traffic will now be routed to the ELB, you should add an http/80 listener to your ELB config, as well.

If you want to redirect http traffic to https, you will need to configure your web server to send an http/301 response (e.g., using the RewriteEngine in Apache) to client browsers.

If you need to support domain apex (e.g., example.com vs. www.example.com), Amazon Route 53 does support an A/ALIAS record. See https://aws.amazon.com/route53/faqs/#point_zone_apex_to_elb. You need to change your name servers from GoDaddy over to Route53.

jstell
  • 546
  • 3
  • 4
  • CNAMEs won't work for an apex domain like `example.com`. – ceejayoz Aug 24 '16 at 15:16
  • If you use AWS as your name servers, you can use Route53 alias to point the apex at an ELB. – Dominic O'Connor Aug 24 '16 at 21:05
  • jstell - I would need both redirecting http/https traffic & support domain apex. So best solution as it seems is to move my DNS servers to Route53. I will try it out mid next week and get back with the results. @DominicO'Connor - My DNS servers are in Godaddy.. hence the whole issue...:) – tejpratap Aug 26 '16 at 14:08
  • Works like a charm. I chose to move my domain and DNS servers to AWS. – tejpratap Sep 01 '16 at 14:53
0

Update the A Record in your GoDaddy DNS to a C-NAME record pointing to the address provided to you by AWS for the ELB.

cduffin
  • 854
  • 7
  • 8