In this section, you will initialize and deploy the Terraform IaC in the distributed-application/eks-cluster directory of the repository you downloaded.
NOTE: Replace <your_edge_city> with one of the following values:
atlanta | denver | miami | seattle | seoul |
boston | houston | minneapolis | london | tokyo |
chicago | lasvegas | newyorkcity | osaka | washingtondc |
dallas | losangeles | phoenix | sanfrancisco |
Step 1 – Entering the distributed-application/eks-cluster directory
cd distributed-application/eks-cluster
Step 2 – Initializing Terraform providers/modules in this directory
The terraform init command will download and configure the specific provider versions and modules specified in the IaC in this directory:
terraform init
Here’s an example of what you should see:

Figure 13.6 – Initializing Terraform in the eks-cluster directory
Step 3 – Starting the deployment with Terraform
Use the terraform apply command as follows:
terraform apply -var=edge_city=<your_edge_city> -auto-approve
Here’s an example of what you should see:

Figure 13.7 – Applying Terraform IaC for eks-cluster
Note
This will take around 10 minutes to complete.
Step 4 – Using the AWS CLI to configure kubectl
This will be needed to validate your EKS deployment. Issue the following command:
aws eks update-kubeconfig –name distributedcluster –region <your_region>
Replace <your_region> with the AWS parent region you are targeting, as in the following example:

Figure 13.8 – Using the AWS CLI to update configuration for kubectl
Step 5 – Using kubectl to verify your EKS deployment
Execute the following kubectl command to see the status of your EKS cluster:
kubectl get nodes
NOTE:
The node on the 10.0.4.0/24 subnet is located in AWS Wavelength, and it is normal for it to show a status of NotReady. This will be addressed in the next section.
Here’s an example of what you should see:

Figure 13.9 – Retrieving the status of the EKS nodes using kubectl
Step 6 – Changing back to the root directory
In preparation for the next section, return to the root of the distributed-application directory within the repository you downloaded:
cd ..
Using Terraform to push a distributed application
Now that you have EKS deployed, we will use a separate set of Terraform IaC to deploy the distributed application itself.
Components
Kubernetes deployments – Three deployments in separate namespaces and with separate node taints. This will force pods to deploy to either the parent region, the Local Zone, or the Wavelength Zone, as appropriate.
Kubernetes services – A simple NodePort service will allow traffic from each node’s public IP address into those locations. This will allow you to test accessing containers in EKS via three different paths into AWS.