Restore RDS SQL database from S3

You can perform native restores of Amazon Relational Database instances running SQL Server. You may have the backup you want to be restored in S3 storage, and using an Octopus runbook is an easy way to automate the process.

In the following example, we’ll use the AWS RDS SQL Server - Restore from S3 Bucket community step template.

AWS prerequisites

  • An AWS RDS SQL Server instance.
  • A SQL backup stored in an S3 bucket.
  • An AWS Identity and Access Management (IAM) Role to access the bucket.
  • The SQLSERVER_BACKUP_RESTORE option added to an option group on the DB instance.

For more information on setting up AWS RDS instances for native backup and restores, please see this AWS knowledgebase article.

Create the runbook

  1. To create a runbook, navigate to Project ➜ Operations ➜ Runbooks ➜ Add Runbook.
  2. Give the runbook a name and click SAVE.
  3. Click DEFINE YOUR RUNBOOK PROCESS, then click ADD STEP.
  4. Add a new step template from the community library called AWS RDS SQL Server - Restore from S3 Bucket.
  5. Fill out all the parameters in the step. It’s best practice to use variables rather than entering the values directly in the step parameters:
ParameterDescriptionExample
SQL ServerThe SQL Server to perform the work on.mydatabase.region.rds.amazonaws.com
SQL LoginThe login of the user who has permissions to create a database.backupuser
SQL PasswordThe password of the user who has permission to create SQL Logins.MyGreatPassword!
Database NameThe name of the database to restore to.MyDatabase
S3 Bucket NameThe name of the bucket (including any sub directories) where the backup is stored.MyS3Bucket/backups/sql
Backup File Name and ExtensionThe name of the back up file (including the extension).MyBackup.bak

To use integrated SQL authentication, leave SQL Login and SQL Password blank.

The step template script will cover the following:

  • Download the backup file from the S3 bucket.
  • Invokes rds_restore_database stored procedure on the RDS instance.
  • Display restore progress by percentage.
  • The task will end when the backup file is restored successfully.

Samples

We have a Target - SQL Server Space on our Samples instance of Octopus. You can sign in as Guest to take a look at this example.

Help us continuously improve

Please let us know if you have any feedback about this page.

Send feedback

Page updated on Wednesday, October 4, 2023