Setup Fallback site for WordPress using Route53

Dilip Kola
Tensult Blogs
Published in
3 min readNov 1, 2019

Have you ever faced downtime with your WordPress site? Amazon CTO, Werner Vogels says, “Everything fails, all the time”. So our primary WordPress site can also fail sometimes and we need a fallback site if that happens. This increases the website’s reliability and trust. Let me explain your, how to use Amazon S3 to set up a static website as a fallback site for WordPress by leveraging Amazon Route53.

Prerequisites

Steps for setting up the fallback site

Crawl your WordPress website

We need to first download all the contents of your existing WordPress site. To do so, you can execute the following commands:

# Create a new directory to keep the website contents 
mkdir myWordpressSite
# Then change to the newly created directory
cd myWordpressSite
# After that use wget to download entire website using recursive crawling wget --no-host-directories --recursive --page-requisites --no-parent --timestamping <your-wordpress-site-url>

If you are using Apple MacOS or Windows, you can install wget using this link.

NOTE: I have tested the above commands on MacOS 10.13 using wget installed using Homebrew.

Don’t use this method to crawl the website which you don’t own. As you might be voilating the terms and conditions of that website.

Set up S3 bucket for hosting the fallback site

  • Create an S3 bucket with your WordPress site name.
  • Copy website contents to the S3 bucket using AWS CLI.
aws s3 sync . s3://<wordpress-site-domain-name>

Setup up Cloudfront for SSL and caching support

  • S3 static web hosting currently doesn’t support SSL so in order to support SSL. So we can use Cloudfront as it supports SSL using Amazon Certificate Manager.
  • Create Cloudfront distribution with the S3 bucket as the origin by following my colleague Sumit’s blog.

Setup DNS failover on Route53

If you have not registered your domain on Route53 then you can refer my colleague Ravi’s blog. In this blog, he explains how to use a domain that is externally registered with Rout53 DNS resolver.

Create a health check to the WordPress site:

  • Use HTTPs if your WordPress site supports.
  • The domain name should be the hosting provider name.

Creating DNS records with failover

Now you have successfully set up a fallback site for your WordPress website. If you want to test this failover, you do follow the above steps for your staging or testing sites and test it thereby manually bringing it down.

Conclusion

I hope you have understood, why and how to set up a fallback site for your WordPress. Please try these steps on your existing WordPress setup and let me know if you face any issues. Also, subscribe to our newsletter for more interesting updates.

Originally published at https://blogs.tensult.com on November 1, 2019.

--

--

Dilip Kola
Tensult Blogs

Spirtual Seeker | Mentor | Learner | Ex-Amazon | Ex-AWS | IIT Kanpur