10 ms·
How to Run Wordpress on AWS
- drchopchop 7y agoProvisioning a single Wordpress box is very straightforward using AWS Lightsail and a Bitnami Wordpress image. You can push it up to the equivalent of an m5.2xlarge instance. Unless you really need auto-scaling, this seems like overkill?
- gtsteve 7y agoEBS volumes have a ~99.9% reliability rating so on a long enough timeline you're going to need to restore from snapshots. Writing to EFS however means that you can just treat your EC2 instance as a stateless front-end server that can be swapped out whenever needed. Couple that with an autoscaling group and when the instance inevitably dies, it'll automatically come back up on a new host. I don't have an ops team so I prefer AWS to be responsible for stuff like this wherever possible.
- dannyw 7y agoI have a Wordpress blog that has been continuously up, barring two host server migrations (~3 hours), since 2004. It is powered by a Linode. I have literally never needed to manage the server unless I was actively working on something, like changing the theme. People overcomplicate things these days. You could spend X hours creating some autoscaling, autorecovering setup; but for 99% of projects, it'd maybe encounter an outage that requires your intervention, once a decade.
- brodouevencode 7y agoFair, but how many customers do you serve? The example provided was enterprise level. TBH I would have not chosen Wordpress as the application of choice but the architecture is what would be recommended for an enterprise solution. Too many people are getting hung up on it being WP. AMZN doesn't care what the application is and has no vested interest (that I'm aware of) in WP. EDIT: clarity
- hanoz 7y ago>EBS volumes have a ~99.9% reliability rating so on a long enough timeline you're going to need to restore from snapshots. Where a long enough timeline is 700 years (before you're more likely than not to have suffered a full or partial failure).
- dpedu 7y ago> EBS volumes have a ~99.9% reliability rating so on a long enough timeline you're going to need to restore from snapshots. Taking regular snapshots decreases the chance of an EBS drive failing.
- liveoneggs 7y agoEFS is intolerably slow and keeping your php files on it is a bad idea. It's a little more complex but using packagist to install everyy except locally and then put wp-content/uploads/ on EFS works okay. fs-cache/cachefilesd helps.
- ridruejo 7y agoCorrect. This template is ALSO created by Bitnami (I’m the cofounder). For most people Lightsail (or Wordpress.com) are better choices, for others not
- tedk-42 7y agoSpoken like someone who's never used EFS in production. With WP, your page loads are incredibly slow with EFS as pointed out by others. Bah meant for the comment below!
- deleted 7y ago[deleted]
- yllus 7y agoThis is ridiculously over the top. 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/ 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.
- BrentOzar 7y agoHow do you handle file uploads from the front end, like when users upload pictures for their blog posts?
- yllus 7y agoThere's a lovely WordPress plug-in called WP Offload Media Lite ( https://en-ca.wordpress.org/plugins/amazon-s3-and-cloudfront/ https://en-ca.wordpress.org/plugins/amazon-s3-and-cloudfront... ) that takes the upload locally and re-ups it to an Amazon S3 bucket of your choice. Five minute setup job (put in your keys and the bucket name) tops.
- deusexepsilon 7y agoI really feel sorry for Mr. Rinehart.
- Kiro 7y agoThat sounds overly complicated as well. I upload my WordPress site with FTP to a web host and it just works.
- yllus 7y agoEverything depends on your organization's scale and complexity! We've got multiple developers and have a workflow built around Git (feature branches, pull requests and all that); in my opinion a professional development outfit that doesn't use version control is failing at one of its basic responsibilities.
- cbg0 7y agoWhile this is indeed overly complicated, you have to take into account the fact that there are websites of all shapes and sizes powered by WordPress these days, and not just blogs, but things like eCommerce, booking, dating sites, forums and more, some of which would actually benefit from an overly complicated setup like this. If you're just running a simple WP blog, you could host it on a cheap shared hosting package and not worry about devops, and as long as you use a cache plugin that will serve your entire site as static content, you'll be able to handle a large volume of traffic easily.
- zerkten 7y ago>> While this is indeed overly complicated, you have to take into account the fact that there are websites of all shapes and sizes powered by WordPress these days, and not just blogs, but things like eCommerce, booking, dating sites, forums and more, some of which would actually benefit from an overly complicated setup like this. It's amazing what runs on Wordpress and how relatively easy it is to scale with straightforward infrastructure. I think the diagram is for to enterprises which adore the complexity (because the enterprise architects won't be doing any of the maintenance), and is conditioning people to solutions which will have high consumption cost (because your money is best left with whatever cloud provider you choose.) That doesn't mean you shouldn't go all in on taking advantage of your cloud provider when you have a good model of costs and performance. However, you are best starting with the needs of the application and working from that point as you allude to.
- folkhack 7y ago> I think the diagram is for to enterprises which adore the complexity Bingo. Anecdotal experience: I saw this happen at my last position where they did an over-complicated/fragile WordPress setup with K8s. We went over to K8s for "performance optimization", "security", and "system stability"... what bothers me the most as a WordPress expert (specifically with HUGE/redundant rollouts) is that none of these reasons/bottlenecks were studied before designing the infrastructure. K8s is great, but if we start throwing arbitrary infra at our problems all we see is increased complexity without addressing the core tech issues. When I pushed to load test the new infra it was met with crickets - likely because that was never the goal in the first place. The goal was to jam a sexy technology into our stack so someone's quarterly goals were met with some lookin' pretty/SF-deluded engineering director that touts not knowing development/architecture makes him better in his role. Honestly - it's just job security, chasing a dragon, and cargo-cult for most of these orgs... if we were actually on the hook for "more with less" you would NEVER see an atrocity like what was posted. KISS is sure out of style when it comes to these fool's outrageous egos/budgets.
- gtsteve 7y agoAs it happens my company has hired a marketing company who wants to use Wordpress for our new website. This design really isn't so far out from what I planned but the NAT gateways aren't necessary and I was going to use Fargate instead of EC2 to host it. Also, I was going to host it in a single availability zone as the impact of downtime is minimal. EFS seems like a natural choice also for upload directories, etc, and you can attach EFS volumes to Fargate containers now. I'd be interested to hear if anyone else has done this and what their experiences are.
- dadarepublic 7y agoWhy not just use AWS Lightsail to start? https://aws.amazon.com/lightsail/features/ https://aws.amazon.com/lightsail/features/ It's super easy...
- gtsteve 7y agoAs it happens I just answered that question - https://news.ycombinator.com/item?id=22898903 https://news.ycombinator.com/item?id=22898903 I've racked up around 10 years of AWS experience now so it's not so hard for me to throw something like that together. If I had to use Azure then I'd certainly do something simpler.
- dadarepublic 7y agoMy orig comment in this thread misunderstood the intent of the OP. * shrugs
- yllus 7y agoInstead of EFS, use a WordPress plug-in like WP Offload Media Lite ( https://en-ca.wordpress.org/plugins/amazon-s3-and-cloudfront/ https://en-ca.wordpress.org/plugins/amazon-s3-and-cloudfront... ) that immediately moves those uploaded files to S3. Cheaper and more resilient (if you want to to be).
- gtsteve 7y ago
- dadarepublic 7y agoHoly smokes! And I just did a WordPress demo site using AWS Lightsail for $3.50 USD per month (obv the lowest tier). Took me less than an hour to get it all rolling. Just check out the feature list: https://aws.amazon.com/lightsail/features/ https://aws.amazon.com/lightsail/features/ There are some oddball finicky things about it (like not seeing the instance except in the Lightsail interface unless you manually fix or migrate it) but it was easy as pie.
- acomjean 7y agoI set a wordpress using digital ocean . They had a template and make it pretty easy.. I used to use AWS when I was at a startup. this light sail seems similar to Digital Ocean's built in templates. I appreciate the easy set up of the database and code and that it gives you a sane path to https. https://marketplace.digitalocean.com/apps/wordpress https://marketplace.digitalocean.com/apps/wordpress
- ridruejo 7y agoBoth lightsail Wordpress and this template are provided by Bitnami :) Different use cases
- romille 7y agoJust use lightsail? Literally what it’s for
- vital101 7y agoI personally wouldn't build my own infrastructure. I'd use something like https://convesio.com/ https://convesio.com/ and let them handle the scaling.
- harryf 7y agoExactly. Wordpress (plus plugins) is too much of a liability to host yourself. Personally use wpengine.com with comes with tools to keep Wordpress updated with the latest security patches automatically
- laumars 7y agoThere is a lot of scoffing in this thread and I agree AWS does make some things overly complicated but I think the scoffing here is unfair because the architecture looks far more complicated than it actually is. First of all, lets bare in mind this is talking about larger, enterprisey installs. So what would you need if you hosted on-prem: - a DB with a read replica in case your main DB died (RDS can actually build read replicas for you pretty easily so this part of the deployment would be much easier than doing the same MySQL replication config on-prem) - Redis for caching (my experience with WP is a couple of years out of date now but when I last managed an highly popular WP install (several in fact) Redis or Memcached caching was a necessity to get the kind of page load times our visitors expected) - Shared storage (bare in mind you're running more than one WP web server - if this was on prem you'd be hosting those files off a SAN) - A load balancer (I don't think I need to explain a justification for that one) - And probably a CDN too (reduce the stress on your web-servers and internet gateway) That's literally the bare minimum any large Wordpress application would need and that's all that AWS architecture is outlying. Sure there's a few more items on there like NAT gateways but those are just network stacks that are deployed as part of your VPC (or in on-prem terms, that's just the VLAN and/or subnet management that you'd assign to your load balancer). If you don't need multiple web-servers nor high availability then your architecture becomes drastically simpler (no load balancer, no shared storage, no replica DB, etc) but also you would run the risk of downtime and even data loss. Which might not be an issue for some people but it's also not one of the selling points of AWS. So you'd be better off with shared hosting or a managed WP service -- or to put it another way, AWS was never going to be a good fit. edit: Personally I think the issue here is more WP -- or rather the classical CMS design -- than it is AWS. A static site generator style of CMS would be a lot simpler cloud design and run a lot cheaper too. WP is designed from an era when web shops had this infrastructure set up by default.
- snowwrestler 7y agoFor me the scoffing is because Wordpress is such a well-known and popular CMS that there are hosts that specialize in it and have all this architecture pre-baked. Of all the CMS's in the world I can think of, Wordpress seems like the least likely one to require a bespoke from-scratch hosting strategy. I self-hosted Wordpress for years and yes this architecture is not unreasonable for a high volume site. Now I pay WP Engine a fixed annual fee and all this comes out of the box with a few clicks.
- bluedino 7y agoWhen I hear things like "Wordpress Powers 85% of websites", I wonder how many of them are running on a $5/month shared host
- codegeek 7y agoI would say at least 50% out of those 85% (educated guess). The reason WordPress is popular because literally anyone can start a blog or website with it relatively quickly on one of those cheap shared hosts. And thats why the volume.
- antoineMoPa 7y agoYou can handle a surprising amount of traffic with a $5/month Linode.
- mobilio 7y agoYou even can run WP on free shared hosting on services like AwardSpace: https://www.awardspace.com/ https://www.awardspace.com/
- wastedhours 7y agoBack in the late 00s I probably had about 5 installs on one £2.50/month shared host. Granted, not getting any substantial traffic (and more to test WP after my hacky self-built PHP CMS from before). cPanel > Install on a lot of shared hosting accounts made it insanely easy.
- markosaric 7y agoI wouldn't be surprised it's way more than 50% of them. My one is on something like $3/month too. And depending on the design theme you choose (there are huge differences in terms of performance from theme to theme) and as long as you activate a caching plugin, it can easily handle substantial amount of traffic too (such as being on the top of Hacker News for a few hours etc).
- adamsvystun 7y agoThe question of whether this is overly complicated is a wrong question. While in most cases this might be too much, there are situations where this is necessary. It all depends on the use case. I for one welcome the description of high-traffic production level architecture description. Usually on the internet, it is hard to find a real setup description. Most of architecture examples are simple, not something you would use in production yourself. Plus, simplifying architecture is always simpler, than thinking how to make it scalable properly.
- api 7y agoAmazon has found a way to attach a profit model to sophomore developers' tendency to over-engineer absolutely everything. It's brilliant. Imagine if the authors of all those object oriented design patterns books had found a way to charge people by the minute for each abstraction in a FactoryFactorySingleton!
- folkhack 7y ago> Amazon has found a way to attach a profit model to sophomore developers' tendency to over-engineer absolutely everything. Amen. It's also becoming the "safe" thing to do to put all of your eggs in the Amazon basket. Also just think about all of that data we're giving them... gah. They're laughing all the way to the bank.
- api 7y agoMeanwhile for companies like ours not doing this is a competitive advantage. Peoples' jaws drop when we tell them how insanely little we spend on cloud for hundreds of thousands of concurrent users and a lot of stuff going on. The secret: a la carte bare metal (packet.net, datapacket.com) for high-load and especially high-bandwidth stuff combined with a simple not-over-engineered services deployment in Google GKS with instances tuned for our work load (high CPU, low memory) so we are not paying for RAM we do not need. We are really only using Kubernetes to keep stuff up and auto-scale. We are not even close to using all K8S's features. GKS is most of the price tag. We could go down to about 1/4 the monthly cost if we rolled our own Kubernetes cluster with Rancher or something at packet.net, but the added labor might negate the savings. We may still do this if we grow significantly, since at larger scales the added labor may be justified by geometric cost savings. In general the bigger you are the more sense it makes to roll your own. Small and growing: use managed stuff. Bigger: consider bare metal and DIY clusters. Even bigger: co-location can start to make sense. HUGE: build your own data center! It's always a pure spreadsheet decision though. Also keep in mind that you can sometimes split your stack and do managed for one part and bare metal for another. For us the split is between things that are micro-service based, database backed, and need to auto-scale vs. dumb simple bandwidth and CPU pumping services that are trivial to deploy and require little attention. The latter is what goes on bare metal for massive operational cost savings. The former goes in GKS for labor cost savings. ... and yes, it's very stable, and probably more stable than finicky over-engineered Rube Goldberg machine AWS deployments that engineers constantly have to fiddle with.
- ausjke 7y agoUnless I'm a fortune 500 why do I need AWS at all, I can use Linode, DigitalOcean etc to set up stuff fast and easy, instead of spending all the bandwidth then getting lost in AWS maze.
- btian 7y agoYou can get an AWS VM for $3.50/mo And you can keep using AWS until you're part of Fortune 500
- system2 7y agoUsing AWS always gives me anxiety. It starts at $3.5, then some random thing happens you click a random amazon page and bam you pay 350 that month until you realize. Might not apply to 3.5 you are talking about but I've had enough with AWS. Unless the client really needs something global, I think you can always get away with DigitalOcean or Linode type of VPS. Heck I've been using CloudWays for basic projects, takes 10 seconds to launch the app and manages DigitalOcean for me. Magento and other root necessary apps I use LEMP image with Digital Ocean. AWS development and debugging are not for small players.
- john-shaffer 7y agoI would not use Wordpress to serve a large site directly unless I had no other choice. You can create a much simpler, faster, scalable and more secure architecture using WP2Static (https://wp2static.com/ https://wp2static.com/) to publish static files to an S3 Bucket/CloudFront deployment (or your storage+CDN of choice). WP isn't designed for this type of deployment, but the right plugins (e.g., WP Serverless Forms, WP Offload Media Lite) make it work. If you run the Wordpress instance locally or otherwise secure it from public access, you don't have to worry about keeping WP and its plugins updated, which saves considerable time and expense. This is my go-to solution whenever a WP install is requested.
- vangelis 7y agoThere's always the Lambda PHP runtime...
- neurostimulant 7y agoWordPress is popular because it's very easy to setup. Just throw it into your htdocs folder, install some theme and plugins and you're good to go. Make install harder and you'll lost a big reason to use WordPress. I think the only reason someone would do this is when a company that's using WordPress want to migrate to AWS to use "cloud" technology but don't want to invest in rewriting their website, which is odd. If they have engineering capability to move their WordPress site to AWS with complicated architecture, surely they have the chop to rebuild the website with something else that more compatible with cloud technology?
- kyuudou 7y agoIf it's low traffic enough and the footprint is small, couldn't the whole thing be thrown in a couple S3 buckets? I'm still learning this stuff.
- neurostimulant 7y agoI don't think you can run PHP off an S3 bucket. You certainly can sync the upload folder (static files) to S3 as a form of CDN via some 3rd party plugins, but it doesn't solve the main issue when you try to run wordpress in multiple instances load-balanced setup (I assume the diagram is intended to address this, hence the complexity). For low traffic sites, you probably won't need to worry about this yet. The real headache is when you need a load-balanced setup. You'll need to keep the whole wordpress directory (not just the upload directory) synced between instances, which you can't do over S3. NFS is a popular option, but NFS server usually have a hard limit on the number of connected clients, which ultimately limit the number of your instances (e.g. if you need 20 instances but your NFS server crap out when >12 clients connected, you're out of luck). Amazon EFS supposed to solve this since it supports up to 1000 connected clients, but people often complain about slow performance. That being said, scaling wordpress to handle high traffic is a headache unless you write your own theme and plugins. The majority of wordpress sites use those visual editor plugins and mega themes, which is a nightmare when you hit by high traffic as they are often impossible to cache (crazy stuff such as css/ generator that vary its output depending on user agents, etc) and often rely on wordpress statefulness (write arbitrary files to arbitrary locations, which means typical load-balanced/autoscaling architecture will not work as it assume your application is stateless). Personally, I'd rather rewrite the whole site with something else than trying to setup a load-balanced wordpress installation.
- minimaul 7y agoAnd that design (the Amazon one) will be unusably slow for any actual uncached access! WordPress on EFS (and they explicitly mention PHP files on their EFS description) is unbearably slow!
- vr46 7y agoThat is an extremely simple architecture design. Reverse proxy to load balance two instances. Two instances with a cache talking to RDS and an EFS volume to ensure uploads and files stay consistent. The networking is the bit that most people don't care about or see, but it's there, and that's it.
- ptrenko 7y agoNext: How to run wordpress on ENIAC
- aussieguy1234 7y agoDuring a hack day a small team and I got WordPress running on Lambda, serverless. We custom compiled PHP from source to run in the lambda environment then got node to pass the requests to PHP cli. Took some tinkering but we got it working.