Automated backups of database dump and uploads folder to Amazon S3 account
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Role to set up Stouts.backup jobs for Roots/Trellis Wordpress sites. Archives the database and uploads folder. to Amazon S3 storage.

Amazon S3 Account setup

  • Create an account with Amazon AWS
  • Create an S3 bucket to store backups
  • Enable IAM policy for user and new configured backup bucket
  • Get Access ID and Secret Key

Test Amazon S3 Connection

  1. Install s3cmd
sudo apt-get install s3cmd
  1. Configure s3cmd to use API keys (only required first time)
s3cmd --configure
  1. Check for bucket access

This command should return all buckets configured on this account, which should include the one created for this project

s3cmd ls


From your project directory

  1. Clone this repository
git clone --depth=1 trellis/roles/trellis-backup && rm -rf trellis/roles/trellis-backup/.git
  1. Clone Stouts.backup
git clone --depth=1 trellis/roles/Stouts.backup && rm -rf trellis/roles/Stouts.backup/.git
  1. Add trellis-backup and Stouts.backup to server.yml:
- name: Set up backups
 hosts: web:&{{ env }}
 become: yes
   - { role: trellis-backup, tags: [backup] }
   - { role: Stouts.backup, tags: [backup] }
  1. Add backup configuration to trellis/group_vars/production/vault.yml :
  backup_user: "{{ admin_user }}"
  bucket_name: YOUR_S3_BUCKET_NAME
  target_user: YOUR_AWS_ACCESS_KEY_ID
  target_password: YOUR_AWS_SECRET_ACCESS_KEY
  1. Reprovision your server to add backup tasks:
ansible-playbook server.yml -e env=production