Skip to content

Instantly share code, notes, and snippets.

@hhsnopek
Created March 3, 2017 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hhsnopek/c822eb97c5da6a8aa94294fd7dd34126 to your computer and use it in GitHub Desktop.
Save hhsnopek/c822eb97c5da6a8aa94294fd7dd34126 to your computer and use it in GitHub Desktop.
The trick with migrating a live site is all in DNS timing.

Specifically, we can't provision an SSL certificate until the TTL value has expired from your old values to us, and the new values for us must be correct

  • You must use a CNAME or an A/ALIAS/ANAME record pointing to one of our IP addresses, preferably our Load balancer at 104.198.14.52

So, to do a minimal downtime migration, here are the steps:

  1. find your old TTL value for the record(s) pointing to your old provider. You can find this with a command like dig yoursite.com. In the output, you'll see a line like yoursite.com. X IN A 12.3.4.5 in which the X is your current TTL in seconds. Do this for each hostname you will migrate to us (perhaps sitename.com and www.sitename.com?)

  2. For each of those records, set a low TTL value for all existing records pointing to your old provider - I suggest a value of 10. Do not yet update the values (IP address or hostname) to use our service!

  3. wait for your prior TTL value ("X" in line 1) to pass, while your records still point to your old provider. If you have any questions about whether you did this right or about the following steps, now is the time to ask the questions, before you proceed!

  4. change your records to point to us, following the advice in this documentation: https://www.netlify.com/docs/custom-domains/

  5. wait for the new, low TTL value to expire (for my example, wait 10 seconds)

  6. go to the HTTPS tab and provision a certificate. This should work now that you've updated DNS and any old cached values have expired

  7. Assuming that worked (you should test in a browser!) then you can move the TTL back upwards in value to the old value. A TTL so low is not a general best practice, just useful during migrations like these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment