This simple Bash script provides an interactive, colorized interface to calculate the maximum number of pods an AWS EC2 instance (used as an EKS node) can support.
The calculation is based on the AWS VPC CNI plugin formula:
Maximum Pods = (Max ENIs Γ (IPv4 Addresses per ENI - 1)) + 2
- Interactive Prompts: Step-by-step guidance for easy usage
- Colorized Output: A polished, visually appealing interface using ANSI colors
- Dynamic Filtering: Enter instance type filters to narrow down results
- Detailed Calculation: See the breakdown of the pod capacity formula
- AWS CLI Integration: Fetches real-time data from AWS using your configured CLI profiles
- AWS CLI: Must be installed and configured with your AWS credentials
- Bash Shell: The script is written in Bash (works on Linux, macOS, or Windows with WSL)
-
Clone the repository:
git clone https://github.com/richinex/aws-eks-pod-capacity-calculator.git
-
Navigate to the project directory:
cd aws-eks-pod-capacity-calculator
-
Make the script executable:
chmod +x eks_pod_calculator.sh
Run the script by executing:
./eks_pod_calculator.sh
-
AWS Profile Prompt:
- You'll be asked to enter your AWS CLI profile name (e.g., default, myprofile)
-
Instance Filter Prompt:
- Enter an instance type filter (e.g., m5.*)
- Press ENTER to list all instance types
-
Instance Type Selection:
- The script fetches matching instance types and displays them in columns with numbers
- Enter the number corresponding to your desired instance type
-
Calculation:
- The script retrieves network specifications (Max ENIs and IPv4 addresses per ENI)
- Calculates maximum pods using the formula above
-
Output:
- Displays calculated maximum pods
- Shows detailed calculation steps
- Provides important notes about system reservations
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Interactive AWS EKS Pod Calculator β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Pod Calculation Formula:
Maximum Pods = (Max ENIs Γ (IPv4 Addresses per ENI - 1)) + 2
Where:
β’ Max ENIs: Maximum network interfaces
β’ IPv4 Addresses per ENI: Maximum private IPv4 addresses per interface
β’ -1: Reserved for the primary IP on each ENI
β’ +2: Additional system overhead allocation
Enter an instance type filter (e.g., m5.*, c5.*, t3.*): m5.*
Available Instance Types:
ββββββββββββββββββββββββββββββββββββ
1) m5.large 4) m5.4xlarge 7) m5.16xlarge
2) m5.xlarge 5) m5.8xlarge 8) m5.24xlarge
3) m5.2xlarge 6) m5.12xlarge
Select an instance type (1-8): 1
Selected: m5.large
Instance Specifications
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Instance Type: m5.large β
β Maximum ENIs: 3 β
β IPv4 Addresses/ENI: 10 β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β Maximum Pods: 29 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Important Notes:
- The actual available pod capacity will be lower than 29
- System components reserve some pods:
- kube-system pods
- AWS CNI plugin
- kube-proxy
- CoreDNS
Calculation Details:
- Step 1: ENIs Γ (IPs per ENI - 1) = 3 Γ (10 - 1)
- Step 2: Add 2 for system overhead
- Final calculation: 3 Γ (10 - 1) + 2 = 29
Important Note:
The actual available pod capacity may be lower due to system-reserved pods.