Native Backup and Restore with S3
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Operations and security
-
Phase 3: SQL Server on AWS
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
Snapshots copy a whole RDS instance, but most requests you get at work are about one database: “copy production to test”, “send this database to the vendor”, “move our on-premises database to RDS”. RDS SQL Server native backup restore covers all of them using ordinary .bak files kept in Amazon S3.
You’ll switch on the backup option for saat-sql, back up SaatShop to S3 and restore it as a new database from a full plus differential backup chain. Then you’ll break it twice, in the same ways people break it at work.
| Time | You need | By the end you can |
|---|---|---|
| 75 minutes | You need Lessons 42 to 44 finished (saat-sql, Start-SqlLab.ps1, Stop-SqlLab.ps1) and your laptop signed in as saat-admin. It costs a few cents (saat-sql running for an hour plus a few KB in S3). The bucket, role and option stay in place for later lessons and cost next to nothing. | You’ll add SQLSERVER_BACKUP_RESTORE with a safe IAM role, run rds_backup_database and rds_restore_database, follow tasks with rds_task_status, restore a full plus differential chain, and learn the limits before you plan a migration. |
What it is, in one line
RDS SQL Server native backup restore lets you back up a single database to a .bak file in S3 and restore .bak files from S3, using stored procedures in msdb.
In Simple Words
Photocopying one file
An RDS snapshot is like photocopying the whole filing cabinet, which is great after a disaster but no help when someone wants one folder to take to another office. A native backup photocopies just that folder and leaves it in a shared locker (S3), where anyone with the key can pick it up and file it in their own cabinet. On RDS you’re not allowed to walk up to the cabinet yourself, though. You fill in a request slip (a stored procedure) and a clerk makes the copy in the background while you watch the status board.
Engineer's View
How native backup and restore works on RDS
You add the SQLSERVER_BACKUP_RESTORE option to the instance’s option group, with an IAM_ROLE_ARN setting. That role trusts rds.amazonaws.com (limit it with aws:SourceArn and aws:SourceAccount) and allows s3:ListBucket, s3:GetBucketLocation, s3:GetObject, s3:PutObject, s3:GetObjectAttributes, s3:ListMultipartUploadParts and s3:AbortMultipartUpload. For encrypted backups, add the KMS actions and pass @kms_master_key_arn with a symmetric key.
msdb.dbo.rds_backup_database and msdb.dbo.rds_restore_database queue a task and return straight away. msdb.dbo.rds_task_status shows progress and errors, rds_cancel_task stops a task, and up to two tasks can run at once.
FULL and DIFFERENTIAL backups are supported, and @with_norecovery=1 leaves the database waiting for the next restore in a chain. Native log backups aren’t supported.
A few limits are worth remembering. The bucket has to be in the same Region. Each file can be up to 5 TB, and with @number_of_files you can split a backup across up to 10 files. Restores go up to 64 TiB (10 GB on Express), you can’t restore over a database name that already exists, and a native backup that overlaps the automated backup window gets cancelled. If you’re uploading big on-premises .bak files from far away, S3 Transfer Acceleration speeds the upload up, and RDS then reads from the bucket in its own Region.
How it works, step by step
This is what happens when you back up SaatShop.
1You queue a task
You call rds_backup_database with the database name and an S3 ARN, and RDS hands back a task ID and returns immediately.
2RDS writes the .bak with the role
RDS runs the backup in the background and writes the file to S3 with the role from the option group. If the role or the bucket policy is wrong, the task finishes in ERROR and task_info tells you why.
3You watch the status
rds_task_status shows the % complete and where the task is in its lifecycle: CREATED, IN_PROGRESS, SUCCESS, ERROR or CANCELLED.
4Choose the right kind of backup
Native backups do a different job from automated backups and don’t replace them:
Keep automated backups for point-in-time recovery of the whole instance (Lesson 52), and use native backups for single databases, migrations and copies that have to leave RDS.
✅ Checkpoint: You can say what the option group, the IAM role and each of the three msdb procedures do, and when a .bak is a better choice than a snapshot.
Hands-on lab: back up SaatShop to S3 and restore it
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
Sign in, start the SQL lab and set the names:
cd C:\aws-lab
aws login --profile saat-admin
$env:AWS_PROFILE = 'saat-admin'
.\Start-SqlLab.ps1
$acct = aws sts get-caller-identity --query Account --output text
$bak = "saat-sqlbak-$acct-ap-south-1-an"1Create the bucket and the backup role
Paste this whole block:
aws s3api create-bucket --bucket $bak --bucket-namespace account-regional --region ap-south-1 --create-bucket-configuration LocationConstraint=ap-south-1 | Out-Null
aws s3api put-bucket-tagging --bucket $bak --tagging 'TagSet=[{Key=course,Value=saatvedha-aws},{Key=lesson,Value=46}]'
$trust = @{ Version = '2012-10-17'; Statement = @(@{ Effect = 'Allow'; Principal = @{ Service = 'rds.amazonaws.com' }; Action = 'sts:AssumeRole'; Condition = @{ StringEquals = @{ 'aws:SourceAccount' = $acct; 'aws:SourceArn' = @("arn:aws:rds:ap-south-1:$($acct):db:saat-sql", "arn:aws:rds:ap-south-1:$($acct):og:saat-sqlserver-ex-16-og") } } }) }
$trust | ConvertTo-Json -Depth 6 | Set-Content rds-backup-trust.json
$perm = @{ Version = '2012-10-17'; Statement = @(
@{ Effect = 'Allow'; Action = @('s3:ListBucket', 's3:GetBucketLocation'); Resource = "arn:aws:s3:::$bak" },
@{ Effect = 'Allow'; Action = @('s3:GetObjectAttributes', 's3:GetObject', 's3:PutObject', 's3:ListMultipartUploadParts', 's3:AbortMultipartUpload'); Resource = "arn:aws:s3:::$bak/*" }) }
$perm | ConvertTo-Json -Depth 6 | Set-Content rds-backup-s3.json
$roleArn = aws iam create-role --role-name saat-rds-backup-role --assume-role-policy-document file://rds-backup-trust.json --query Role.Arn --output text
aws iam put-role-policy --role-name saat-rds-backup-role --policy-name saat-sqlbak-s3 --policy-document file://rds-backup-s3.json
$roleArnYou should see something like this:
arn:aws:iam::111122223333:role/saat-rds-backup-roleOnly saat-sql and its option group can use this role, and only on this one bucket. That’s deliberately tighter than the role the console would create for you.
2Add the backup option to saat-sql
Paste this whole block. The option group change takes a few minutes to apply:
Start-Sleep 15
aws rds add-option-to-option-group --option-group-name saat-sqlserver-ex-16-og --options "OptionName=SQLSERVER_BACKUP_RESTORE,OptionSettings=[{Name=IAM_ROLE_ARN,Value=$roleArn}]" --apply-immediately --query "OptionGroup.Options[].OptionName" --output text
Start-Sleep 30
aws rds wait db-instance-available --db-instance-identifier saat-sql
aws rds describe-db-instances --db-instance-identifier saat-sql --query "DBInstances[0].OptionGroupMemberships[0].[OptionGroupName,Status]" --output textYou should see something like this:
SQLSERVER_BACKUP_RESTORE
saat-sqlserver-ex-16-og in-syncYou don’t need a reboot for this option. It creates the rds_ procedures in msdb that the next steps rely on.
3Back up SaatShop: full, then differential
Paste this whole block. It adds a status helper, takes a full backup, adds an order and then takes a differential:
function Wait-RdsTask([string]$Db) {
do {
Start-Sleep 15
$rows = sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -h -1 -W -s "|" -Q "SET NOCOUNT ON; exec msdb.dbo.rds_task_status @db_name='$Db'" | Where-Object { $_ -match '\|' }
$f = ($rows | Sort-Object { [int](($_ -split '\|')[0]) } | Select-Object -Last 1) -split '\|'
} until ($f[5] -in 'SUCCESS', 'ERROR', 'CANCELLED')
"$($f[1]) $($f[2]) $($f[3])% $($f[5]) $($f[6])"
}
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "exec msdb.dbo.rds_backup_database @source_db_name='SaatShop', @s3_arn_to_backup_to='arn:aws:s3:::$bak/saatshop-full.bak', @overwrite_s3_backup_file=1, @type='FULL';" | Out-Null
Wait-RdsTask SaatShop
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -d SaatShop -Q "INSERT dbo.Orders (Customer, Amount) VALUES (N'Kiran', 999.00);"
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "exec msdb.dbo.rds_backup_database @source_db_name='SaatShop', @s3_arn_to_backup_to='arn:aws:s3:::$bak/saatshop-diff.bak', @overwrite_s3_backup_file=1, @type='DIFFERENTIAL';" | Out-Null
Wait-RdsTask SaatShop
aws s3 ls "s3://$bak/"You should see something like this:
BACKUP_DB SaatShop 100% SUCCESS Task execution has completed successfully.
(1 rows affected)
BACKUP_DB_DIFFERENTIAL SaatShop 100% SUCCESS Task execution has completed successfully.
2026-10-20 10:12:41 3215360 saatshop-full.bak
2026-10-20 10:14:02 118784 saatshop-diff.bakThe full backup holds everything and the differential only holds what changed after it, which is why it’s so small. At work you might take a full on Sunday and a differential each night in the run-up to a migration weekend.

