Over the past 11+ years of building and growing these services, we’ve evolved everything that we do. We’ve made mistakes, learned a good deal, and will constantly be improving our infrastructure and practices to ensure an even better service for our customers.
Surprisingly, these high traffic sites aren’t technically the hardest to host. Cache and CDNs can help with static content. However, membership sites, forums, BuddyPress social networks, and any other site that has logged in user activity creates a database load that grows significantly even with modest numbers of users. This is when redundancy and separating the database from web servers comes into play. And for us, Amazon Web Services has allowed us to create the ideal environment for WordPress and WordPress Multisite.
Why We’ve Moved To AWS
Why We’ve Moved To AWS
For many years, we leased servers in a data center from Peer1. This worked just fine, as our technical team could remotely manage the servers to build an optimized setup that served us well.
But, like much of the web, there are many factors that have resulted in us slowly moving all of our infrastructure over to Amazon Web Services (AWS) in the past few years. For example:
- Localization – AWS makes it easy to set up in regions all over the world, including the US, Canada, Australia, and the EU. Peer1 also had data centers in multiple countries, but not nearly as many, and it wasn’t as easy to move and manage between them. Many of our customers increasingly require hosting within specific countries due to laws and regulations around data. Others simply want to reduce latency.
- Pay-as-you-go – Our previous arrangement required us to lease servers on a monthly basis, regardless of if they were needed. We had to be ready for traffic spikes at all times. AWS is more of an on-demand model, allowing us to spin up virtual servers almost instantly, so we only pay for what we use. Similarly, when traffic is low, like when schools are out for many of our customers over the Christmas holidays, our bills go down.
- It’s freakin’ Amazon – AWS has become the most trusted and well-known cloud provider that there is. We’re able to leverage the trust (and security certifications) that AWS has in place to reassure our customers of the quality of the technology behind the sites that we host.
AWS uses a pay-as-you-go pricing model, so you’ll only pay for the cloud infrastructure and resources you end up using. Depending on your use case, this can be a huge advantage or a big drain on your pockets.
Why AWS for WordPress?
There are many advantages of going with AWS for hosting your WordPress site. Here are the most important benefits:
- Complete Ownership: AWS gives you total access to servers, storage, databases, and other application services. While AWS only owns the hardware for running these services, you’re in complete control of the server, including all your data.
- Agility: Though the era of move fast and break things has kinda come to an end, the philosophy still endures. The cloud gives you easy and fast access to a broad range of technologies, so that you and your team can innovate faster.
- Better User Experience: The AWS service is blazing fast, as its maintained by Amazon in multiple locations all across the world. This means lower latency and faster load times, and thus a better experience for your users.
- Highly Scalable: With AWS, you have access to as much or as little computing infrastructure. You can scale up and down at the click of a button as per your website’s needs.
- Cost Savings: The cloud allows you to own a server without any capital expense like data centers, servers, etc. And since Amazon takes care of all the infrastructure at scale, they can provide the service for you at a significant discount.
The Virtual Private Cloud
The Virtual Private Cloud
CDN
The first thing each visitor will hit will be a Content Delivery Network or CDN. We are a CloudFlare hosting partner, so most of our customers use CloudFlare, which includes some additional security benefits like a WAF (web application firewall) and DDoS protection. Others choose AWS Cloudfront, and others still will enable any of the countless CDN services out there. The CDN serves images and static content from whichever data center is closest to a visitor, which limits the traffic that actually makes it to the web servers and can speed up your page load times.
EC2 and Elastic Load Balancing
For the actual web servers, we use at least 2 EC2 large C4 instances running Linux with 8GB memory each. Within each AWS region, there are multiple “availability zones”, which are separate physical data centers. This builds in redundancy, should there be an outage or natural disaster that affects one location, the other can take over.
Directing traffic to these EC2 instances is an Elastic Load Balancer that determines which EC2 virtual server should handle each page view or action from a visitor.
Docker containers keep different WordPress installations separate from each other across the instances.
Aurora Database
For the database, which houses the content, comments, and user data, we use two RDS M4-Standard instances running MySQL. These are setup in a ‘master/standby’ arrangement with a failover to the standby should something go wrong with the master.
Directing traffic to these EC2 instances is an Elastic Load Balancer that determines which EC2 virtual server should handle each page view or action from a visitor.
Docker containers keep different WordPress installations separate from each other across the instances.
S3 File Storage
Using S3 for user file uploads like images and files was our first experience with AWS – and it is something you can (and should) do even if you are hosting your site somewhere other than Amazon. S3 is fast, redundant, and downright cheap for storage and bandwidth.
EFS Codebase
Your codebase, including WordPress core, plugins, and themes needs a home. We’ve become partial to the relatively new Elastic File System (EFS) on AWS to handle this. We use Bitbucket.com for code management and version control, and an in-house deployment application to make updates across all of the sites that we host. You could also use Git or other code hosting and management services.
Elasticache
Adding AWS Elasticache service to the mix means that we can serve any static HTML content to visitors without requiring any work in the database. Keep in mind that usually, logged in users aren’t served cached content. So if your entire site is private or a membership site, cache isn’t going to do much for you.
SES Email
Ec2 instances can send emails from WordPress too, like comment notifications or password resets. But if your site sends a lot of emails, especially if you are using something like Subscribe By Email, you are better off using the service specifically designed to handle email. If nothing else, SES allows you to increases your odds of emails being delivered (and not being flagged as spam).
Cloudwatch Alarms and Logs
Watching over the entire VPC like a hawk is Cloudwatch. Collecting logs and monitoring resources, Cloudwatch alarms can automatically add (or remove) EC2 instances when load warrants it, so that you aren’t paying for virtual services when they aren’t needed, and you can also scale to handle the highest of traffic you can imagine.