High Availability: RDS Multi-AZ for SQL Server

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.

Single-AZ RDS is one server, so when AWS patches it or its host fails, your database stays down until it comes back. RDS SQL Server Multi-AZ keeps a synchronous standby in another Availability Zone and fails over to it automatically, usually in about a minute, behind the same endpoint.

You’ll create a Standard edition Multi-AZ instance, force a failover while a small client keeps writing and measure what the app sees, and then find two things that won’t survive a failover unless you plan for them.

TimeYou needBy the end you can
100 minutes (about 40 of it creating the instance)Lessons 42 to 53 done (saat-db-subnets across two AZs, Start-SqlLab.ps1, the Lesson 14 endpoint scripts), Windows PowerShell 5.1, signed in as saat-admin. Cost: about USD 3 if you finish within 90 minutes. Express doesn’t support Multi-AZ, so this uses Standard edition, and a Multi-AZ SQL Server instance can’t be stopped: you delete it at the end.Explain the Multi-AZ modes (AGs, mirroring, block level replication), create and check a Multi-AZ instance, force a failover and measure it, write clients that retry, and deal with what isn’t replicated.

What it is, in one line

RDS SQL Server Multi-AZ keeps a synchronous standby copy in a second Availability Zone and moves the endpoint over to it automatically during failures and maintenance.

In Simple Words

A spare driver in the passenger seat

On a long-distance bus there are often two drivers, one at the wheel and the other sitting beside them watching every turn. If the first one feels unwell, the bus pulls over and the second takes over within a minute, so the passengers feel a short stop instead of a breakdown, and the bus number, the route and the people on board all stay the same. What doesn’t move is anything the first driver kept in their own pocket, like a personal notebook of jobs, unless they shared it, and that’s the part Multi-AZ won’t copy unless you ask it to.

Engineer's View

How Multi-AZ works for SQL Server

RDS chooses the technology based on version: Always On availability groups for SQL Server 2017 and later Standard and Enterprise (recent builds), database mirroring for some older Standard versions and block level replication for SQL Server 2022 Web edition. Express isn’t supported, and EXEC msdb.dbo.rds_get_high_availability_option tells you which one you’ve got.

Commits go synchronously to the standby, which makes writes a little slower but means no committed data is lost on failover. You can’t read from the standby (that’s what read replicas on Enterprise are for), there’s only one standby, and a Multi-AZ SQL Server instance can’t be stopped. To test a failover you use reboot-db-instance --force-failover. Because it’s the endpoint’s DNS record that moves, clients have to reconnect and look the name up again, and RDS also gives you an AG listener endpoint for MultiSubnetFailover=True.

Logins, users and permissions are replicated. Agent jobs and tempdb settings replicate only when you turn on rds_set_system_database_sync_objects, and linked servers, server audits and msdb permissions never replicate.

On Multi-AZ instances, don’t switch databases to SIMPLE recovery and don’t rename them.

How it works, step by step

This is what goes on during a failover.

1Something triggers it

It could be a host failure, AZ trouble, a patch, an instance class change or your own forced reboot, and RDS first checks that the standby is fully in sync.

What happens during an RDS SQL Server Multi-AZ failover

2The standby is promoted

The standby finishes recovery and becomes the primary. Big open transactions slow this down, because they have to be rolled back or forward first.

3DNS moves and clients reconnect

The endpoint now resolves to the new primary. Open connections get dropped, and clients that retry and resolve the name again just carry on, while the old primary turns into the new standby.

4Know what follows the failover

Some things on the server sit outside the availability group:

What RDS SQL Server Multi-AZ copies automatically, on request, or not at all

Test a failover after every change to jobs, linked servers or audits, and not only once at go-live.

✅ Checkpoint: You can explain the synchronous standby, why the endpoint moves through DNS, and what Multi-AZ copies, copies only on request, and never copies.

Hands-on lab: fail over saat-sql-ha and measure it

Sign in and create the Multi-AZ instance (about 40 minutes):

cd C:\aws-lab
aws login --profile saat-admin
$env:AWS_PROFILE = 'saat-admin'
$v = Get-Content C:\aws-lab\saat-vpc.json | ConvertFrom-Json
aws rds create-db-instance --db-instance-identifier saat-sql-ha --engine sqlserver-se --license-model license-included --db-instance-class db.m6i.large --multi-az --allocated-storage 20 --storage-type gp3 --storage-encrypted --master-username saatadmin --manage-master-user-password --db-subnet-group-name saat-db-subnets --vpc-security-group-ids $v.DbSg --no-publicly-accessible --backup-retention-period 1 --tags Key=course,Value=saatvedha-aws Key=lesson,Value=54 --query "DBInstance.DBInstanceStatus" --output text

