0
0
AWScloud~5 mins

Multi-AZ deployment for high availability in AWS - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: Multi-AZ deployment for high availability
O(n)
Understanding Time 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?

Scenario Under Consideration

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 Repeating Operations

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.
How Execution Grows With Input

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
22 create calls
33 create calls
55 create calls

Pattern observation: The number of calls increases one-to-one with the number of availability zones.

Final Time Complexity

Time Complexity: O(n)

This means the time to deploy grows linearly as you add more availability zones.

Common Mistake

[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.

Interview Connect

Understanding how deployment steps grow with resources helps you design scalable and reliable cloud systems confidently.

Self-Check

"What if we deployed replicas asynchronously in parallel? How would the time complexity change?"