4Restore the chain as a new database
Paste this whole block:
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "exec msdb.dbo.rds_restore_database @restore_db_name='SaatShopCopy', @s3_arn_to_restore_from='arn:aws:s3:::$bak/saatshop-full.bak', @with_norecovery=1, @type='FULL';" | Out-Null
Wait-RdsTask SaatShopCopy
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "SELECT name, state_desc FROM sys.databases WHERE name = 'SaatShopCopy'"
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "exec msdb.dbo.rds_restore_database @restore_db_name='SaatShopCopy', @s3_arn_to_restore_from='arn:aws:s3:::$bak/saatshop-diff.bak', @with_norecovery=0, @type='DIFFERENTIAL';" | Out-Null
Wait-RdsTask SaatShopCopy
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "SELECT COUNT(*) AS orders FROM SaatShopCopy.dbo.Orders"You should see something like this:
RESTORE_DB SaatShopCopy 100% SUCCESS Task execution has completed successfully.
name state_desc
------------- ----------
SaatShopCopy RESTORING
RESTORE_DB_DIFFERENTIAL SaatShopCopy 100% SUCCESS Task execution has completed successfully.
orders
------
4After the full restore the copy sits in RESTORING, waiting for more. The differential then brought in Kiran’s order and opened the database. That’s how you move an on-premises database with a short outage: take the full backup days ahead and the differential during the cutover.

