Backup MySQL Server Actions
Matt Houser avatar
Written by Matt Houser
Updated over a week ago

Description

The Backup MySQL Server action will backup a MySQL server and save the backup to an Amazon S3 bucket. The backup is done by using the 'mysqldump' tool.

This action is performed by launching a helper EC2 instance under your AWS account. The helper instance is a Linux instance. It is launched, performs the backup, then terminates automatically. Options are available which dictate the region and availability zone under which the instance is launched. This allows you to launch the instance using any reserved instances you may have available. Options are also available to specify whether spot instances are used.

Proper selection of the region and security group will allow you to configure your database's security group to securely allow access to the helper instance.

Additional charges may apply to your Amazon Web Services account.

Settings

Please see Common Action Settings for a description of settings common to all action types.

Availability Zone

Indicates the availability zone in which the helper EC2 instance is launched.

Instance Type

Indicates the type of instance that is launched.

Use Spot Instances

Select this option to use a spot instance for the helper instance. Spot requests are currently time limited to 15 minutes. This means that if the instance is not started in 15 minutes after making the request, the request is cancelled. If the instance is started, it will execute the full backup until it completes (unless the current spot price exceeds the maximum spot price).

Maximum Spot Price

Indicate the maximum price permitted for the spot instance. Note that spot instances may terminate at any time if the spot price exceeds the maximum spot price. If this occurs, your backup will not complete successfully.

Security Group

Specify the security group to be used for the helper instance.

VPC Subnet ID

Optional. If the helper instance should launch inside a VPC, specify the VPC subnet ID.

Private IP Address

Optional. When specifying a VPC subnet ID, you can specify a private IP address for the helper instance.

Endpoint

Indicates the endpoint or host name used to connect to the MySQL server.

Port

Indicates the port used to connect to the MySQL server. The typical and default value is 3306.

Username

Indicates the MySQL username with which to authenticate with the MySQL server.

Password

Indicates the MySQL username with which to authenticate with the MySQL server. When editing an existing action, this field can be left empty.

Confirm Password

Type the password a second time to verify it was typed correctly. When editing an existing action, this field can be left empty.

Databases to Include

Indicates whether all databases in the server are backed up, or only a single database. When set to "Single Database", the Database field must be provided.

Separate Databases

When backing up all databases, enable this option to backup each database to individual files.

Note, the $(DATABASE) macro is required in the S3 Object Key to differentiate the files.

Database

Indicates the name of the database to backup.

Target Type

Indicates the type of target where the backup is saved. Currently, only "Amazon S3 Bucket" is supported.

S3 Bucket Name

Indicates the name of the bucket in which to save the backup.

S3 Object Key

Indicates the object key (or file name) with which to save the backup in the indicated bucket. Macros can be used to substitute run-time data, see below.

S3 Server-side Encryption

Specify the method of encryption of the uploaded backup file.

Omit --databases

By default, the --databases flag is used during mysqldump when backing up single databases. Enable this option to omit this flag.

Additional Command Line Arguments

Specify additional command line arguments for the "mysqldump" command.

Macros

The following macros can be used to include some run-time information.

$(DATE)

Date of backup in year-month-day format

$(TIME)

Time of backup in 24-hour format

$(DATABASE)

Name of the database. When backing up all databases, "ALL" will be used.

Macros are case-sensitive. For example, $(Time) is not valid. $(TIME) must be used.

Amazon Commands Used

The following Amazon AWS commands are used. The access key should have permission to execute all of them.

  • ec2:CancelSpotInstanceRequests

  • ec2:DescribeInstances

  • ec2:DescribeInstanceStatus

  • ec2:DescribeSpotInstanceRequests

  • ec2:GetConsoleOutput

  • ec2:RequestSpotInstances

  • ec2:RunInstances

  • ec2:TerminateInstances

  • s3:PutObject

Did this answer your question?