by yllus · 6y ago · 0 comments
I run our organization's WordPress sites on Elastic Beanstalk (just do a "eb deploy" from your Git repo of the site and it gets up there), plus RDS (Amazon Aurora) and CloudFront. EB and Aurora auto-scale and CloudFront does its CDN thing.
I highly, highly recommend Elastic Beanstalk ( https://aws.amazon.com/elasticbeanstalk/ ) to anyone who wants their org to concentrate on creating value (new/better code) and being cost-efficient (use the compute power needed that minute instead of overprovisioning) instead of fiddling with custom server configs and wondering if you're fully patched up. It was a game changer for us.
Personally I've found EB to be a great development tool but it's really hard to manage once you step up into the enterprise scale. By that point you'd be writing your CloudFormation scripts by hand (or better yet, using Hashicorp Terraform) and "building stuff to fail" (as the adage goes).
edit: getting downvoted. I'm guessing some people are using EB for sites that generate millions of visitors a day (let alone minute like some services I manage). I'd be interested to hear how you overcame EB's shortcomings with resource failures breaking the entire EB build pipeline in often unrecoverable ways.
In fact theses days there are a lot of Infrastructure as Code solutions out there. If you deal mainly with lambdas then there’s Serverless[1] or CDK[2] (Cloud Developer Kit). EB is itself ostensibly “just” a frontend for CloudFormation[3] (as I hinted at in my earlier post). Personally I use HashiCorp Terraform[4] the most but every single one of the aforementioned bar CDK has been used in production by my team.
However if none of those float your boat then there are a whole plethora of other IaC tools out there I’ve not mentioned.
So if you’re hitting the limitations of EB then your time is well spent learning another tool. In fact I’d go further than that and say I think it is worth your while learning Terraform (or any other IaC tool) even if you aren’t hitting the limitations of EB —- but I’m biased because of having wasted so much time in the past fixing deployments that EB has completely mismanaged.
[2] https://aws.amazon.com/cdk/
Also, WP works "mostly" but if you rely on shared assets (temp files, etc) and log files written to disk like woocommerce, mailchimp, and more do, those are silently inconsistent. most people don't care, but it's not 100% "correct"
So while it appears to work 100%, there are things under the hood that simply are misbehaving and out of sync.
Personally I prefer doing my own ASG or other methods than rely on EB anymore. I've had it break too much, and I can get a lot more scaling out of a completely custom AMI build.
If you're thinking long term and beyond the time period that you yourself will be employed at your org, you should put serious thought into making as vanilla and out-of-the-box a build as possible. My organization has a simple path to getting new developers up to speed on how to maintain and further update our Elastic Beanstalk-served sites: Learn the basics of how EB works and you're good to go.
On the other hand, if I had put together a superbly optimized AMI and grafted each site onto it, a whole lot of question marks start to appear. What distro is being run? Who/what's keeping it up to date? How do you connect to it? (On EB, you type "eb ssh" and it logs you in.) What's the load balancer setup look like? Where is all of this documented?
I think the trade-off of a few percentage points of optimization versus the fully-documented nature of a packaged service and the simplicity of getting someone new up to speed... I'll drop the few percentage points any day.
In fact, a few weeks ago a media org I frequent often had a site outage - they run WordPress so I offered to help (it was the weekend and I figured their IT guy might not be available) and they took me up on it. It took me five minutes to solve the issue and twenty-five minutes to understand how their custom, minimally documented setup was designed. I don't think that should be the norm.
1. If you need multiple WP instances, you'll need to duplicate that setup with read replica + load balancer
2. If you want to do things enterprise-proper, you'll want to set up a VPC, which means you need the internet gateway + some routing setup
And voila, thats the above architecture. If you don't need it you don't need it. But none of this is particulary complicated to set up if you know what youre doing, especially if you're using Terraform.
Don't forget that wordpress is not stateless. It'll need write access to its code directory, which complicates scaling. AWS has EFS which support up to 1000 clients, but at that point you'll probably better off rewriting your website with something else that easier to scale on the cloud.
Honestly - it's a pretty painless, AWS-takes-it-from-there setup.
If you are read heavy, offloading static assets to a CDN and having good caching will get you very far. If need be, you can load-balance between databases and you’ll still go very far.
Micro-services is not necessarily synonymous with scale.