Upon upgrading our development environment, we considered DigitalOcean and Amazon Web Services (AWS). Both of these have a marketplace where they offer free or paid images of pre-configured software. While that sounds good, I still had to try many until I found one that worked best for my needs. TL;DR: It’s an OpenLiteSpeed-based Amazon Machine Image (AMI). You can install images on Droplets of DigitalOcean, but on AWS, I used them on Lightsail and Amazon Elastic Compute Cloud (EC2) instances. I prefer the latter.
Install the Amazon Machine Image on EC2 or Lightsail?
Requirements formed as time went on, since the beginning, I just wanted to see WordPress running in the cloud 🙂 That succeeded very quickly with Lightsail that seems a bit like a dumbed-down VPS for those that are new to AWS (like me). However, I noticed that while the pricing is straightforward, it’s not advanced enough and seems overall limited. I’m checking out AWS because I want to learn, and eventually host production sites here. To get to know how scaling and more complex, performance-optimized infrastructures work there, I had to start with EC2 instead.
Why images? Why cloud?
I have a Raspberry Pi and already experienced what it’s like to start from scratch (locally), as in install the OS yourself, add everything you need, then finally install WordPress. Not 5 minutes! XAMPP and its friends aren’t unknown to me either, but those days are long gone!
The local/manual workflow is okay, but when you want to try new things rapidly, ain’t nobody got time for that. The last thing I wanted is to install stuff like phpMyAdmin manually and figure out what PHP extensions I need. When an Amazon Machine Image is “for WordPress”, you can be sure it’ll work fine with all dependencies pre-installed, and all you need to do is to keep those updated. Even if you don’t like the pre-installed WordPress and plan on putting other installations on the system, these images save so much time!
When you see your server not as this single thing at a hosting company… but as an item on a scrollable list that you can resize, delete, duplicate anytime… You begin to see that instances are disposable.
How did I come up with what I need?
The “best” depends on your particular needs. My thought process and requirements were these:
- Purposes: small site, development use, just testing AWS.
- No LAMP stack (Apache-based). Why? I wanted to ditch Apache for something different, for a change. I’ve heard there are more performant options.
- LEMP stack (Nginx-based) would have been excellent, but the lack of .htaccess support killed it. Even though I’m sure it can be configured perfectly fine for WordPress, I decided not to bother with it for now.
- I’d rather not pay someone to package free software, so no paid images, please. Amazon bills you for these on an hourly basis. While a few cents may look okay at first, they quickly add up over a year.
- I wasn’t brave enough to choose a Community AMI.
- The image itself should have a recent update date.
- I dislike when proprietary packages come up with their own and unusual folder structures to hide my WordPress, such as /opt/bitnami/apps/wordpress/htdocs/. Even if I could potentially move or symlink it somewhere else, it’s an added headache down the road. I used Bitnami on local installations, and it was always this weird. The more traditional /var/www/ path is easier to remember it or navigate there in that already chaotic Linux directory structure. (As I come from a Windows upbringing, it’s vastly different.)
- While digging into configuration files is fine, I preferred a GUI for managing the webserver and vhosts (switching from cPanel hostings, it’s hard to let go). That means designating domains and subdomains to actual folders, once your domains already point to the server’s IP in their DNS configuration. I tried Vesta (see below), Webmin (for Nginx), but meh.
- Automatic log rotation or limiting. A beginners’ misfortune is that the logs fill up the allocated space, breaking the instance.
What images can we consider?
On DigitalOcean, they are:
On AWS, the choices are more endless, but I’ve tried these Amazon Machine Images:
- WordPress with LiteSpeed Cache (Powered OpenLiteSpeed)
- NGINX Open Source Certified by Bitnami
- LEMP Stack PHP 7 on Ubuntu by Jetware
- LEMP and PhpMyAdmin Powered by Intuz
- Vesta Control Panels with Plugins sold by FusionWorks
The winner: OpenLiteSpeed because it’s awesome!
OpenLiteSpeed became my winner as it’s fast and similar to Apache (interoperable). As a bonus, it has a fancy GUI! After I figured out how vhosts and certificates work, I was able to lay the foundation for a new site in minutes. It’s the single image that I had the least amount of problems with and I installed on DigitalOcean too. Compared with cPanel, common tasks are still easy to carry out, for example:
- Certbot helps with Let’s Encrypt’s SSL certificates.
- I can manage databases and their users in phpMyAdmin.
- Monitor server load on AWS.
- Manage files over SFTP.
What now? What was the point?
I guess this article is good as any to let you know I’ll be writing more about AWS with a WordPress developer point of view. Because it already looks promising, you can expect further drips of information about our experience with it.
In a tutorial, I’ll tell you what to look out for and how I configured OpenLiteSpeed with its WebAdmin Console. Currently, we are hosting our development environments on a free-tier EC2 instance with a custom domain pointing to an Elastic IP. I interact with the instance over SSH using MobaXterm and work remotely with Visual Studio Code. I feel that this is a wonderful shift toward a better workflow, and it already looks much happier than what I used in the past.