Creating an EKS Cluster with the AWS CLI

Creating an EKS Cluster with the AWS CLI A workflow diagram generated by Archify. 01 / Prerequisites 02 / Cluster & nodes Cluster role · create-role · Prerequisites Cluster role create-role VPC · subnets · create-subnet · Prerequisites VPC · subnets create-subnet Security group · ingress rules · Prerequisites Security group ingress rules Create cluster · create-cluster · Cluster & nodes Create cluster create-cluster Node group · create-nodegroup · Cluster & nodes Node group create-nodegroup Access · update-kubeconfig · Cluster & nodes Access update-kubeconfig 1 network 2 security 3 cluster 4 ACTIVE 5 access Legend Access setup IAM AWS resources

Preparing IAM

  • • Attach AmazonEKSClusterPolicy to the cluster role
  • • Attach AmazonEKSWorkerNodePolicy, AmazonEKS_CNI_Policy, and AmazonEC2ContainerRegistryReadOnly to the node role
  • • Build it in two steps: aws iam create-role, then attach-role-policy

Creating the cluster and nodes

  • • aws eks create-cluster --name my-cluster --role-arn <role> --resources-vpc-config subnetIds=...
  • • Wait for ACTIVE with aws eks describe-cluster --name my-cluster --query cluster.status
  • • After aws eks create-nodegroup, check progress with describe-nodegroup

Confirming access

  • • Refresh the kubeconfig with aws eks update-kubeconfig --name my-cluster
  • • kubectl get nodes confirms the nodes registered
  • • Raw CLI creation has many steps, which suits learning; for production prefer eksctl or IaC