AWS Logo
Menu
Guide to VPC Lattice Setup & EKS East-West Traffic Testing

Guide to VPC Lattice Setup & EKS East-West Traffic Testing

Automated Guide to VPC Lattice Setup and East-West Traffic Testing in Amazon EKS

Published Apr 10, 2025
In today’s cloud-centric world, modern applications demand robust, secure, and scalable solutions for service-to-service communication. As organizations increasingly adopt microservices architectures, managing traffic between services—often referred to as east-west traffic—becomes a critical challenge. Amazon Elastic Kubernetes Service (EKS) provides a powerful platform for running Kubernetes workloads, and when paired with Amazon VPC Lattice, it offers an advanced, streamlined approach to traffic management. VPC Lattice is a fully managed service that simplifies connectivity between services across Virtual Private Clouds (VPCs), accounts, and compute environments, ensuring secure and efficient communication without the complexity of traditional networking setups.
This comprehensive guide walks you through an automated Bash script designed to deploy the AWS Gateway API Controller for EKS using VPC Lattice. The script automates essential configuration steps, including setting up IAM policies, creating service accounts, installing the Gateway API Controller via Helm, and establishing GatewayClass and Gateway resources for traffic routing. Beyond setup, it includes testing mechanisms to verify north-south (external-to-cluster) and east-west (service-to-service) connectivity using HTTPRoutes and DNS-based routing. By the end of this guide, you’ll have a fully functional VPC Lattice configuration integrated with your EKS cluster, ready to handle sophisticated traffic patterns.
The objectives of this script are clear and practical:
  1. Deploy the AWS Gateway API Controller: Use Helm to install and configure the controller, enabling VPC Lattice integration with EKS.
  2. Establish Traffic Routing: Set up GatewayClass and Gateway resources to define how traffic enters and moves within your cluster.
  3. Test North-South Connectivity: Validate external access to your services using HTTPRoutes.
  4. Verify East-West Communication: Ensure seamless service-to-service interactions with DNS-based routing.
This guide assumes a basic familiarity with AWS, Kubernetes, and command-line tools, but it provides enough detail to assist both novice and experienced users. Let’s dive into the process and explore how this script simplifies a potentially complex setup.

Why VPC Lattice and EKS?

Before diving into the script, it’s worth understanding why VPC Lattice is a game-changer for EKS users. Traditional Kubernetes networking relies on tools like Ingress controllers or service meshes, which can be effective but often require significant configuration overhead. VPC Lattice abstracts much of this complexity by operating at the application layer (Layer 7), offering features like path-based routing, authentication, and observability out of the box. When integrated with EKS via the AWS Gateway API Controller, it allows you to define networking policies declaratively using Kubernetes-native resources like Gateway and HTTPRoute, aligning with modern Infrastructure-as-Code practices.
For east-west traffic—communication between microservices within your cluster or across VPCs—VPC Lattice provides a centralized control plane. This eliminates the need for intricate service discovery mechanisms or manual VPC peering configurations, making it ideal for multi-cluster or hybrid environments. The script we’re about to explore automates this integration, saving time and reducing the risk of human error.

Prerequisites

To successfully execute this script, ensure you have the following in place:
  • An EKS Cluster: An existing cluster provisioned in your AWS account, ideally created with eksctl for compatibility with the script’s commands.
  • Command-Line Tools: Install aws-cli (AWS Command Line Interface), kubectl (Kubernetes CLI), eksctl (EKS management tool), and helm (Kubernetes package manager).
  • AWS Permissions: Access to an AWS account with sufficient privileges to manage IAM roles, policies, EKS clusters, and VPC resources.
  • Git: Installed to clone the AWS Gateway API Controller repository.
With these prerequisites met, you’re ready to proceed with the automated setup.

Detailed Walkthrough of the Script

The Bash script provided below automates the entire process, from environment setup to connectivity testing. Below, I’ve expanded the explanations for each section to provide deeper insight into what’s happening and why each step matters.

Expanded Explanation of Key Steps

1. Variable Definition

The script begins by defining critical variables like CLUSTER_NAME, AWS_REGION, AWS_ACCOUNT_ID, and VPC_ID. These must be customized to match your environment, ensuring the script targets the correct resources. Incorrect values here can lead to failures, so double-check them before running.

2. IAM Policy Creation

The script downloads a predefined IAM policy from the AWS GitHub repository and creates it in your account. This policy grants the Gateway API Controller permissions to manage VPC Lattice resources, such as service networks and targets. Naming the policy uniquely (e.g., VPCLatticeControllerIAMPolicy-eks-2) avoids conflicts with existing policies.

3. Namespace and Service Account

The aws-application-networking-system namespace isolates the controller’s resources, while the IAM service account ties AWS permissions to Kubernetes pods via OIDC. This adheres to the principle of least privilege, enhancing security.

4. Helm Installation

Using Helm to deploy the Gateway API Controller ensures a reproducible, version-controlled setup. The --set flags configure the controller with your cluster’s specifics, and the three-minute wait periods (sleep 180) allow for stabilization, which is critical in distributed systems like Kubernetes.

5. GatewayClass and Gateway

The GatewayClass defines a template for Gateway resources, which VPC Lattice uses to expose services. The my-hotel Gateway example demonstrates how external traffic can enter your cluster, a key step for north-south connectivity.

6. HTTPRoutes and Testing

The script applies HTTPRoute configurations for services like parking, review, and inventory, enabling path-based routing. The final kubectl exec commands test east-west communication by curling DNS names assigned by VPC Lattice, proving that services can communicate seamlessly.

For further customization or troubleshooting, consult the AWS VPC Lattice Documentation.

 

Comments