Backup wordpress to S3 bucket
|

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

  1. Log in to your WordPress dashboard.
  2. Navigate to Plugins > Add New.
  3. In the search bar, type “UpdraftPlus.”
  4. Click Install Now on the UpdraftPlus WordPress Backup Plugin.
  5. Once installed, click Activate.

Create an S3 Bucket for Backups

  1. Log in to your AWS Management Console.
  2. Navigate to Services > S3.
  3. Click on Create bucket.
  4. 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.)
  5. 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

  1. Go to Services > IAM.
  2. Click on Policies and Create New
  3. 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.

  1. Give you policy a name and optionally a description.
  2. Click Create policy.

Create a User

  1. Click on Users and then Add users.
  2. Enter a username (e.g., updraftplus-backup-user) and select Access key – Programmatic access.
  3. Click Next: Permissions and then Attach existing policies directly.
  4. Select Customer managed policy from the dropdown and attach the created above policy to the user.
  5. Click Next: Tags, then Next: Review, and finally Create user.

Adding Access Keys to the User

  1. Click on the created user.
  2. Select Security credentials tab.
  3. In Access keys section click Create access key.
  4. Select Third party service and confirm you understand the recomendation.
  5. Click Next.
  6. Write a description and click Create access key.
  7. Copy the Access Key and Secret Access Key; you will need these to connect UpdraftPlus to S3.

Configure UpdraftPlus Backup Settings

  1. After activating the plugin, go to Settings > UpdraftPlus Backups in your WordPress dashboard.
  2. Click on the Settings tab.
  3. 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.
  4. In the Remote Storage section, select Amazon S3.
  5. In the Amazon S3 settings, enter the Access Key ID and Secret Access Key from the IAM user you just created.
  6. Enter the bucket name.
  7. Click Test S3 Settings to ensure the connection is successful.
  8. Once verified, click Save Changes.

Perform Your First Backup

  1. Return to the Backup/Restore tab in UpdraftPlus.
  2. Click Backup Now.
  3. In the backup dialog, select Include the database in the backup and Include any files in the backup.
  4. 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

  1. To automate the backup process, go back to the Settings tab in UpdraftPlus.
  2. Set up the automatic backup schedule for files and database according to your preference (e.g., weekly for files and daily for the database).
  3. Save your settings to ensure your backups will run automatically on the schedule you defined.

Verify Backup in S3

  1. Go to your AWS Management Console and navigate to your S3 bucket.
  2. Check the bucket to ensure that the backup files are being uploaded correctly.
  3. Verify that both the WordPress files and the database backups are present in the S3 bucket.

Restoring from S3 (If Needed)

  1. If you ever need to restore your site, go to Settings > UpdraftPlus Backups in your WordPress dashboard.
  2. Click on the Restore button next to the backup you want to restore.
  3. 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.

Share this article

Similar Posts