Multi-AZ deployment for high availability in AWS - Time & Space Complexity
When setting up Multi-AZ deployment, we want to know how the time to deploy or manage resources changes as we add more availability zones.
We ask: How does the number of steps or calls grow when we increase zones?
Analyze the time complexity of the following operation sequence.
// Create a database instance in multiple AZs
for each availability zone in zones:
create DB instance replica in that zone
wait until all replicas are available
This sequence creates a database replica in each availability zone to ensure high availability.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Creating a DB instance replica in each availability zone.
- How many times: Once per availability zone.
Each new availability zone adds one more replica creation call, so the total calls grow directly with the number of zones.
| Input Size (n) | Approx. API Calls/Operations |
|---|---|
| 2 | 2 create calls |
| 3 | 3 create calls |
| 5 | 5 create calls |
Pattern observation: The number of calls increases one-to-one with the number of availability zones.
Time Complexity: O(n)
This means the time to deploy grows linearly as you add more availability zones.
[X] Wrong: "Adding more zones won't increase deployment time because they happen all at once."
[OK] Correct: Even if some steps run in parallel, each zone requires its own setup call, so total work grows with zones.
Understanding how deployment steps grow with resources helps you design scalable and reliable cloud systems confidently.
"What if we deployed replicas asynchronously in parallel? How would the time complexity change?"