Native SQL Server database backup to a URL pointed at Azure Blob Storage (Azure storage) has been available since SQL Server 2012 SP1 CU2/SQL Server 2014.
SQL Server 2022 introduces the ability to write backups to S3-compatible object storage.
While SQL Server 2025 is already available (you can read our blog post about it), most of the instances that we deal with are still running older SQL Server versions (2019 or lower). We are helping our clients migrate to newer versions either because they want to use some new features/improvements or due to their tech refreshes. If you are on the same journey and need help, get in touch.)
Automation and backups to S3 buckets
Recently, we had a project with a client that is running SQL Server on EC2 instances, and they wanted to move from their current backup solution using a 3rd party application to SQL Server native backup and store them in S3 buckets.
Pre-requirements checked (they are running SQL Server 2022), and we were good to use backup to S3 buckets as both source and destination.
Within the Masterminds group, we love automation! It helps us handle repetitive tasks steadily and predictably, and is less error-prone!
Enter dbatools
To make it easy for the client to configure existing instances or deploy the solution to new ones, we heavily rely on the dbatools PowerShell module. This is great for setting up all the pre-requirements, like creating and maintaining SQL Credentials to authenticate with the S3 bucket, and deploying agent jobs using Ola’s solution (also supports backups to S3!).
The client also wanted a quick way to restore a backup from an S3 bucket. What better way than to rely on dbatools to check the backup history (read the backup headers or relying on backup history), build the restore chain and run the restore?
Easy, right? But is the functionality available on dbatools?
It’s easier when the tool already has the functionality built in. However, we shouldn’t take for granted that dbatools has some specific feature and/or supports a specific SQL Server functionality. You should always double-check if a specific feature exists, and if not, you should, open a “Feature Request”.
While it’s 2026 and this SQL Server feature appeared in 2022, at the time we were checking this project, dbatools didn’t support backups to S3 buckets (it only supported Azure Blob Storage).
There was an old request opened in 2024 asking for it, but because the demand was not too high and no one had invested the time in building it, it simply wasn’t there.
Add it to dbatools
With that open request which showed some people’s interest, our client’s needs, and ultimately, being able to enrich the PowerShell module so that more people can take advantage of it, I did the development to support native SQL Server backups to S3 using dbatools. (If you are curious about it, these were the PRs used #10126 and #10137)
It’s available!
Since dbatools version v2.7.23, you can do native backups/restores to/from S3 buckets!
Go and give it a try!
Code example
The following are quick code examples on how you can set up and run a backup to and a restore from S3 using dbatools.
Don’t forget to read the documentation for both SQL Server pre-requirements and dbatools commands.
Create a SQL Credential
For SQL Server to communicate with an S3 bucket, we need to have a SQL Credential.
# Create S3 credential (AWS S3 or MinIO)
$s3Params = @{
SqlInstance = "sql2022"
Name = "s3://mybucket.s3.us-west-2.amazonaws.com/backups"
Identity = "S3 Access Key"
SecurePassword = (ConvertTo-SecureString "AKIAIOSFODNN7EXAMPLE:wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" -AsPlainText -Force)
}
New-DbaCredential @s3ParamsTo backup
You need to mention your StorageBaseUrl and StorageCredential
# Backup to S3
$splatBackup = @{
SqlInstance = "sql2022"
Database = "MyDatabase"
Type = "Full"
StorageBaseUrl = "s3://mybucket.s3.us-west-2.amazonaws.com/backups/sql2022/MyDatabase"
StorageCredential = "s3://mybucket.s3.us-west-2.amazonaws.com/backups"
CompressBackup = $true
}
Backup-DbaDatabase @splatBackupTo restore
In this example, we read the backup history, and by passing the StorageCredential we can read the backup from the S3 bucket path and restore it.
# Restore database from S3 backup
$splatRestore = @{
SqlInstance = "sql2022"
DatabaseName = "MyDatabase_Restored"
StorageCredential = "s3://mybucket.s3.us-west-2.amazonaws.com/backups"
MaintenanceSolutionBackup = $true
ReplaceDbNameInFile = $true
}
Get-DbaDbBackupHistory -SqlInstance "sql2022" -Database "MyDatabase" -Last | Restore-DbaDatabase @SplatRestoreWe leverage heavily on community tools
We have decades of experience with SQL Server, and we are using the most well-known and emerging community tools.
Often, you will find some of us contributing to those in any shape or form. It can be just fixing some documentation, reporting a bug or building a whole new feature.
We love the community and sharing knowledge.
Back to you
Do you have a specific challenge that may need our help? Maybe building a new pipeline, or automating some tasks?
Aren’t sure? Drop us a message, let’s chat.

