Skip to content

Deploying the AWS Gateway API Controller

Follow these instructions to create a cluster and deploy the AWS Gateway API Controller. Run through them again for a second cluster to use with the extended example shown later.

NOTE: You can get the yaml files used on this page by cloning the AWS Gateway API Controller for VPC Lattice site. The files are in the examples/ directory.

  1. Set your region and cluster name as environment variables. See the Amazon VPC Lattice FAQs for a list of supported regions. For this example, we use us-west-2:
    export AWS_REGION=us-west-2
    export CLUSTER_NAME=my-cluster
  2. You can use an existing EKS cluster or create a new one as shown here:
    eksctl create cluster --name $CLUSTER_NAME --region $AWS_REGION
  3. First, configure security group to receive traffic from the VPC Lattice fleet. You must set up security groups so that they allow all Pods communicating with VPC Lattice to allow traffic on all ports from the address range.
    PREFIX_LIST_ID=$(aws ec2 describe-managed-prefix-lists --query "PrefixLists[?PrefixListName=="\'com.amazonaws.$AWS_REGION.vpc-lattice\'"].PrefixListId" | jq -r '.[]')
    MANAGED_PREFIX=$(aws ec2 get-managed-prefix-list-entries --prefix-list-id $PREFIX_LIST_ID --output json  | jq -r '.Entries[0].Cidr')
    CLUSTER_SG=$(aws eks describe-cluster --name $CLUSTER_NAME --output json| jq -r '.cluster.resourcesVpcConfig.clusterSecurityGroupId')
    aws ec2 authorize-security-group-ingress --group-id $CLUSTER_SG --cidr $MANAGED_PREFIX --protocol -1
  4. Create an IAM OIDC provider: See Creating an IAM OIDC provider for your cluster for details.
    eksctl utils associate-iam-oidc-provider --cluster $CLUSTER_NAME --approve --region $AWS_REGION
  5. Create a policy (recommended-inline-policy.json) in IAM with the following content that can invoke the gateway API and copy the policy arn for later use:
        "Version": "2012-10-17",
        "Statement": [
                "Effect": "Allow",
                "Action": [
                "Resource": "*"
    aws iam create-policy \
       --policy-name VPCLatticeControllerIAMPolicy \
       --policy-document file://examples/recommended-inline-policy.json
  6. Create the aws-application-networking-system namespace:
    kubectl apply -f examples/deploy-namesystem.yaml
  7. Retrieve the policy ARN:
    export VPCLatticeControllerIAMPolicyArn=$(aws iam list-policies --query 'Policies[?PolicyName==`VPCLatticeControllerIAMPolicy`].Arn' --output text)
  8. Create an iamserviceaccount for pod level permission:
    eksctl create iamserviceaccount \
       --cluster=$CLUSTER_NAME \
       --namespace=aws-application-networking-system \
       --name=gateway-api-controller \
       --attach-policy-arn=$VPCLatticeControllerIAMPolicyArn \
       --override-existing-serviceaccounts \
       --region $AWS_REGION \
  9. Run either kubectl or helm to deploy the controller:
    kubectl apply -f examples/deploy-v0.0.12.yaml
    # login to ECR
    aws ecr-public get-login-password --region us-east-1 | helm registry login --username AWS --password-stdin
    # Run helm with either install or upgrade
    helm install gateway-api-controller \
       --version=v0.0.12 \
       --set=serviceAccount.create=false --namespace aws-application-networking-system \
       # Region, clusterVpcId, awsAccountId are required for case where IMDS is NOT AVAILABLE, e.g Fargate
       --set=awsRegion= \
       --set=clusterVpcId= \
       --set=awsAccountId= \
  10. Create the amazon-vpc-lattice GatewayClass:
    kubectl apply -f examples/gatewayclass.yaml