general-purpose node pool, and one using only custom node pools (where you manage the NodePool and EC2NodeClass resources yourself).
Prerequisites
- AWS credentials configured with permissions to create EKS clusters, IAM roles, VPCs, and EC2 resources
- Terraform >= 1.5.7
- AWS provider >= 6.28
- The example provisions its own VPC — no pre-existing VPC is required
Example code
The following is the completemain.tf from examples/eks-auto-mode.
Key concepts
Built-in node pools vs. custom node pools
compute_config block
enabled = true— turns on EKS Auto Mode for the clusternode_pools— list of built-in pools to activate; valid values includegeneral-purposeandsystem- Omitting
node_pools(withcreate_auto_mode_iam_resources = true) means you bring your own Karpenter-styleNodePoolresources
When
endpoint_public_access = true, the Kubernetes API is reachable from the internet. Restrict endpoint_public_access_cidrs to your own IP range in production.Deploy
1
Initialize Terraform
Download the required providers and modules.
2
Review the plan
Preview what Terraform will create before applying.
3
Apply the configuration
Create the cluster and all supporting resources. Cluster creation typically takes 10–15 minutes.
4
Configure kubectl
Update your local kubeconfig so you can interact with the cluster.
Key outputs
After a successful apply the following outputs are available:Cleanup
Full example on GitHub
View the complete example includingoutputs.tf, variables.tf, and versions.tf.