Native Restore Failures on RDS SQL Server
-
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
Native restores tend to fail halfway through a migration, usually late at night, with a task that only says ERROR. To solve an RDS restore database error you have to remember that RDS reads your .bak file with the option group’s IAM role and not with your permissions, and then check that role, its trust, the file and the bucket, in that order.
You’ll build Test-NativeRestore.ps1, which checks everything rds_restore_database needs, then restore a database and read the full task_info. After that you break the restore twice (once with a role that can’t read the file, once with a typo in the key) and fix both from what the evidence tells you.
| Time | You need | By the end you can |
|---|---|---|
| 60 minutes | Lesson 46 done (saat-rds-backup-role, the SQLSERVER_BACKUP_RESTORE option, saatshop-full.bak in your backup bucket), Start-SqlLab.ps1, Windows PowerShell 5.1, signed in as saat-admin. Cost: a few cents for saat-sql running about an hour. | Read rds_task_status in full, check the option group role, its trust conditions and its S3 permissions with the policy simulator, confirm the backup file and its Region, and fix restores that fail with Access Denied or a missing key. |
What it is, in one line
An RDS restore database error is a failed rds_restore_database task, and nearly always it’s because the option group’s role can’t read the backup file, the file path is wrong, or something about the database or the option is missing.
In Simple Words
Sending a courier
You don’t go and fetch the parcel yourself; you send a courier with a letter of permission, and if the warehouse won’t accept that letter the parcel doesn’t come, however important you are. The courier also needs the exact shelf number, because “Shelf B-12” when it’s really “B-21” is a wasted trip. RDS’s restore task is that courier: the IAM role is its letter and the S3 key is the shelf number.
Engineer's View
What the restore task depends on
The instance’s option group has to include SQLSERVER_BACKUP_RESTORE with an IAM_ROLE_ARN, and that role has to trust rds.amazonaws.com. If the trust uses aws:SourceArn, it must list this instance or its option group (a restored copy with a new name often isn’t in the list). The role’s policy needs s3:GetObject on the file and s3:ListBucket and s3:GetBucketLocation on the bucket, plus kms:Decrypt if the file is SSE-KMS or was backed up with @kms_master_key_arn.
The bucket has to be in the instance’s Region and the key has to match exactly, case included (or use * for multi-file backups). The usual database rules still apply too: no existing database with that name, Express restores only up to 10 GB, no FILESTREAM, and the backup can’t come from a newer SQL Server version than the instance runs.
rds_task_status gives you task_info with the reason, often spread over several lines, so reading it through a tool that keeps the line breaks saves you time. IAM’s policy simulator can then test the role’s permissions against the exact object ARN.
How it works, step by step
When a restore fails, work through it in this order.
1Read the whole task_info
“Access Denied”, “does not exist” and the version messages each send you to a different place, so don’t stop reading at the word ERROR.
2Check the role, not yourself
Find the role in the option group, look at its trust policy and conditions, and then simulate its S3 permissions on the exact file.
3Check the file and the database
Check the exact key, the Region, the encryption and the size limits, and whether a database with the target name already exists.
4Know the common messages
Most failures land in one of a few groups:
Keep a checklist script for this, because restores fail most often during migrations, when everyone is tired and rushing.
✅ Checkpoint: You can explain why the option group’s role matters more than your permissions, and list what the role needs for SSE-S3 and SSE-KMS backups.
Hands-on lab: pre-flight, restore, break, fix
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 add the helpers. Wait-Restore reads rds_task_status through .NET, which keeps every line of task_info intact:
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"
function Get-SqlPw([string]$Db) {
$a = aws rds describe-db-instances --db-instance-identifier $Db --query "DBInstances[0].MasterUserSecret.SecretArn" --output text
(aws secretsmanager get-secret-value --secret-id $a --query SecretString --output text | ConvertFrom-Json).password
}
$csb = New-Object System.Data.SqlClient.SqlConnectionStringBuilder
$csb['Data Source'] = '127.0.0.1,11433'; $csb['User ID'] = 'saatadmin'; $csb['Password'] = (Get-SqlPw saat-sql); $csb['Encrypt'] = $true; $csb['TrustServerCertificate'] = $true
function Wait-Restore([string]$Db) {
do {
Start-Sleep 15
$cn = New-Object System.Data.SqlClient.SqlConnection $csb.ConnectionString; $cn.Open()
$cm = $cn.CreateCommand(); $cm.CommandText = 'exec msdb.dbo.rds_task_status @db_name = @db'; [void]$cm.Parameters.AddWithValue('@db', $Db)
$t = New-Object System.Data.DataTable; $t.Load($cm.ExecuteReader()); $cn.Close()
$row = $t.Rows | Sort-Object { [int]$_.task_id } | Select-Object -Last 1
} until ($row.lifecycle -in 'SUCCESS', 'ERROR', 'CANCELLED')
"$($row.task_type) $($row.lifecycle)"
($row.task_info -replace '\s+', ' ').Trim()
}
function Start-Restore([string]$Key, [string]$Name) {
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "exec msdb.dbo.rds_restore_database @restore_db_name='$Name', @s3_arn_to_restore_from='arn:aws:s3:::$bak/$Key';" | Out-Null
Wait-Restore $Name
}
aws s3 ls "s3://$bak/" | Select-String '\.bak'You should see something like this:
2026-10-20 10:12:41 3215360 saatshop-full.bak
2026-10-20 10:14:02 118784 saatshop-diff.bak1Check everything the restore needs
Paste this whole block (Test-NativeRestore.ps1 stays in C:\aws-lab):
$tnr = @'
param([string]$Db = 'saat-sql', [Parameter(Mandatory)][string]$S3Arn)
function Show([bool]$Ok, [string]$Text) { if ($Ok) { "[ OK ] $Text" } else { "[FAIL] $Text" } }
$bucket, $key = ($S3Arn -replace '^arn:aws:s3:::', '') -split '/', 2
$r = aws rds describe-db-instances --db-instance-identifier $Db --query "DBInstances[0]" --output json | ConvertFrom-Json
$region = ($r.DBInstanceArn -split ':')[3]
$og = $r.OptionGroupMemberships[0].OptionGroupName
$roleArn = aws rds describe-option-groups --option-group-name $og --query "OptionGroupsList[0].Options[?OptionName=='SQLSERVER_BACKUP_RESTORE'] | [0].OptionSettings[?Name=='IAM_ROLE_ARN'] | [0].Value" --output text
Show ($roleArn -and $roleArn -ne 'None') "Option group $og has SQLSERVER_BACKUP_RESTORE with role $roleArn"
if (-not $roleArn -or $roleArn -eq 'None') { return }
$roleName = ($roleArn -split '/')[-1]
$trust = aws iam get-role --role-name $roleName --query Role.AssumeRolePolicyDocument --output json | ConvertFrom-Json
$st = @($trust.Statement | Where-Object { $_.Principal.Service -contains 'rds.amazonaws.com' -and $_.Effect -eq 'Allow' })
Show ($st.Count -gt 0) "Role trusts rds.amazonaws.com"
$src = @($st.Condition.StringEquals.'aws:SourceArn' | Where-Object { $_ })
$ogArn = "arn:aws:rds:$($region):$(($r.DBInstanceArn -split ':')[4]):og:$og"
Show (($src.Count -eq 0) -or ($src -contains $r.DBInstanceArn) -or ($src -contains $ogArn)) "Trust condition covers this instance or its option group"
$loc = aws s3api get-bucket-location --bucket $bucket --query LocationConstraint --output text 2>$null
Show ($loc -eq $region) "Bucket $bucket is in $loc (instance is in $region)"
$head = aws s3api head-object --bucket $bucket --key $key --output json 2>$null | ConvertFrom-Json
Show ([bool]$head) "Object $key exists ($([math]::Round($head.ContentLength / 1MB, 1)) MB, encryption $($head.ServerSideEncryption))"
foreach ($t in @(@('s3:GetObject', "arn:aws:s3:::$bucket/$key"), @('s3:ListBucket', "arn:aws:s3:::$bucket"), @('s3:GetBucketLocation', "arn:aws:s3:::$bucket"))) {
$d = aws iam simulate-principal-policy --policy-source-arn $roleArn --action-names $t[0] --resource-arns $t[1] --query "EvaluationResults[0].EvalDecision" --output text
Show ($d -eq 'allowed') "Role policy: $($t[0]) is $d"
}
if ($head.ServerSideEncryption -eq 'aws:kms') { " KMS-encrypted object: the role also needs kms:Decrypt on $($head.SSEKMSKeyId)" }
'@
$tnr | Set-Content C:\aws-lab\Test-NativeRestore.ps1
.\Test-NativeRestore.ps1 -S3Arn "arn:aws:s3:::$bak/saatshop-full.bak"You should see something like this:
[ OK ] Option group saat-sqlserver-ex-16-og has SQLSERVER_BACKUP_RESTORE with role arn:aws:iam::111122223333:role/saat-rds-backup-role
[ OK ] Role trusts rds.amazonaws.com
[ OK ] Trust condition covers this instance or its option group
[ OK ] Bucket saat-sqlbak-111122223333-ap-south-1-an is in ap-south-1 (instance is in ap-south-1)
[ OK ] Object saatshop-full.bak exists (3.1 MB, encryption AES256)
[ OK ] Role policy: s3:GetObject is allowed
[ OK ] Role policy: s3:ListBucket is allowed
[ OK ] Role policy: s3:GetBucketLocation is allowedEvery link in the chain checks out before you run anything, and the simulator is testing the role you built in Lesson 46, which is the one RDS will really use.

