Bird
Raised Fist0
AWScloud~5 mins

Why cloud over on-premises in AWS - Performance Analysis

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Time Complexity: Why cloud over on-premises
O(n)
Understanding Time Complexity

We want to understand how the time it takes to manage computing resources changes when using cloud services versus on-premises setups.

Specifically, how does the effort grow as the number of servers or applications increases?

Scenario Under Consideration

Analyze the time complexity of provisioning servers on AWS compared to on-premises.


// AWS example: Provisioning servers using EC2
for (int i = 0; i < n; i++) {
  aws.ec2.runInstances({
    ImageId: 'ami-123456',
    InstanceType: 't3.micro',
    MinCount: 1,
    MaxCount: 1
  });
}

// On-premises: Manually setting up each server one by one
for (int i = 0; i < n; i++) {
  setupPhysicalServer();
}
    

This sequence shows provisioning n servers either by calling AWS API or manually setting up physical servers.

Identify Repeating Operations

Identify the API calls, resource provisioning, data transfers that repeat.

  • Primary operation: Provisioning one server instance (API call for cloud, manual setup for on-premises)
  • How many times: Exactly n times, once per server
How Execution Grows With Input

As the number of servers n increases, the total provisioning effort grows roughly in direct proportion.

Input Size (n)Approx. API Calls/Operations
1010 provisioning calls
100100 provisioning calls
10001000 provisioning calls

Pattern observation: Doubling the number of servers doubles the provisioning operations needed.

Final Time Complexity

Time Complexity: O(n)

This means the time to provision servers grows linearly with the number of servers.

Common Mistake

[X] Wrong: "Provisioning more servers in the cloud takes the same time as provisioning one server."

[OK] Correct: Each server requires its own setup call, so time grows with the number of servers, even if cloud automates some steps.

Interview Connect

Understanding how provisioning time scales helps you explain the benefits of cloud automation and why it can be faster and easier than on-premises, even if both grow linearly.

Self-Check

"What if we used server templates or auto-scaling groups in the cloud? How would the time complexity change?"

Practice

(1/5)
1. Why do many businesses choose cloud computing over on-premises servers?
easy
A. Because on-premises servers are always faster
B. Because cloud lets them avoid buying and managing physical servers
C. Because cloud requires more physical space
D. Because on-premises servers are cheaper to maintain

Solution

  1. Step 1: Understand cost and management differences

    On-premises servers need buying, setup, and ongoing management which costs time and money.
  2. Step 2: Compare with cloud benefits

    Cloud removes the need to buy physical servers and handles management, saving money and effort.
  3. Final Answer:

    Because cloud lets them avoid buying and managing physical servers -> Option B
  4. Quick Check:

    Cloud saves money and effort [OK]
Hint: Cloud avoids physical server costs and management [OK]
Common Mistakes:
  • Thinking on-premises is always cheaper
  • Confusing physical space needs
  • Assuming cloud is slower
2. Which of the following is a correct reason to prefer cloud over on-premises?
easy
A. Cloud allows easy scaling to match your needs anytime
B. On-premises servers can be accessed from anywhere without internet
C. Cloud needs you to buy more hardware
D. On-premises servers automatically update without manual work

Solution

  1. Step 1: Review cloud scaling feature

    Cloud lets you increase or decrease resources quickly as your needs change.
  2. Step 2: Check other options for accuracy

    Options A, B, and D are incorrect because cloud does not require buying hardware, on-premises needs internet for remote access, and updates often require manual effort.
  3. Final Answer:

    Cloud allows easy scaling to match your needs anytime -> Option A
  4. Quick Check:

    Cloud scaling [OK]
Hint: Cloud scales resources easily anytime [OK]
Common Mistakes:
  • Thinking cloud needs more hardware
  • Believing on-premises is internet-free for remote access
  • Assuming on-premises updates are automatic
3. Consider this scenario: A company uses cloud services and suddenly needs more storage. What happens next?
medium
A. They need to wait weeks for hardware delivery
B. They must buy new physical hard drives and install them
C. They can quickly increase storage through the cloud provider's console
D. They have to shut down services to add storage

Solution

  1. Step 1: Understand cloud resource flexibility

    Cloud providers allow users to add resources like storage instantly via online tools.
  2. Step 2: Contrast with on-premises process

    On-premises requires buying and installing hardware, which takes time and may need downtime.
  3. Final Answer:

    They can quickly increase storage through the cloud provider's console -> Option C
  4. Quick Check:

    Cloud quick resource increase [OK]
Hint: Cloud storage scales fast via console [OK]
Common Mistakes:
  • Confusing cloud with physical hardware buying
  • Assuming downtime is needed for cloud scaling
  • Thinking cloud scaling takes weeks
4. A company tries to access their on-premises server remotely but fails. What is a likely cause?
medium
A. They need to buy more physical servers
B. Cloud services do not allow remote access
C. On-premises servers always allow remote access by default
D. They forgot to connect the server to the internet

Solution

  1. Step 1: Identify remote access requirements

    On-premises servers need proper internet connection and configuration to be accessed remotely.
  2. Step 2: Evaluate options for correctness

    They forgot to connect the server to the internet correctly points to missing internet connection; B and C are false statements; A is unrelated to access issues.
  3. Final Answer:

    They forgot to connect the server to the internet -> Option D
  4. Quick Check:

    Remote access needs internet [OK]
Hint: Remote access needs internet connection [OK]
Common Mistakes:
  • Thinking cloud disallows remote access
  • Assuming on-premises remote access is automatic
  • Confusing hardware purchase with access issues
5. A startup wants to launch a website that might get very popular suddenly. Why is cloud a better choice than on-premises for this?
hard
A. Cloud can automatically scale resources up or down based on traffic
B. On-premises servers handle sudden traffic spikes better
C. Cloud requires buying extra servers in advance
D. On-premises servers are easier to access from anywhere

Solution

  1. Step 1: Understand traffic scaling needs

    A sudden increase in website visitors needs quick resource scaling to avoid slowdowns or crashes.
  2. Step 2: Compare cloud and on-premises scaling

    Cloud can automatically adjust resources instantly; on-premises needs manual hardware changes which are slow and costly.
  3. Step 3: Eliminate incorrect options

    Options B, C, and D are incorrect because on-premises is less flexible, cloud does not require buying extra servers upfront, and cloud access is easier.
  4. Final Answer:

    Cloud can automatically scale resources up or down based on traffic -> Option A
  5. Quick Check:

    Cloud auto-scaling fits sudden traffic [OK]
Hint: Cloud auto-scales for traffic spikes [OK]
Common Mistakes:
  • Believing on-premises handles spikes better
  • Thinking cloud needs pre-bought servers
  • Confusing access ease between cloud and on-premises