eksctl create cluster: Create an Amazon EKS Cluster Step by Step (and Delete It)
eksctl create cluster creates a working Amazon EKS cluster in one command: a VPC, the EKS control plane, a managed node group of EC2 workers, and your kubectl config. The best way is a small YAML file and eksctl create cluster -f cluster.yaml, which takes about 15–20 minutes. Remember that the control plane costs 0.10 USD per hour plus the EC2 nodes, so delete the cluster with eksctl delete cluster when your lab is done.
Quick answer
eksctl create cluster --name lab --region ap-south-1 --version 1.30 \
--nodegroup-name ng-1 --node-type t3.medium --nodes 2 --managed
kubectl get nodes
eksctl delete cluster --name lab --region ap-south-1
A live example first
We create a small lab cluster in Mumbai with a YAML file, so it is easy to repeat and to delete.
- Check the tools:
aws sts get-caller-identity
eksctl version
kubectl version --client
- Write
cluster.yaml:
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: rb-lab
region: ap-south-1
version: "1.30"
managedNodeGroups:
- name: ng-general
instanceType: t3.medium
desiredCapacity: 2
minSize: 1
maxSize: 3
volumeSize: 20
labels: { role: general }
tags: { project: rb-lab }
- Create it:
eksctl create cluster -f cluster.yaml
[ℹ] eksctl version 0.19x.0
[ℹ] using region ap-south-1
[ℹ] building cluster stack "eksctl-rb-lab-cluster"
[ℹ] deploying stack "eksctl-rb-lab-cluster"
...
[ℹ] building managed nodegroup stack "eksctl-rb-lab-nodegroup-ng-general"
[✔] saved kubeconfig as "/home/ravi/.kube/config"
[✔] EKS cluster "rb-lab" in "ap-south-1" region is ready
- Test it:
kubectl get nodes
kubectl create deployment web --image=nginx:1.27
kubectl expose deployment web --type=LoadBalancer --port=80
kubectl get svc web -w
After a minute or two, EXTERNAL-IP shows a load balancer DNS name, and the nginx page opens. Friends, that is a real, production-style Kubernetes cluster, made from 15 lines of YAML.
What does eksctl create?
eksctl turns one YAML file into CloudFormation stacks for the VPC, control plane and nodes.
| Stack / resource | What it is |
|---|---|
eksctl-<name>-cluster stack |
VPC with public and private subnets in 2–3 AZs, NAT gateway, the EKS control plane, IAM roles |
eksctl-<name>-nodegroup-<ng> stack |
Launch template and Auto Scaling group for the managed node group |
| kubeconfig entry | So kubectl talks to the new cluster |
You can see these stacks in the CloudFormation console. Do not edit them by hand. Change the YAML and use eksctl.
How do I create a cluster step by step?
- Install the AWS CLI and run
aws configure(or use an SSO profile). - Install
kubectlandeksctl. - Write
cluster.yamlwith name, region, version and a node group. - Run
eksctl create cluster -f cluster.yaml --dry-runto see the full config. - Run
eksctl create cluster -f cluster.yaml. - Run
kubectl get nodesand check that they are Ready. - Install add-ons you need, for example the EBS CSI driver for persistent volumes.
- Delete the cluster when done.
Install eksctl on each system
| System | Install |
|---|---|
| Linux | download the latest release tar.gz from the eksctl GitHub releases page, extract, sudo mv eksctl /usr/local/bin |
| macOS | brew tap weaveworks/tap && brew install weaveworks/tap/eksctl (or the newer tap shown in the docs) |
| Windows | choco install eksctl or winget install eksctl |
eksctl was first created by Weaveworks and is now maintained as an official tool for Amazon EKS. Follow the install page in the EKS user guide for the current method.
Useful variations
# Use an existing VPC
vpc:
subnets:
private:
ap-south-1a: { id: subnet-0aaa... }
ap-south-1b: { id: subnet-0bbb... }
# Cheaper lab nodes with Spot
managedNodeGroups:
- name: ng-spot
instanceTypes: ["t3.medium", "t3a.medium"]
spot: true
desiredCapacity: 2
# Pod IAM roles (IRSA)
iam:
withOIDC: true
Other handy commands:
eksctl get cluster --region ap-south-1
eksctl scale nodegroup --cluster rb-lab --name ng-general --nodes 3
eksctl create addon --cluster rb-lab --name aws-ebs-csi-driver
eksctl utils write-kubeconfig --cluster rb-lab
Give other people access
The IAM identity that created the cluster is the only admin at first. To add a teammate's role:
aws eks create-access-entry --cluster-name rb-lab --principal-arn arn:aws:iam::123456789012:role/devops-team
aws eks associate-access-policy --cluster-name rb-lab \
--principal-arn arn:aws:iam::123456789012:role/devops-team \
--policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy \
--access-scope type=cluster
Give admin only to people who need it. Use the view or edit policies for others.
Cost and clean-up
| Item | Approximate cost driver |
|---|---|
| EKS control plane | 0.10 USD per hour (standard support) |
| 2 × t3.medium nodes | EC2 On-Demand price for your region |
| NAT gateway | Hourly + per GB |
| LoadBalancer Services | One load balancer each |
| EBS volumes | Per GB-month |
To delete cleanly:
kubectl delete svc --all(removes load balancers).kubectl delete pvc --all(removes EBS volumes).eksctl delete cluster -f cluster.yaml --wait.- Check CloudFormation and EC2 → Load balancers and Volumes for leftovers.
Other clouds
- Google GKE:
gcloud container clusters create-auto lab --region asia-south1. - Azure AKS:
az aks create -g rb-rg -n lab --node-count 2.
Real example
At KubeCon Europe 2019, Spotify engineers gave a talk about how they accidentally deleted Kubernetes clusters during their migration to GKE, and how they recovered with no visible effect for users. One lesson they shared was to manage clusters as code, so a lost cluster can be recreated. eksctl YAML files kept in Git give you the same safety: the cluster can be rebuilt with one command.
Mistakes to avoid
- Leaving the lab cluster running. It costs money every hour.
- Deleting the cluster before LoadBalancer Services. The VPC deletion can get stuck on leftover load balancers.
- Editing CloudFormation stacks by hand. eksctl gets out of sync.
Summary table
| Task | Command |
|---|---|
| Create (quick) | eksctl create cluster --name N --region R --nodes 2 --managed |
| Create (YAML) | eksctl create cluster -f cluster.yaml |
| Check | kubectl get nodes |
| Scale | eksctl scale nodegroup --cluster N --name NG --nodes 3 |
| Add-on | eksctl create addon --name aws-ebs-csi-driver |
| Delete | delete Services/PVCs → eksctl delete cluster -f cluster.yaml |
Quick quiz: check what you learned
What does eksctl use to create AWS resources?
- CloudFormation stacks
- Terraform state files
- Manual console clicks
- Ansible playbooks
Show answer
A. eksctl creates and manages CloudFormation stacks.
What does the EKS control plane cost per hour (standard)?
- 0.10 USD
- 1.00 USD
- 0.01 USD
- It is free
Show answer
A. EKS charges 0.10 USD per cluster per hour for standard support.
What should you delete before eksctl delete cluster?
- LoadBalancer Services
- The kubeconfig file
- The IAM user account
- The AWS CLI install
Show answer
A. Services can leave load balancers that block VPC deletion.
Another user gets Unauthorized with kubectl. Why?
- No access entry for them
- The cluster is stopped
- kubectl is too new
- The node group is empty
Show answer
A. Only the creator has access until others are added.
Learn it properly
These pages go deeper, with labs:
Frequently asked questions
What is eksctl?
A command-line tool for creating and managing Amazon EKS clusters. It creates the needed CloudFormation stacks for the cluster, VPC and node groups for you.
How long does eksctl create cluster take?
Usually about 15 to 20 minutes, because it creates a VPC, the EKS control plane and the node group.
How much does an EKS cluster cost?
The EKS control plane costs 0.10 USD per hour (standard support), plus the EC2 nodes, NAT gateway, load balancers and EBS volumes you use.
Can I use an existing VPC?
Yes. List your existing subnet IDs under vpc.subnets in the YAML file instead of letting eksctl create a VPC.
Why does kubectl say Unauthorized after the cluster is made?
Only the IAM identity that created the cluster has access at first. Add other users or roles with access entries.
How do I delete everything?
Delete LoadBalancer Services and PVCs first, then run eksctl delete cluster. Check CloudFormation and EC2 for anything left.