You should see this:

creating

1Check the HA mode and create a database

Paste this whole block:

.\Start-SqlLab.ps1 -Db saat-sql-ha -LocalPort 11438
aws rds describe-db-instances --db-instance-identifier saat-sql-ha --query "DBInstances[0].[MultiAZ,AvailabilityZone,SecondaryAvailabilityZone,ListenerEndpoint.Address]" --output text
sqlcmd -S "127.0.0.1,11438" -U saatadmin -C -Q "EXEC msdb.dbo.rds_get_high_availability_option; CREATE DATABASE HaShop;"
sqlcmd -S "127.0.0.1,11438" -U saatadmin -C -d HaShop -Q "CREATE TABLE dbo.Pings (Id int IDENTITY PRIMARY KEY, At datetime2 DEFAULT SYSUTCDATETIME(), Note nvarchar(50)); SELECT recovery_model_desc FROM sys.databases WHERE name = 'HaShop';"

You should see something like this:

Tunnel ready on 127.0.0.1,11438 for saatadmin (password is in SQLCMDPASSWORD for this window)
True    ap-south-1a     ap-south-1b     saat-sql-ha.c1a2b3c4d5e6.ap-south-1.rds.amazonaws.com
high_availability_option
------------------------
Multi-AZ (AlwaysOn)
recovery_model_desc
-------------------
FULL

SQL Server 2022 Standard uses an Always On availability group with the standby in ap-south-1b. HaShop joined the group by itself and is in FULL recovery, which Multi-AZ needs.

RDS SQL Server Multi-AZ lab output: failover outage measured by a writing client
Here’s the failover as the writer sees it, something like this.

2Fail over while a client keeps writing

Paste this whole block. A background writer opens a fresh connection and inserts a row every second for 4 minutes, and 30 seconds in you force a failover:

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
}
$b = New-Object System.Data.SqlClient.SqlConnectionStringBuilder
$b['Data Source'] = '127.0.0.1,11438'; $b['Initial Catalog'] = 'HaShop'; $b['User ID'] = 'saatadmin'; $b['Password'] = (Get-SqlPw saat-sql-ha)
$b['Encrypt'] = $true; $b['TrustServerCertificate'] = $true; $b['Pooling'] = $false; $b['Connect Timeout'] = 5
$cs = $b.ConnectionString
function Get-Az { aws rds describe-db-instances --db-instance-identifier saat-sql-ha --query "DBInstances[0].AvailabilityZone" --output text }
function Invoke-Failover { aws rds reboot-db-instance --db-instance-identifier saat-sql-ha --force-failover | Out-Null; Start-Sleep 60; aws rds wait db-instance-available --db-instance-identifier saat-sql-ha; Start-Sleep 30 }
$writer = {
  param($cs, $seconds)
  $end = (Get-Date).AddSeconds($seconds)
  while ((Get-Date) -lt $end) {
    $t = Get-Date
    try {
      $cn = New-Object System.Data.SqlClient.SqlConnection $cs; $cn.Open()
      $cm = $cn.CreateCommand(); $cm.CommandText = "INSERT dbo.Pings (Note) VALUES ('writer')"; [void]$cm.ExecuteNonQuery(); $cn.Close()
      [pscustomobject]@{ At = $t; Ok = $true }
    } catch { [pscustomobject]@{ At = $t; Ok = $false } }
    Start-Sleep -Seconds 1
  }
}
$before = Get-Az
$job = Start-Job -ScriptBlock $writer -ArgumentList $cs, 240
Start-Sleep 30
Invoke-Failover
$log = Receive-Job $job -Wait
$fails = @($log | Where-Object { -not $_.Ok })
$okCount = @($log | Where-Object { $_.Ok }).Count
if ($fails.Count) { "ok $okCount  failed $($fails.Count)  outage about $([int]($fails[-1].At - $fails[0].At).TotalSeconds + 1) s" } else { "ok $okCount  failed 0" }
"AZ before $before  after $(Get-Az)"
aws rds describe-events --source-type db-instance --source-identifier saat-sql-ha --duration 30 --query "Events[].Message" --output text