Want the file on your laptop? aws s3 cp "s3://$bak/saatshop-full.bak" . downloads it, and any SQL Server 2022 or later can restore it.
✅ Checkpoint: rds_task_status shows SUCCESS for both backups and both restores, saatshop-full.bak and saatshop-diff.bak are in the bucket, and SaatShopCopy has 4 orders.
Break It, Then Fix It
Here are two errors you’ll run into on real migrations.
1Break it: run a backup without the option
Remove the option, wait a little, then try a backup:
aws rds remove-option-from-option-group --option-group-name saat-sqlserver-ex-16-og --options SQLSERVER_BACKUP_RESTORE --apply-immediately | Out-Null
Start-Sleep 30
aws rds wait db-instance-available --db-instance-identifier saat-sql
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "exec msdb.dbo.rds_backup_database @source_db_name='SaatShop', @s3_arn_to_backup_to='arn:aws:s3:::$bak/test.bak', @type='FULL';"You’ll get an error like this:
Msg 2812, Level 16, State 62, Server EC2AMAZ-ABC123, Line 1
Could not find stored procedure 'msdb.dbo.rds_backup_database'.The procedures only exist while the option is in the instance’s option group. New instances often end up on the default option group, so on most migration projects this is the very first error. Fix: add the option back and check the procedure is there:
aws rds add-option-to-option-group --option-group-name saat-sqlserver-ex-16-og --options "OptionName=SQLSERVER_BACKUP_RESTORE,OptionSettings=[{Name=IAM_ROLE_ARN,Value=$roleArn}]" --apply-immediately | Out-Null
Start-Sleep 30
aws rds wait db-instance-available --db-instance-identifier saat-sql
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -h -1 -Q "SET NOCOUNT ON; SELECT name FROM msdb.sys.procedures WHERE name = 'rds_backup_database'"You should see this:
rds_backup_database2Break it: restore over an existing database
Try restoring the full backup as SaatShop:
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "exec msdb.dbo.rds_restore_database @restore_db_name='SaatShop', @s3_arn_to_restore_from='arn:aws:s3:::$bak/saatshop-full.bak', @type='FULL';"You’ll get an error like this:
Msg 50000, Level 16, State 1, Procedure msdb.dbo.rds_restore_database
Database 'SaatShop' already exists. Two databases that differ only by case or accent are not allowed. Choose a different database name.
RDS has no WITH REPLACE. It stops you overwriting live data by accident, but it catches out people who only want to refresh a test database.
Fix: restore under a new name, or if you really do want to replace it, drop the old database first. Here you’ll drop the copy and restore it fresh:
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "DROP DATABASE SaatShopCopy;"
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "exec msdb.dbo.rds_restore_database @restore_db_name='SaatShopCopy', @s3_arn_to_restore_from='arn:aws:s3:::$bak/saatshop-full.bak', @type='FULL';" | Out-Null
Wait-RdsTask SaatShopCopyYou should see something like this:
RESTORE_DB SaatShopCopy 100% SUCCESS Task execution has completed successfully.Now clean up, but keep the bucket, the role and the option, because Lessons 50, 52 and 63 use them and a few KB in S3 costs almost nothing.
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "DROP DATABASE SaatShopCopy;"
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -d SaatShop -Q "DELETE dbo.Orders WHERE Customer = N'Kiran';"
Remove-Item rds-backup-trust.json, rds-backup-s3.json
.\Stop-SqlLab.ps1✅ Checkpoint: You fixed a missing stored procedure by adding the option back, and a name clash by dropping the database and restoring again. SaatShopCopy is gone, SaatShop still has its 3 orders, and saat-sql is stopping.
This happened at work
The test refresh that took down sales reporting
A retail company refreshed its UAT database from production every Friday using native backup and restore. To get round the “already exists” error, a new DBA wrote a script that dropped the target database and then restored the latest .bak.
One Friday the script’s variables were the wrong way round. It dropped SalesDW on the production reporting instance and started restoring a UAT backup in its place, and reports stayed down for six hours while the team restored the real database from the previous night’s native backup.
After that they changed the process: restore into a new name with a date suffix, check it, and rename only then. Dropping a database now needs a second person to approve it, and the production role no longer has DROP DATABASE.
Common mistakes and troubleshooting
| Mistake | What happens | What to do |
|---|---|---|
| Instance on the default option group | Msg 2812: procedure not found | A custom option group with SQLSERVER_BACKUP_RESTORE |
| Bucket in another Region | Task fails | A bucket in the same Region as the instance |
| Role missing ListBucket or GetBucketLocation | ERROR, with access denied in task_info | Bucket-level and object-level actions on the correct ARNs |
| Expecting WITH REPLACE | Database already exists | Restore to a new name, or drop first, carefully |
| Backup during the backup window | The native task is cancelled | Schedule outside the automated backup window |
| Huge database in one file | It hits the 5 TB per-file limit | Split with @number_of_files (up to 10) |
Interview questions
Click a question to open it. Each one is worded the way an interviewer would ask it, and underneath you’ll find why they ask and one way you could answer in your own words.
Fresher level
1. A developer asks you for a backup of just one database from RDS SQL Server. How would you do that?
Why they ask this: It’s a common everyday request, and they want to know you can take a native backup on RDS where you don’t get normal server access.
How you might answer: I’d add the SQLSERVER_BACKUP_RESTORE option to the instance’s option group, with an IAM role that can write to the S3 bucket, and then run msdb.dbo.rds_backup_database, which writes a .bak file to S3.
2. You started a native backup on RDS. How would you check whether it’s finished and worked?
Why they ask this: Backups and restores on RDS run in the background, so they’re checking you know how to follow a task you can’t watch on screen.
How you might answer: I’d run exec msdb.dbo.rds_task_status with @db_name or @task_id and look at the lifecycle, the percent complete and task_info, which carries the error message if something failed.
3. Someone deleted data in one database, and you only want to bring back that database. Would you use a native backup or a snapshot?
Why they ask this: Pick the wrong tool and you could end up restoring a whole instance for one database, so they want to see you match the recovery tool to the problem.
How you might answer: A native .bak backup, because it restores just that one database. A snapshot restores a whole new instance, which is overkill when only one database is affected.
2–5 years experience
4. A restore task on RDS ends in ERROR with access denied. What would you check?
Why they ask this: This error has several possible causes, and they want to hear you check permissions in a sensible order without skipping any.
How you might answer: I’d start with the role ARN in the option group, plus its trust policy and conditions. Then I’d confirm it has s3:ListBucket and GetBucketLocation on the bucket, GetObject on the file, and KMS permissions if the backup is encrypted.
And I’d make sure the bucket is in the same Region as the instance.
5. You need to move a 2 TB on-premises database to RDS, and the business only allows a short outage. How would you plan it?
Why they ask this: They want migration planning that keeps downtime low, and they’re checking you know more than one way to do it.
How you might answer: A few days before cutover I’d take a full backup to S3, split into several files and uploaded with Transfer Acceleration, and restore it WITH NORECOVERY. At cutover I’d take a differential, restore that with recovery and switch the app across.
If they needed close to zero downtime, I’d go with DMS and CDC instead.
6. What are the limits of native backup and restore on RDS that you’d warn a team about?
Why they ask this: Running into these limits halfway through a migration causes delays, so they’re checking you know where native backup stops working.
How you might answer: It can’t take log backups, can’t restore over an existing database name and can’t use a bucket in another Region. It doesn’t work for FILESTREAM databases either, and on Express edition you can’t restore anything over 10 GB.
Senior level
7. The test team wants a fresh copy of 20 production databases in UAT every week. How would you design that?
Why they ask this: They want automation with safety built in, where sensitive data is protected and production stays out of harm’s way.
How you might answer: I’d schedule a job with EventBridge plus Lambda or SSM Automation that takes native backups and restores them to dated names in UAT, masks the sensitive data, and swaps the names only once the checks pass.
The job’s permissions would only allow changes in UAT, and each run would leave an audit trail.
8. Compliance wants native backups kept as an archive that nobody can tamper with. How would you protect them?
Why they ask this: They want to see you protect data against both mistakes and attackers, so that production can’t destroy its own archive.
How you might answer: I’d encrypt the backups with KMS and keep them in an S3 bucket with versioning, Object Lock, lifecycle rules to Glacier and cross-Region replication. That bucket would sit in a separate account that production can write to but can’t delete from.
Quick quiz
Q1. Which option enables native backup on RDS SQL Server?
- SQLSERVER_AUDIT
- SQLSERVER_BACKUP_RESTORE
- TDE
- SSIS
Show answer
B: it adds the rds_ procedures and links the IAM role.
Q2. What does rds_backup_database return?
- The finished file
- A queued task
- Nothing until done
- A snapshot
Show answer
B: the work happens in the background, so you check rds_task_status.
Q3. Why did restoring as SaatShop fail?
- No permission
- The database already exists
- The bucket was empty
- TLS
Show answer
B: RDS can’t restore over a name that already exists.
Q4. Where must the S3 bucket be?
- Any Region
- The same Region as the instance
- us-east-1
- On premises
Show answer
B: buckets in another Region aren’t supported.
Q5. Which restore leaves the database ready for a differential?
- @with_norecovery=1
- @type=’LOG’
- @overwrite=1
- @number_of_files=2
Show answer
A: the database stays in RESTORING.
Quick recap
- SQLSERVER_BACKUP_RESTORE with a tight IAM role turns on native backups to S3.
- rds_backup_database and rds_restore_database queue tasks, and rds_task_status lets you follow them.
- A full plus differential with NORECOVERY keeps the outage short during a migration.
- Remember the limits: no log backups, no WITH REPLACE, a same-Region bucket, 5 TB per file and 10 GB restores on Express.
- Use a native .bak for single databases and snapshots for whole instances.
Next lesson
Lesson 47: AWS DMS: replication instance, endpoints and full load → Next you’ll copy SaatShop to a new target with AWS Database Migration Service and see what it moves and what it leaves behind.
Further reading: RDS SQL Server native backup restore
Want to go deeper into RDS SQL Server native backup restore? Read Importing and exporting SQL Server databases using native backup and restore and Support for native backup and restore in SQL Server. You can also see the full plan for this course on the AWS Cloud Administration course page.
