EKS cluster creation in AWS - Time & Space Complexity
When creating an EKS cluster, it is important to understand how the time to complete the setup changes as the cluster size grows.
We want to know how the number of steps or API calls increases when we add more nodes or resources.
Analyze the time complexity of the following operation sequence.
aws eks create-cluster --name my-cluster --role-arn arn:aws:iam::123456789012:role/EKSRole \
--resources-vpc-config subnetIds=subnet-abc123,subnet-def456,securityGroupIds=sg-123abc
aws eks create-nodegroup --cluster-name my-cluster --nodegroup-name my-nodes \
--subnets subnet-abc123 subnet-def456 --node-role arn:aws:iam::123456789012:role/NodeRole \
--scaling-config minSize=1,maxSize=5,desiredSize=3
This sequence creates an EKS cluster and then adds a node group with several nodes to it.
Identify the API calls, resource provisioning, data transfers that repeat.
- Primary operation: Creating nodes in the node group.
- How many times: Number of nodes requested in the node group (desiredSize).
As you increase the number of nodes in the node group, the number of API calls and provisioning steps grows roughly in direct proportion.
| Input Size (nodes) | Approx. Api Calls/Operations |
|---|---|
| 10 | About 10 node creation operations |
| 100 | About 100 node creation operations |
| 1000 | About 1000 node creation operations |
Pattern observation: The time and operations grow linearly as you add more nodes.
Time Complexity: O(n)
This means the time to create the cluster and nodes grows directly with the number of nodes you add.
[X] Wrong: "Creating more nodes does not affect the total time much because the cluster is created once."
[OK] Correct: While the cluster itself is created once, each node requires separate provisioning steps, so adding nodes increases total time linearly.
Understanding how cluster creation time scales helps you plan resources and explain system behavior clearly in real-world cloud roles.
"What if we added multiple node groups instead of one large node group? How would the time complexity change?"