2Restore and read the full task_info
Paste this whole block:
Start-Restore 'saatshop-full.bak' 'SaatShopTest'
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -h -1 -Q "SET NOCOUNT ON; SELECT COUNT(*) FROM SaatShopTest.dbo.Orders"You should see something like this:
RESTORE_DB SUCCESS
[2026-10-20 10:31:02.557] Task execution has started. [2026-10-20 10:31:08.120] SaatShopTest.bak: Completed processing 100.00% of 3215360 bytes. [2026-10-20 10:31:10.887] Command execution completed successfully.
3task_info works like a small log with a time stamp for each stage, and when a restore fails, the last few lines tell you why.

3Clean the test database
Drop it so the name is free again for the breaks:
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "DROP DATABASE SaatShopTest;"You should see no output.
✅ Checkpoint: Test-NativeRestore.ps1 shows all OK, the restore of SaatShopTest succeeded with 3 orders, and the full task_info shows each stage.
Break It, Then Fix It
Here are two failures you will meet in real migrations.
1Break it: the role can’t read the file
Replace the role’s policy with one that’s missing s3:GetObject, the kind of thing a hurried “least privilege” edit does, and then restore:
@{ Version = '2012-10-17'; Statement = @(
@{ Effect = 'Allow'; Action = @('s3:ListBucket', 's3:GetBucketLocation'); Resource = "arn:aws:s3:::$bak" },
@{ Effect = 'Allow'; Action = @('s3:PutObject', 's3:ListMultipartUploadParts', 's3:AbortMultipartUpload'); Resource = "arn:aws:s3:::$bak/*" }) } | ConvertTo-Json -Depth 5 | Set-Content rds-backup-s3.json
aws iam put-role-policy --role-name saat-rds-backup-role --policy-name saat-sqlbak-s3 --policy-document file://rds-backup-s3.json
Start-Sleep 20
Start-Restore 'saatshop-full.bak' 'SaatShopTest'
.\Test-NativeRestore.ps1 -S3Arn "arn:aws:s3:::$bak/saatshop-full.bak" | Select-String 'FAIL'You’ll get something like this:
RESTORE_DB ERROR
[2026-10-20 10:40:15.003] Task execution has started. [2026-10-20 10:40:16.441] Aborted the task because of a task failure or a concurrent RESTORE_DB request. [2026-10-20 10:40:16.502] Task has been aborted [2026-10-20 10:40:16.503] Access Denied
[FAIL] Role policy: s3:GetObject is implicitDenyThat “Access Denied” comes from S3 refusing the role. You as admin could read the file all day long and it wouldn’t change anything.
Backups carry on working with this policy because PutObject is still there, which is why nobody notices until the day someone needs a restore. Fix: put the full policy back, then restore:
@{ 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/*" }) } | ConvertTo-Json -Depth 5 | Set-Content rds-backup-s3.json
aws iam put-role-policy --role-name saat-rds-backup-role --policy-name saat-sqlbak-s3 --policy-document file://rds-backup-s3.json
Start-Sleep 20
Start-Restore 'saatshop-full.bak' 'SaatShopTest'You should see something like this (first line):
RESTORE_DB SUCCESS2Break it: a typo in the key
Drop the test database, then restore again with one letter missing from the file name:
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "DROP DATABASE SaatShopTest;"
Start-Restore 'saatshop-ful.bak' 'SaatShopTest'
.\Test-NativeRestore.ps1 -S3Arn "arn:aws:s3:::$bak/saatshop-ful.bak" | Select-String 'FAIL'You’ll get something like this:
RESTORE_DB ERROR
[2026-10-20 10:52:40.112] Task execution has started. [2026-10-20 10:52:41.020] Aborted the task because of a task failure or a concurrent RESTORE_DB request. [2026-10-20 10:52:41.077] Task has been aborted [2026-10-20 10:52:41.078] The specified key does not exist.
[FAIL] Object saatshop-ful.bak exists (0 MB, encryption )
Keys are exact and case-sensitive, so “SaatShop-Full.bak” fails the same way. Since the role has ListBucket, S3 is allowed to tell you “does not exist” instead of a vaguer Access Denied. Fix: copy the key from a listing, then restore:
$key = (aws s3api list-objects-v2 --bucket $bak --prefix saatshop-f --query "Contents[0].Key" --output text)
Start-Restore $key 'SaatShopTest'You should see something like this (first line):
RESTORE_DB SUCCESSNow clean up. The bucket, role and option stay as you left them in Lesson 46:
sqlcmd -S "127.0.0.1,11433" -U saatadmin -C -Q "DROP DATABASE SaatShopTest;"
Remove-Item rds-backup-s3.json
.\Stop-SqlLab.ps1✅ Checkpoint: You fixed an Access Denied restore by restoring s3:GetObject to the option group role and a missing-key restore by copying the exact key. SaatShopTest is gone, the role policy is back to full, and saat-sql is stopping.
This happened at work
The migration weekend that failed at 2 a.m.
A school group was moving 40 databases to RDS using native backups, and every test restore had worked. Then at 2 a.m. on the migration night, each restore came back with Access Denied. The DBAs spent the first hour going through bucket policies, because the restore task’s message said nothing about KMS. What had changed was the backups themselves: two days earlier, at the security team’s request, the on-premises team had started taking them with a new customer managed KMS key. The option group’s role could read the bucket but had no kms:Decrypt on that new key. Adding it took two minutes and the migration was done by morning. Their runbook now includes a pre-flight checklist that runs against the real files the day before, and it checks the encryption and key of every backup.
Common mistakes and troubleshooting
| Mistake | What happens | What to do |
|---|---|---|
| Checking your own permissions | Everything looks fine; restore still fails | Check the option group role |
| Role without s3:GetObject | Access Denied (backups may still work) | GetObject on bucket objects |
| Missing kms:Decrypt for KMS backups | Access Denied with no KMS hint | Grant kms:Decrypt on the key to the role |
| Trust SourceArn not covering a new instance | Role can’t be assumed | List the instance or option group ARN |
| Typos or wrong case in the key | Key does not exist | Copy keys from aws s3 ls |
| Reading only the first line of task_info | Missing the actual reason | Read every line; use a tool that keeps them |
Interview questions
Click a question to open it. Each one is worded the way an interviewer would ask it, and underneath you’ll see why they ask it and one way you could answer in your own words.
Fresher level
1. When you run rds_restore_database, whose permissions does RDS use to read the backup from S3?
Why they ask this: They’re checking that you know RDS reads S3 with its own role, because that’s the key to fixing most restore errors.
How you might answer: RDS uses the IAM role set in the SQLSERVER_BACKUP_RESTORE option, in the option group attached to the instance, and never my own login or permissions. So when a restore fails on access, that role is the first thing I look at.
2. A native restore on RDS failed. Where would you look to find out why?
Why they ask this: They want to see that you know where RDS keeps the details of a restore and don’t just guess from a short error.
How you might answer: I’d run exec msdb.dbo.rds_task_status and read the task_info column, which logs each stage of the task and the exact error. Most of the time the reason is written right there in plain words.
3. What S3 permissions does the restore role need?
Why they ask this: They want to know you can write a working policy for the role, including the encryption part people tend to forget.
How you might answer: It needs s3:GetObject on the backup files and s3:ListBucket and s3:GetBucketLocation on the bucket. If the backups are encrypted with KMS, it also needs kms:Decrypt on the key.
2–5 years experience
4. A restore fails with Access Denied, but you can download the same backup file yourself. What’s going on?
Why they ask this: They want to see that you understand your own access has nothing to do with what RDS can reach.
How you might answer: RDS reads the file with the option group role, so my own access doesn’t come into it. I’d check that role’s policy, the conditions in its trust policy such as aws:SourceArn, and the KMS permissions, and usually one of those is missing something.
5. Restores work fine on saat-sql, but fail on a copy you restored from a snapshot. What would you suspect?
Why they ask this: They’re testing whether you understand trust policy conditions, a subtle cause that catches people out after they clone an instance.
How you might answer: My first suspect would be the role’s trust policy. If it uses aws:SourceArn and lists only the original instance, the new copy isn’t trusted, and the fix is to add the new instance or option group ARN to that condition.
6. Before a migration with native backups, which restore limits would you check?
Why they ask this: They want to see that you plan ahead and find blockers before migration night, not during it.
How you might answer: I’d check that the bucket is in the same Region and that each file is at most 5 TB, with up to 10 files, and the total stays under 64 TiB (or 10 GB on Express). FILESTREAM isn’t supported. I’d also check version compatibility, make sure database names are unique, and remember only two tasks can run at once.
Senior level
7. You have to migrate 100 databases with native backups. How would you design a pre-flight check?
Why they ask this: They want to see that you can automate checks at scale and take the surprises out of cutover.
How you might answer: I’d write a script that goes through every file and checks the option, the role and its trust policy, the simulated permissions and that the object exists. It would also compare sizes with the edition limits and check encryption and KMS grants, the Region and name clashes. Then I’d run it the day before and once more just before cutover.
8. How would you automate native restores safely?
Why they ask this: They’re looking for automation with proper error handling and clear limits on what it’s allowed to do.
How you might answer: I’d use Step Functions or SSM Automation to call rds_restore_database over a secure connection and then poll rds_task_status, reading task_info for errors and alerting us when something fails. The one rule I’d never break is that the automation must not drop an existing database on its own.
Quick quiz
Q1. Whose permissions does RDS use to read the .bak?
- Yours
- The option group role
- The bucket owner
- AWS Support
Show answer
B — IAM_ROLE_ARN in the option.
Q2. Backups work but restores fail with Access Denied. Likely cause?
- Wrong Region
- Role lacks s3:GetObject
- Database exists
- Express limit
Show answer
B — PutObject is enough for backups.
Q3. Where do you read the restore failure reason?
- CloudTrail
- task_info in rds_task_status
- S3 access logs
- The SQL error log only
Show answer
B — It logs each stage.
Q4. What does “The specified key does not exist” mean?
- Bad role
- Wrong file path or case
- KMS
- Option missing
Show answer
B — Keys are exact.
Q5. Which tool tests the role’s permission on the exact file?
- aws s3 ls
- iam simulate-principal-policy
- sqlcmd
- ping
Show answer
B — Use the object ARN.
Quick recap
- RDS reads backups with the option group’s role, not with your own rights.
- The role needs trust, GetObject, ListBucket, GetBucketLocation and maybe kms:Decrypt.
- Read every line of task_info, because the reason is usually near the end.
- Keys are exact and case-sensitive, and the bucket has to be in the same Region.
- Run a pre-flight check against the real files before migration night.
Next lesson
Lesson 64: DMS task stuck or failing during CDC → You’ll diagnose DMS tasks that stall or fail during CDC: log truncation, duplicate keys and table preparation settings.
Further reading: RDS restore database error
Want to go deeper into RDS restore database error? Read Using native backup and restore and Troubleshooting native backup and restore. You can also see the full plan for this course on the AWS Cloud Administration course page.