You should see something like this:

ok 176  failed 38  outage about 41 s
AZ before ap-south-1a  after ap-south-1b
Multi-AZ instance failover started.     Multi-AZ instance failover completed.

For roughly 40 seconds the client couldn’t write, and then it carried on against the same endpoint, which now lives in the other zone. Every row acknowledged before the failover is still there because commits were synchronous. An app with retry logic sees a pause, while one without it sees errors and might need a restart.

RDS console for saat-sql-ha after failover showing the primary in ap-south-1b and failover events
saat-sql-ha after the reboot with failover: the primary has moved to the other zone, and the events show when it started and finished.

✅ Checkpoint: rds_get_high_availability_option shows Multi-AZ (AlwaysOn), the writer recovered by itself after the forced failover, and the AZ changed from one zone to the other.

Break It, Then Fix It

These two work fine on day one and then fail on the first real failover.

1Break it: an app that cached the IP address

Open a second tunnel to the current primary’s IP instead of its DNS name, make sure it works, then fail over and try it again:

$ep = aws rds describe-db-instances --db-instance-identifier saat-sql-ha --query "DBInstances[0].Endpoint.Address" --output text
$ip = (Resolve-DnsName $ep -Type A | Where-Object { $_.Type -eq 'A' } | Select-Object -First 1).IPAddress
$jump = aws ec2 describe-instances --filters "Name=tag:Name,Values=sqljump" "Name=instance-state-name,Values=running" --query "Reservations[0].Instances[0].InstanceId" --output text
@{ host = @($ip); portNumber = @('1433'); localPortNumber = @('11439') } | ConvertTo-Json | Set-Content tunnel-ip.json
Start-Process powershell -ArgumentList '-NoExit', '-Command', "aws ssm start-session --target $jump --document-name AWS-StartPortForwardingSessionToRemoteHost --parameters file://C:/aws-lab/tunnel-ip.json"
Start-Sleep 10
sqlcmd -S "127.0.0.1,11439" -U saatadmin -C -Q "SELECT COUNT(*) AS pings FROM HaShop.dbo.Pings"
Invoke-Failover
sqlcmd -S "127.0.0.1,11439" -U saatadmin -C -Q "SELECT COUNT(*) AS pings FROM HaShop.dbo.Pings"

You’ll get something like this:

pings
-----------
        176
Msg 976, Level 14, State 1, Server EC2AMAZ-NODE1, Line 1
The target database, 'HaShop', is participating in an availability group and is currently not accessible for queries. Either data movement is suspended or the availability replica is not enabled for read access.

The IP still answers, but it belongs to the standby now, and the standby can’t serve HaShop. Apps that cache DNS forever (some Java settings, hosts-file entries, IPs pasted into config) break in just this way after their first failover. Fix: always connect through the DNS name, keep DNS caching short and retry on connection errors:

sqlcmd -S "127.0.0.1,11438" -U saatadmin -C -Q "SELECT COUNT(*) AS pings FROM HaShop.dbo.Pings"

You should see something like this:

pings
-----------
        176

Close the tunnel window for port 11439 before you carry on.

2Break it: a SQL Agent job that stays behind

Create a clean-up job on the primary, fail over and then look for it:

sqlcmd -S "127.0.0.1,11438" -U saatadmin -C -Q "EXEC msdb.dbo.sp_add_job @job_name = N'saat-cleanup'; EXEC msdb.dbo.sp_add_jobstep @job_name = N'saat-cleanup', @step_name = N'trim', @subsystem = N'TSQL', @database_name = N'HaShop', @command = N'DELETE dbo.Pings WHERE At < DATEADD(day, -7, SYSUTCDATETIME())'; EXEC msdb.dbo.sp_add_jobserver @job_name = N'saat-cleanup'; SELECT name FROM msdb.dbo.sysjobs WHERE name = N'saat-cleanup';"
Invoke-Failover
sqlcmd -S "127.0.0.1,11438" -U saatadmin -C -Q "SELECT name FROM msdb.dbo.sysjobs WHERE name = N'saat-cleanup';"

You’ll get something like this:

name
------------
saat-cleanup
name
------------

(0 rows affected)
Multi-AZ problems: cached IP reaches the secondary and Agent job missing after failover
Here are both problems and their fixes, something like this.

