Hosting a serverless WordPress site on Amazon Web Services (AWS) is one of the best ways to maximize speed, reliability, and security of a website. Simultaneously, it is a great way to minimize upkeep and cost. When done properly a serverless WordPress site is just as content-rich and responsive as traditional hosting options.
In this guide, we will set up the hosting environment on AWS and then create a development environment on a local machine. I will walk you through the steps used for this site, which is a serverless WordPress blog hosted on Amazon Simple Storage Solution (S3) and delivered via Route 53 and an Amazon CloudFront distribution.
First, let’s talk about some of the advantages and disadvantages of a serverless WordPress site.
If you are ready to get started, then feel free to skip straight to the steps to deploy your site on AWS.
What are the advantages of a serverless WordPress site?
Simplicity
A serverless distribution means there is no need to set up and maintain a web server. With the right tools, distribution of your content is literally a push-button away!
Speed
Static webpages are extremely fast. Little to no server- or client-side compute time is needed.
Reliability
Amazon S3, which host the files of the serverless WordPress website, offers 99.999999999% of data durability. Amazon CloudFront and Amazon Route 53 use Amazon’s global network. At the time of this writing, Amazon CloudFront uses 187 Points of Presence (176 Edge Locations and 11 Regional Edge Caches) in 69 cities across 30 countries. Amazon Route 53 DNS servers are spread across many of the same locations.
Security
When running a WordPress site on a public web server it is critical to keep plugins and themes update-to-date. It is also necessary to use good operational security practices that include secure login passwords, two-factor authentication, etc.
A serverless site keeps the back end of the WordPress site secure because it resides on your local machine and is never exposed to the internet. Plugin or other vulnerabilities cannot be exploited by malicious actors.
A serverless site also allows you to avoid the operational responsibilities of securely managing a web server.
Finally, when using AWS you get the built-in network and application layer protection from Amazon CloudFront and Route 53.
Cost
Storage and compute-on-demand resources are less expensive than 24/7 provisioned servers. A serverless configuration on AWS is even cheaper than hosting plans provided by most hosting companies. This is achieved because you avoid paying for idle resources or the full suite of managed services and support provided by hosting companies.
What are the limitations?
There are a few limitations to consider with the set up outlined in this guide. However it is possible to overcome these limitations by incorporating additional services and resources.
Dynamic content
It is currently not possible to host dynamic content on Amazon S3. Serving dynamic content via Amazon Lambda is an option but beyond the scope of this guide.
Contact forms
Similarly a static WordPress site as described here will not accommodate contact forms on the website without adding additional services.
Comments
Post comments are another feature of WordPress that are not available with a static distribution. As with the other limitations it is may be possible to include this functionality with additional services.
Steps to deploy your serverless WordPress site on AWS
The remainder of the guide walks you through the steps that are necessary to develop and deploy your serverless WordPress site on AWS –
- Set up the deployment environment on AWS
- Set up a local development environment
- Generate and upload your content to AWS