Create EKS VPC

To create an EKS cluster you need a VPC that satisfies specific requirements, e.g., it should have subnets in at least two availability zones, any public subnets must be configured to auto-assign public IP addresses. We recommend that you use a VPC with public and private subnets so that Kubernetes can create public load balancers in the public subnets that load balance traffic to pods running on nodes that are in private subnets. To create a new VPC tailored to EKS requirements, you can follow the official getting started guide. Alternatively, a public-only approach is to use the default VPC in your region:

$ export VPCID=$(aws ec2 describe-vpcs --filters Name=isDefault,Values=true | jq -r '.Vpcs[0].VpcId')


If you have specific network requirements, e.g., deploy on a specific VPC and you already know the VPC ID, you can specify it explicitly with:

$ export VPCID=vpc-12345

Select subnets

On AWS, a VPC can contain more than one subnets, each of which is tied to an availability zone. To see a mapping between subnet IDs and AZ in your selected VPC run the following command:

$ aws ec2 describe-subnets \
>     --filters Name=vpc-id,Values=${VPCID?} | \
>     jq -r '.Subnets[] | .SubnetId, .AvailabilityZone' | paste - -

To use all subnets of the previously selected VPC:

$ export SUBNETIDS=$(aws ec2 describe-subnets --filters Name=vpc-id,Values=${VPCID?} | jq -r '.Subnets[].SubnetId' | xargs)


If you have specific network requirements, e.g., deploy on a subset of the available subnets, and you already know the VPC Subnet IDs, you can specify them explicitly with:

$ export SUBNETIDS="subnet-1 subnet-2"