How to backup MySQL to AWS S3

01 Mar.,2024

 

Automate MySQL database backup directly to your AWS S3 storage.

With SimpleBackups, you can backup MySQL database to any cloud storage provider.
In this article, I'll go through the entire process of setting up your backup and store it on AWS S3 specifically.

Prerequisites

  • Have a SimpleBackups account
  • Have a server connected to your account (the one on which your MySQL database is hosted)
  • Have a AWS account (it can be empty, we'll cover how to create your S3 bucket below)

1. Create your AWS S3 Bucket

  • Sign in your AWS Management Console.

  • Go to your AWS S3 bucket list and create a new bucket

    Keep default options for (2) Configure options, (3) Set Permission, review and create your bucket.

    Information you'll need in step 3:

    • Bucket name, in this case "myacme-backups"
    • Bucket Region, in this case "US West - N. California"

2. Create your AWS credentials

In order to give access to your newly created bucket, you'll need to provide credentials to SimpleBackups.
Follow this simple article on how to get your AWS S3 Credentials.

Information you'll need in step 3:

  • Access Key
  • Secret Key

3. Connect your S3 bucket to SimpleBackups

  • Log into SimpleBackups and head to the connect your storage page
  • Select "AWS S3" in the storage providers list and fill in the "Connect your storage" form with your AWS credentials and newly created bucket information

You'll have to input :

  • Key: Access Key described in (step 2)
  • Secret: Secret Key described in (step 2)
  • Region: Bucket region described in (step 1)
  • Bucket: Bucket name described in (step 1)
  • Give your storage a name (usually we like to use the bucket name) and click on "Save new storage".

You'll be redirected to the list of storage where you'll find your newly connected storage.

4. Final step: Create your MySQL backup

Now it's time to head to the create backup page.

What would you like to back up? (A)

  • Select "Database" (in this article we're creating a MySQL backup only)
  • Select the server on which your database is hosted

How often should we make this backup? (B)

  • Select your schedule option (here we picked a daily schedule)

    You can select a pre-defined schedule (daily, weekly, monthly) or a custom option allowing you to schedule it whenever you want to use CRON syntax.

  • Example of CRON schedule for "20:00 every Tuesday" = 0 22 * * 2

    Finally, the "On demand" option won't schedule anything but will allow you to trigger the backup manually or using our API.

  • Define the backup retention, which is the number of backups you want to keep (kind of the history length of your backup if you prefer)

Choose the database you need to backup (C)

  • Select the type of your database, in this case "MySQL"
  • Fill in the database connection form.
    Note: Backing up all databases on your server at once, requires a paid plan

Finalize and create

  • Pick the name of your backup (this is how it will be displayed in SimpleBackups interface) and where you want to store it.

  • Select your storage (step 3)

That's it, your MySQL backup is now ready.
Run it once manually (using the "Run" backup button from the backups list) and you'll trigger your first backup!

If you have any questions on mysql backup to s3. We will give the professional answers to your questions.