Why IaC matters on Azure - Performance Analysis
We want to understand how the time it takes to set up cloud resources grows as we add more resources using Infrastructure as Code (IaC) on Azure.
How does the number of resources affect the time and operations needed?
Analyze the time complexity of deploying multiple Azure resources using IaC.
resourceGroup = azurerm_resource_group.example
for i in range(1, n+1):
azurerm_storage_account_example[i] = azurerm_storage_account(
name=f"storage{i}",
resource_group_name=resourceGroup.name,
location=resourceGroup.location
)
This sequence creates a resource group and then deploys n storage accounts inside it using IaC.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Creating each storage account resource via Azure API calls.
- How many times: Once per storage account, so n times.
Each additional storage account requires a separate API call and provisioning step.
| Input Size (n) | Approx. Api Calls/Operations |
|---|---|
| 10 | 10 storage account creations + 1 resource group creation = 11 |
| 100 | 100 storage account creations + 1 resource group creation = 101 |
| 1000 | 1000 storage account creations + 1 resource group creation = 1001 |
Pattern observation: The number of operations grows roughly in direct proportion to the number of resources.
Time Complexity: O(n)
This means the time to deploy grows linearly as you add more resources.
[X] Wrong: "Adding more resources won't affect deployment time much because Azure handles it fast."
[OK] Correct: Each resource still needs its own setup call and provisioning, so more resources mean more work and longer time.
Understanding how deployment time grows with resource count helps you plan and explain infrastructure scaling clearly and confidently.
"What if we deployed resources in parallel instead of one by one? How would the time complexity change?"