Auto Scaling Wordpress in AWS

In the past I’ve used Packer to build an AMI that on startup downloads the wp-content folder and restores the database. I love Trellis but I also want to ensure my site is Auto Scaling. Has anyone successfully set this up beyond just calling the Trellis server.yml Ansible playbook?

I’ll follow up here with my successes and failures to hopefully benefit others.


Haven’t gotten around to it yet, but definitely something I want to explore. Let me know how you get along!

1 Like

@davidneudorfer @intelligence - Saw this conversation and wanted to reply. I am currently in the same boat trying to find the best way to handle this.

I am finishing up a CloudFormation object that uses EC2’s behind an ELB with Auto Scaling and an RDS. I was considering building in and testing this workflow as part of the Cloudformation LaunchConfiguration:

  • Install PIP && Ansible
  • Clone Trellis from Github
  • run server.yml to provision the server (maybe minus the DB setup since I am using an RDS)

The only part in my head I am hung up on that would fail is the part that uses the local site config files in group_vars per environment. Seems like I would have to curate separate configs and have them live on S3 or something and curl those also depending on the project which isn’t exactly nice either.

Just my two cents and currently where I am at with this same situation. If either of you had any luck with a similar setup I’d be happy to hear about it.



Just a note that if you have your db_host set to something not localhost, Trellis detects it as a “remote” DB and skips that setup automatically :ok_hand:

I might be missing something, but why can’t you just use the config files from the repo? You should be cloning your customized fork and not Trellis?


I haven’t pursued this yet. If I remember correctly I came to the conclusion that one should probably bake a customized AMI that contains the latest build.

The reason is that having an AMI with the latest build will see a much faster setup time rather than installing everything from scratch. But if you’re simply looking for piece of mind, knowing that a new instance will get deployed if your current one dies, your route seems good, and easier to implement!

At some point I’ll build a continuous integration infrastructure for my projects, then I’ll look into this again!

Let me know how your setup turns out, documentation of stuff like this seems scarce.

Btw, what’s the cost of using CloudFormation?

I’m in the process of provisioning some instances that’ll connect to RDS.
When you say that “skips that setup automatically” which setup are you talking about?
The mariadb one or the one inside wordpress-setup?

What I did was adding db_host, db_userand db_password inside /group_vas/<env>/vault.yml but it seems that the mariadb task still runs.