0
0
AWScloud~5 mins

EKS cluster creation in AWS - Time & Space Complexity

Choose your learning style9 modes available
Time Complexity: EKS cluster creation
O(n)
Understanding Time 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.

Scenario Under Consideration

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

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

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
10About 10 node creation operations
100About 100 node creation operations
1000About 1000 node creation operations

Pattern observation: The time and operations grow linearly as you add more nodes.

Final Time Complexity

Time Complexity: O(n)

This means the time to create the cluster and nodes grows directly with the number of nodes you add.

Common Mistake

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

Interview Connect

Understanding how cluster creation time scales helps you plan resources and explain system behavior clearly in real-world cloud roles.

Self-Check

"What if we added multiple node groups instead of one large node group? How would the time complexity change?"