How to Create an AWS EKS Cluster Using Eksctl


eksctl dramatically simplifies the creation of AWS EKS clusters, by providing a simple command-line interface.

Step 1 – Define a Cluster YAML

You can either create a file called ekscluster.yaml and place the YAML in, or run the following command which will create a file called ekscluster.yaml and automatically add the default YAML configuration for you.

cat << EOF > ekscluster.yaml
---
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig

metadata:
  name: eksworkshop-eksctl
  region: ${AWS_REGION}
  version: "1.19"

availabilityZones: ["${AZS[0]}", "${AZS[1]}", "${AZS[2]}"]

managedNodeGroups:
- name: nodegroup
  desiredCapacity: 3
  instanceType: t3.small
  ssh:
    enableSsm: true

# To enable all of the control plane logs, uncomment below:
# cloudWatch:
#  clusterLogging:
#    enableTypes: ["*"]

secretsEncryption:
  keyARN: ${MASTER_ARN}
EOF

Step 2 – Create the EKS Cluster

Tell the eksctl tool to create a new cluster using the ekscluster.yaml.

eksctl create cluster -f ekscluster.yaml