How to Backup WordPress Website to AWS S3 Using UpdraftPlus
No matter where you deploy WordPress, WordPress website backup is a critical task that ensures you can quickly recover your site in the event of data loss, security breaches, or server issues. UpdraftPlus is a popular and powerful WordPress backup plugin that allows you to easily schedule backups and store them in various remote locations, including Amazon S3. In this guide, we’ll walk you through the steps to back up your WordPress website to AWS S3 using UpdraftPlus.
Install and Activate UpdraftPlus
- Log in to your WordPress dashboard.
- Navigate to Plugins > Add New.
- In the search bar, type “UpdraftPlus.”
- Click Install Now on the UpdraftPlus WordPress Backup Plugin.
- Once installed, click Activate.
Create an S3 Bucket for Backups
- Log in to your AWS Management Console.
- Navigate to Services > S3.
- Click on Create bucket.
- Enter a unique bucket name and select the appropriate region. (It’s best to choose a region closest to your server location for lower latency.)
- Leave the default settings for the rest of the options and click Create bucket.
Set Up AWS IAM User and Permissions
To allow UpdraftPlus to upload backups to your S3 bucket, you need to create an IAM user with the appropriate permissions
Create Customer Managed Policy
- Go to Services > IAM.
- Click on Policies and Create New
- Select JSON view and paste the following:
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "s3:*" ], "Resource": [ "arn:aws:s3:::my-blog.alexrusin.com/*" ] } ] }
This is policy allows full access permissions to a specific S3 bucket.
- Give you policy a name and optionally a description.
- Click Create policy.
Create a User
- Click on Users and then Add users.
- Enter a username (e.g.,
updraftplus-backup-user
) and select Access key – Programmatic access. - Click Next: Permissions and then Attach existing policies directly.
- Select Customer managed policy from the dropdown and attach the created above policy to the user.
- Click Next: Tags, then Next: Review, and finally Create user.
Adding Access Keys to the User
- Click on the created user.
- Select Security credentials tab.
- In Access keys section click Create access key.
- Select Third party service and confirm you understand the recomendation.
- Click Next.
- Write a description and click Create access key.
- Copy the Access Key and Secret Access Key; you will need these to connect UpdraftPlus to S3.
Configure UpdraftPlus Backup Settings
- After activating the plugin, go to Settings > UpdraftPlus Backups in your WordPress dashboard.
- Click on the Settings tab.
- Under Files backup schedule and Database backup schedule, choose your desired backup frequency (e.g., daily, weekly). Select a frequency that suits your update schedule and data importance.
- In the Remote Storage section, select Amazon S3.
- In the Amazon S3 settings, enter the Access Key ID and Secret Access Key from the IAM user you just created.
- Enter the bucket name.
- Click Test S3 Settings to ensure the connection is successful.
- Once verified, click Save Changes.
Perform Your First Backup
- Return to the Backup/Restore tab in UpdraftPlus.
- Click Backup Now.
- In the backup dialog, select Include the database in the backup and Include any files in the backup.
- Click Backup Now to start the backup process. You will see the progress and the backup files being uploaded to your S3 bucket.
Schedule Automatic Backups
- To automate the backup process, go back to the Settings tab in UpdraftPlus.
- Set up the automatic backup schedule for files and database according to your preference (e.g., weekly for files and daily for the database).
- Save your settings to ensure your backups will run automatically on the schedule you defined.
Verify Backup in S3
- Go to your AWS Management Console and navigate to your S3 bucket.
- Check the bucket to ensure that the backup files are being uploaded correctly.
- Verify that both the WordPress files and the database backups are present in the S3 bucket.
Restoring from S3 (If Needed)
- If you ever need to restore your site, go to Settings > UpdraftPlus Backups in your WordPress dashboard.
- Click on the Restore button next to the backup you want to restore.
- Follow the prompts to restore your files, database, or both from your AWS S3 backup.
Conclusion
Backing up your WordPress website to AWS S3 using UpdraftPlus is a reliable way to ensure your data is secure and easily recoverable. With scheduled backups and secure storage in S3, you can protect your website from data loss due to unexpected events. Regularly check your backup settings and test your restore process to make sure everything works as expected when you need it most.