Amazon EKS — eksctl Quickstart
The eksctl is the fastest way to create an EKS cluster. One command gives you a fully working cluster with a VPC, subnets, IAM roles, and managed node groups.
What is eksctl?
eksctl is the official CLI tool for Amazon EKS, originally built by Weaveworks (now maintained by the community and AWS). It abstracts away the dozens of AWS resources needed for a cluster into simple commands and YAML configs.
Behind the scenes, eksctl creates CloudFormation stacks for:
- VPC with public and private subnets
- NAT Gateways
- IAM roles (cluster role, node role)
- EKS cluster
- Managed node groups
- Security groups
Create a Cluster — One Command
eksctl create cluster \
--name my-cluster \
--region us-east-1 \
--version 1.29 \
--nodegroup-name standard-nodes \
--node-type m5.large \
--nodes 2 \
--nodes-min 1 \
--nodes-max 4 \
--managed
This creates:
- A VPC with public and private subnets in 3 AZs
- An EKS cluster with Kubernetes 1.29
- A managed node group with 2x m5.large instances
- All necessary IAM roles and security groups
- kubeconfig automatically updated
Duration: ~15-20 minutes (EKS cluster creation takes time)
Create a Cluster — YAML Config File
For more control, use a ClusterConfig YAML file:
# cluster.yaml
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: my-cluster
region: us-east-1
version: "1.29"
iam:
withOIDC: true # Required for IRSA
managedNodeGroups:
- name: general
instanceType: m5.large
minSize: 2
maxSize: 6
desiredCapacity: 3
volumeSize: 50
volumeType: gp3
privateNetworking: true
labels:
role: general
tags:
environment: production
iam:
withAddonPolicies:
ebs: true
efs: true
albIngress: true
cloudWatch: true
- name: spot-workers
instanceTypes:
- m5.large
- m5a.large
- m4.large
spot: true
minSize: 0
maxSize: 10
desiredCapacity: 2
privateNetworking: true
labels:
role: spot-worker
cloudWatch:
clusterLogging:
enableTypes:
- api
- audit
- authenticator
- controllerManager
- scheduler
addons:
- name: vpc-cni
version: latest
- name: coredns
version: latest
- name: kube-proxy
version: latest
Apply the config:
eksctl create cluster -f cluster.yaml
eksctl Managed Node Groups
Managed node groups are the recommended compute option. eksctl can create them during cluster creation or add them later.
Add a Node Group
eksctl create nodegroup \
--cluster my-cluster \
--region us-east-1 \
--name new-nodes \
--node-type m5.xlarge \
--nodes 3 \
--nodes-min 2 \
--nodes-max 5 \
--managed
List Node Groups
eksctl get nodegroup --cluster my-cluster --region us-east-1
Delete a Node Group
eksctl delete nodegroup \
--cluster my-cluster \
--region us-east-1 \
--name old-nodes
eksctl Fargate Profiles
You can create Fargate profiles to run pods serverlessly:
# In cluster.yaml
fargateProfiles:
- name: fp-default
selectors:
- namespace: default
- namespace: kube-system
- name: fp-app
selectors:
- namespace: production
labels:
compute: fargate
Or via CLI:
eksctl create fargateprofile \
--cluster my-cluster \
--region us-east-1 \
--name fp-app \
--namespace production
Common eksctl Commands
| Command | Description |
|---|---|
eksctl create cluster -f config.yaml |
Create a cluster from config |
eksctl get cluster --region us-east-1 |
List clusters |
eksctl delete cluster --name my-cluster |
Delete a cluster and all resources |
eksctl create nodegroup -f config.yaml |
Add node groups |
eksctl delete nodegroup --cluster my-cluster --name ng |
Remove a node group |
eksctl upgrade cluster --name my-cluster --version 1.30 |
Upgrade cluster version |
eksctl utils associate-iam-oidc-provider --cluster my-cluster --approve |
Enable OIDC for IRSA |
eksctl create iamserviceaccount --name sa --namespace ns --cluster my-cluster --attach-policy-arn arn:... --approve |
Create IRSA service account |
Pros and Cons of eksctl
| Pros | Cons |
|---|---|
| Simplest way to create an EKS cluster | Uses CloudFormation (slow, hard to debug) |
| Handles VPC, IAM, node groups automatically | Limited customization compared to Terraform |
| Great for learning and prototyping | State is in CloudFormation (not easily portable) |
| Official AWS-supported tool | YAML config can get complex for large setups |
| Supports Fargate, Spot, Graviton | Less visibility into what’s being created |
Clean Up
Delete a cluster and all associated resources:
eksctl delete cluster --name my-cluster --region us-east-1
This deletes:
- The EKS cluster
- All node groups
- The VPC and subnets (if eksctl created them)
- IAM roles
- CloudFormation stacks
Warning: Make sure no external resources (like manually created ALBs or EBS volumes) are still attached — eksctl won’t delete those.
What’s Next?
Let’s look at the Terraform approach for production-grade infrastructure as code.