The job lived in msdb on the old primary, and msdb isn’t part of the availability group. After the failover the new primary has no such job and nothing complains, so the clean-up just quietly stops. Fix: turn on job sync, recreate the job and prove it survives a failover:

sqlcmd -S "127.0.0.1,11438" -U saatadmin -C -Q "EXEC msdb.dbo.rds_set_system_database_sync_objects @object_types = 'SQLAgentJob'; SELECT * FROM msdb.dbo.rds_fn_get_system_database_sync_objects();"
sqlcmd -S "127.0.0.1,11438" -U saatadmin -C -Q "EXEC msdb.dbo.sp_add_job @job_name = N'saat-cleanup'; EXEC msdb.dbo.sp_add_jobstep @job_name = N'saat-cleanup', @step_name = N'trim', @subsystem = N'TSQL', @database_name = N'HaShop', @command = N'DELETE dbo.Pings WHERE At < DATEADD(day, -7, SYSUTCDATETIME())'; EXEC msdb.dbo.sp_add_jobserver @job_name = N'saat-cleanup';"
Start-Sleep 120
Invoke-Failover
sqlcmd -S "127.0.0.1,11438" -U saatadmin -C -Q "SELECT name FROM msdb.dbo.sysjobs WHERE name = N'saat-cleanup';"

You should see something like this:

object_type
-----------
SQLAgentJob
name
------------
saat-cleanup

The job follows the primary now. Linked servers and server audits never replicate, so keep scripts for them and recreate them after a failover.

Clean up next. A Multi-AZ SQL Server instance can’t be stopped, so you delete it:

aws rds delete-db-instance --db-instance-identifier saat-sql-ha --skip-final-snapshot --delete-automated-backups --query "DBInstance.DBInstanceStatus" --output text
Remove-Item tunnel-ip.json
.\Stop-SqlLab.ps1 -Db saat-sql-ha -KeepDbRunning

✅ Checkpoint: You fixed the cached-IP failure by using the DNS endpoint and the lost Agent job by turning on job sync. saat-sql-ha is being deleted, and the jump host and endpoints are gone.

This happened at work

The failover nobody noticed for a month

A healthcare billing company had just moved to RDS SQL Server Multi-AZ, and they were pleased when a host failure one night caused only a 50-second blip. About three weeks later someone from finance asked why the nightly claim reconciliation emails had stopped coming. It turned out the reconciliation ran as a SQL Agent job that was created before Multi-AZ job sync was switched on, so after the failover the new primary simply had no such job. Nobody got an alert, because nothing had failed; the job just never ran. The team turned on job sync, recreated every job from source control and added a daily check that compares the job list with the repository, and these days they also force a failover every quarter and go through a checklist of jobs, linked servers and audits.

Common mistakes and troubleshooting

MistakeWhat happensWhat to do
Planning Multi-AZ on ExpressNot supportedStandard, Enterprise, or Web (2022) edition
Caching the endpoint IPMsg 976 or timeouts after failoverDNS name, short DNS caching, retries
No retry logic in appsErrors or restarts after every failoverRetry connection errors with backoff
Agent jobs without syncJobs silently missing after failoverrds_set_system_database_sync_objects SQLAgentJob
Linked servers and audits created laterMissing on the new primaryScript and recreate them; test failovers
Huge open transactionsSlow failover recoveryKeep transactions short; batch big changes

Interview questions

Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way you could answer in your own words.

Fresher level

1. Can you explain in simple words what Multi-AZ gives you on RDS SQL Server?

Why they ask this: They’re checking that you understand what high availability means on RDS and which failures it actually covers.

How you might answer: It keeps a synchronous standby copy in another Availability Zone, and if the host, the AZ or maintenance takes the primary down, RDS fails over to that standby by itself behind the same endpoint. Since writes are synchronous, you don’t lose committed data in the failover.

2. A report team wants to run their queries on the Multi-AZ standby. What would you tell them?

Why they ask this: They want to see you know where Multi-AZ stops and can send people to the right feature.

How you might answer: I’d tell them the standby isn’t readable, it’s only there to take over, so for reports we’d need a read replica. On RDS SQL Server read replicas need Enterprise edition, so I’d raise the cost question early.

3. How would you test that failover actually works on a Multi-AZ instance?

Why they ask this: They want to know you test HA instead of trusting it, and that you keep an eye on the app while you do.

