2 min read

Which Google Cloud Platform Instance For a Small LEMP Stack

I choose and configure a Google Cloud Platform e2-small instance to run a Debian web server with Nginx, PHP and MariaDB.
Which Google Cloud Platform Instance For a Small LEMP Stack

Instance Choice & Setup

I looked for the cheapest between Azure and GCP as I did not want to use Amazon - not though any technical reason against Amazon but because I don't want to give Bezos more and more money.

Initially I liked the idea of Azure as I have not properly used it before and wanted to keep a lot of the stack with Microsoft - Windows, Azure, Office, Visual Code, GitHub & WSL2. However GCP is cheaper, and I also prefer the Google interface.

I initially tried the smallest instance with Debian which was one vCPU and 1gig of memory. It could run a web stack but was very slow with things like apt upgrade and the SSH connection was janky and wasn't always refreshing, so I stopped the server and went for the next size up. It still pleases me to be able to upgrade a cloud server on the fly, so easy compared to on-prem!

I also went with the us-central1-a zone as it was cheaper than a UK zone.

Connection

I installed the gcloud CLI tools, did some SSH authentication setup connecting to my Google account and then could connect.

https://cloud.google.com/sdk/docs/install-sdk

I then used my WSL2 Debian instance to SSH into the GCP instance with:

gcloud compute ssh --zone "us-central1-a" "instance-1" --project "excession-1"

Installation

Once I had a Debian instance up and running on GCP I installed a webserver, PHP and a database so I could play with some web frameworks. I use Debian, so just followed through one of the many guides for installing NGINX, MariaDB and adding and installing an up to date version of PHP-FPM.

Load Testing

This seems to run NGINX and MariaDB for Bookstack and Hugo nicely, but it's a dev server and not under any load.

The last time I did load testing I used surge and before that some old Magento tools from A Schroder, so I went looking for a new tool and found Locust.

I set it to 50 users, which I think is silly for a little webserver, and I was still able to work with BookStack and save edits etc. Subjective page load time felt it went from super snappy to a sluggish 5-10 seconds for a page load. At 25 users it was usable - I've been editing this page with the load test running and page saves are a few seconds.

Conclusion

It's pretty amazing what you get for $17 a month now, but as with every server the bigger the better.

On this e2-small instance I can have a Hugo, BookStack and Ghost instance running under minimal load with no issues. It does eat up most of the 2 gig ram.