Backup to Amazon S3 with LiteSpeed

Do you know that LiteSpeed supports backup and restore directly to and from Microsoft Azure Blob Storage and the Amazon S3 (Simple Storage Service)?

And with directly I mean exactly this: LiteSpeed does not use any temporary local storage for backups at all ...the backups just go directly to the cloud!

In this blog we are going to focus on Amazon S3.

Once you have your Amazon S3 account, all you need to do is to register it with LiteSpeed and then you can just start backing up and restoring  your database to the cloud. Yes, is that easy!

To do that we will use the “Add Cloud Account” Wizard as shown below:


Most of the fields to fill in are self explanatory, but let’s comment some of them:

Are you using IAM roles or connecting with the Access and Secret key? Do not worry! Just select the option you prefer in the “Authentication type” dropdown.

What is the Automatic Striping option?

Striping is splitting one backup file into multiple files. The advantage of striping is that it provides higher upload performance when backing up to the Cloud and overcomes some Cloud limitations (e.g. maximum object size on Azure Block Blob storage is 200GB). Striping can provide a performance benefit and time saving when backing up large database files.

The automatic striping options are: auto, 10,25, 50, 100, 250, 500, 1000, and 1995 GB

The auto option enables LiteSpeed to manage the striped size. Alternately, you can set the striping size in GB. If the database size is larger than the specified stripe size then the file is striped when backed up.
Just select the option that best suits your demands but if you are not sure, just leave the default setting (Auto) and LiteSpeed will manage that for you.

Once you have filled in all the data, just Click Test Connection to verify that all entered information is working and let’s start backing up!

There are three ways to back up to the Amazon S3 Cloud: Backup Wizard, Maintenance Plans, or Backup Templates.

Let’s focus in the Backup Wizard for now.

In the Backup Manager ,right-click on a database and select "Backup" as shown below:

In the Backup Destination section select Backup to “Cloud”

Then you will be able to select the Account you just created before

After that just continue with the wizard as usual. Just one note about the Compression section:

Consider using higher levels of compression for cloud backups. Using a higher compression level can result in significant storage savings. Reducing the number of bytes sent to the cloud makes for faster backups and restores and reduces Internet bandwidth (and do not forget that in Amazon S3 you pay for the storage yo actually use!)

Anyway remember that we always have the Backup Analyzer  to help us determine optimal backup settings (compression level among them!). We can talk about this option another day.

We are almost there but wait…do you want to know exactly the command LiteSpeed is going to run? In the "Execute Script" section you can see this. See the “Preview Script” hyperlink below, which will show you the final script.

In this case the script would look like this:

exec master.dbo.xp_backup_database
@database = N'2AdventureWorks2012Dev',
@backupname = N'2AdventureWorks2012Dev - Full Database Backup',
@desc = N'Full Backup of 2AdventureWorks2012Dev on %Y-%m-%d %I:%M:%S %p',
@compressionlevel = 7,
@filename = N'2AdventureWorks2012Dev_201705171052.bak',
@CloudVendor = N'AmazonS3',
@CloudBucketName = N'litespeedxxxxxyyyyyyyzzzz',
@CloudRegionName = N'eu-west-1',
@UseSSL = 1,
@init = 0,
@OLRMAP = 1 ,
@with = N'STATS = 10'


Now the backup is ready! 

 If we go to the Backup Manager again, we will see our first Amazon S3 backup there!


Next time we will learn how to restore that backup with LiteSpeed!

Hope this helps!