How you might answer: I’d run reboot-db-instance with --force-failover and watch both the app and the RDS events while it runs. In my lab I keep a small client writing through the failover, so I can see how long the app is really affected.

2–5 years experience

4. After a Multi-AZ failover, a nightly job stopped running. What happened?

Why they ask this: They’re checking whether you know what lives outside the replicated databases, and Agent jobs are the classic surprise after a failover.

How you might answer: Agent jobs live in msdb, which sits outside the availability group, so unless job sync is on they don’t exist on the new primary. I’d turn sync on with rds_set_system_database_sync_objects for SQLAgentJob and then check the jobs are there on both sides.

5. How would you make sure an app keeps working through a Multi-AZ failover?

Why they ask this: They want to see you know HA is split between the database and the client code, and what the app itself has to do.

How you might answer: The app has to connect through the DNS endpoint, or a listener with MultiSubnetFailover=True, without caching DNS for long, and it needs connection retry with backoff. I’d also ask the developers for idempotent writes and short transactions, so a retry doesn’t create duplicates.

6. Your team thinks Multi-AZ copies everything. What doesn’t it replicate?

Why they ask this: They want to see you know the gaps, so nothing important goes missing after a failover.

How you might answer: Linked servers, server audits, msdb permissions and the DEFAULT_DATABASE setting on logins don’t replicate, and Agent jobs only follow if sync is on. I keep scripts for those server objects so I can check them and recreate them after a failover.

Senior level

7. How would you design HA and DR for a critical RDS SQL Server database?

Why they ask this: They want to see you treat zone failures and Region failures separately, with testing and alerting built into the design.

How you might answer: Multi-AZ covers zone failures, and for a Region problem I’d add cross-Region automated backups or replicas. Apps would use retrying clients, job sync would be on and the server objects scripted, and we’d run failover and DR tests every quarter with CloudWatch alarms on failover events.

8. When would you choose Multi-AZ on RDS, and when would you build Always On on EC2 instead?

Why they ask this: They want to see you can weigh managed convenience against control and explain the choice to the team.

How you might answer: For most databases I’d go with RDS, because managed failover and patching matter most and its limits don’t hurt us. I’d move to EC2 when we need readable secondaries, more replicas, cross-Region availability groups, custom configuration or a feature that RDS blocks.

Quick quiz

Q1. Which edition can’t use Multi-AZ on RDS?

  1. Standard
  2. Enterprise
  3. Express
  4. Web 2022
Show answer

C — Express isn’t supported.

Q2. How does the endpoint follow a failover?

  1. IP stays the same
  2. DNS points to the new primary
  3. Clients get an email
  4. It doesn’t
Show answer

B — The DNS record moves.

Q3. Why did the IP tunnel get Msg 976?

  1. Wrong password
  2. It reached the standby
  3. TLS off
  4. Disk full
Show answer

B — The old IP now belongs to the secondary.

Q4. What keeps Agent jobs on both nodes?

  1. Nothing
  2. rds_set_system_database_sync_objects
  3. Backups
  4. Read replicas
Show answer

B — Job sync must be turned on.

Q5. Can you stop a Multi-AZ SQL Server instance?

  1. Yes
  2. No
  3. Only on weekends
  4. Only Express
Show answer

B — Delete it, or remove Multi-AZ first.

Quick recap

  • Multi-AZ keeps a synchronous standby in another AZ behind one endpoint.
  • Failover takes about a minute, and apps need to retry and use the DNS name.
  • Logins and users replicate, but Agent jobs need sync turned on.
  • Linked servers, server audits and msdb permissions don’t replicate.
  • Express can’t use Multi-AZ, and Multi-AZ SQL Server instances can’t be stopped.

Next lesson

Lesson 55: Always On availability groups on EC2 → Next you’ll build a two-node availability group across AZs on EC2 and see when it’s a better fit than RDS.

Further reading: RDS SQL Server Multi-AZ

If you want to go further with RDS SQL Server Multi-AZ, read Multi-AZ deployments for Amazon RDS for SQL Server and Multi-AZ limitations, notes and recommendations. The full plan for this course is on the AWS Cloud Administration course page.

Scroll to Top

This website uses cookies

We use a few cookies to keep this site working. If you allow it, we also use Google Analytics to count visits so we can improve our lessons. You can accept all, deny the optional ones, or choose what to allow.