The product described by this documentation, Anthos Clusters on AWS (previous generation), is now in maintenance mode. All new installs must use the current generation product, Anthos clusters on AWS.
Stay organized with collections
Save and categorize content based on your preferences.
To set up an externally facing load balancer with GKE on AWS,
you need to tag your VPC and public subnet with your cluster ID. If you
have already tagged your VPC and subnet, skip to
Enabling Ingress.
Before you begin
Before you start using GKE on AWS, make sure you have performed the following tasks:
GKE on AWS requires tags on subnets that contain load balancer
endpoints. GKE on AWS automatically tags all subnets specified in the
spec.Networking.ServiceLoadBalancerSubnetIDs
field of the AWSCluster resource.
If you would like to add additional subnets to your user cluster, or if you need
to re-apply tags to existing subnets, perform the following steps.
From your anthos-aws directory, use
anthos-gke to switch context to your management service.
cd anthos-aws
anthos-gke aws management get-credentials
Get the ID of your cluster's AWS VPC with kubectl and store it as a
variable.
The output is an object that contains your subnet ID. It resembles
subnet-1234abcdefg. You can check the variable with echo:
echo $SUBNET_ID
The response includes your subnet ID.
subnet-012345678abcdef
Multiple subnets
If you are using multiple subnets for your AWSNodePools
(for example, if you use multiple availability zones), you need to
tag your subnet IDs individually.
Retrieve your list of subnet IDs with aws ec2 describe-subnets.
To get a list of all public subnets, run the following command:
Replace subnet-ids with the list of subnet IDs, separated by
spaces. For example,
subnet-012345678abcdef subnet-abcdef123456789 subnet-123456789abcdef.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Preparing AWS networking\n\nTo set up an externally facing load balancer with GKE on AWS,\nyou need to tag your VPC and public subnet with your cluster ID. If you\nhave already tagged your VPC and subnet, skip to\n[Enabling Ingress](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/ingress).\n\nBefore you begin\n----------------\n\n\nBefore you start using GKE on AWS, make sure you have performed the following tasks:\n\n- Complete the [Prerequisites](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/prerequisites).\n\n\u003c!-- --\u003e\n\n- Install a [management service](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/installing-management).\n- Create a [user cluster](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/how-to/creating-user-cluster).\n\nGKE on AWS requires tags on subnets that contain load balancer\nendpoints. GKE on AWS automatically tags all subnets specified in the\n[`spec.Networking.ServiceLoadBalancerSubnetIDs`](/kubernetes-engine/multi-cloud/docs/aws/previous-generation/reference/awscluster#specnetworking)\nfield of the `AWSCluster` resource.\n\nIf you would like to add additional subnets to your user cluster, or if you need\nto re-apply tags to existing subnets, perform the following steps.\n\n1. From your `anthos-aws` directory, use\n `anthos-gke` to switch context to your management service.\n\n ```sh\n cd anthos-aws\n anthos-gke aws management get-credentials\n ```\n | **Note:** `anthos-gke` uses the credentials you specified when you ran `aws configure`.\n\n \u003cbr /\u003e\n\n2. Get the ID of your cluster's AWS VPC with `kubectl` and store it as a\n variable.\n\n export VPC_ID=$(\\\n env HTTPS_PROXY=http://localhost:8118 \\\n kubectl get awscluster cluster-0 -o jsonpath='{.spec.networking.vpcID}')\n\n3. Check the variables content with `echo`. The output\n resembles `vpc-12345678abcdef0`.\n\n echo $VPC_ID\n\n4. Save your cluster ID into an environment variable.\n\n export CLUSTER_ID=$(\\\n env HTTPS_PROXY=http://localhost:8118 \\\n kubectl get awscluster cluster-0 -o jsonpath='{.status.clusterID}')\n\n You can check the variable with `echo`: \n\n echo $CLUSTER_ID\n\n The response includes your cluster ID. \n\n gke-12345678\n\n5. If you installed GKE on AWS into a dedicated VPC, you can use\n the `aws` command-line tool to retrieve the subnet ID.\n\n Select from the following options:\n - Public, if you want to expose Services on your public subnet.\n - Private, if you want to expose Services on your private subnet.\n - Multiple subnets, if you want to expose Services on multiple subnets.\n\n ### Public\n\n export SUBNET_ID=$(aws ec2 describe-subnets \\\n --filters \"Name=vpc-id,Values=$VPC_ID\" \"Name=tag:Name,Values=*public*\" \\\n --query \"Subnets[*].SubnetId\" \\\n --output text)\n\n The output is an object that contains your subnet ID. It resembles\n `subnet-1234abcdefg`. You can check the variable with `echo`: \n\n echo $SUBNET_ID\n\n The response includes your subnet ID. \n\n subnet-012345678abcdef\n\n ### Private\n\n export SUBNET_ID=$(aws ec2 describe-subnets \\\n --filters \"Name=vpc-id,Values=$VPC_ID\" \"Name=tag:Name,Values=*private*\" \\\n --query \"Subnets[*].SubnetId\" \\\n --output text)\n\n The output is an object that contains your subnet ID. It resembles\n `subnet-1234abcdefg`. You can check the variable with `echo`: \n\n echo $SUBNET_ID\n\n The response includes your subnet ID. \n\n subnet-012345678abcdef\n\n ### Multiple subnets\n\n If you are using multiple subnets for your AWSNodePools\n (for example, if you use multiple availability zones), you need to\n tag your subnet IDs individually.\n | **Note:** The following commands assume your subnets have `public` or `private` in their name. If your subnets do not include this text, change the parameters of the `--filters` flag. See [Using filtering](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Filtering.html) for more information.\n\n Retrieve your list of subnet IDs with `aws ec2 describe-subnets`.\n\n To get a list of all public subnets, run the following command: \n\n aws ec2 describe-subnets \\\n --filters \"Name=vpc-id,Values=$VPC_ID\" \"Name=tag:Name,Values=*public*\" \\\n --query \"Subnets[*].SubnetId\" \\\n --output text\n\n To get a list of all private subnets, run the following command: \n\n aws ec2 describe-subnets \\\n --filters \"Name=vpc-id,Values=$VPC_ID\" \"Name=tag:Name,Values=*private*\" \\\n --query \"Subnets[*].SubnetId\" \\\n --output text\n\n The response includes your subnet IDs. \n\n subnet-012345678abcdef\n subnet-abcdef123456789\n subnet-123456789abcdef\n\n6. Tag your subnet with your cluster ID. If you have multiple subnets,\n select Multiple subnets.\n\n ### Single subnet\n\n aws ec2 create-tags \\\n --resources $SUBNET_ID \\\n --tags Key=kubernetes.io/cluster/$CLUSTER_ID,Value=shared\n\n ### Multiple subnets\n\n For each of your subnets, run the following command: \n\n aws ec2 create-tags \\\n --resources \u003cvar translate=\"no\"\u003esubnet-ids\u003c/var\u003e \\\n --tags Key=kubernetes.io/cluster/$CLUSTER_ID,Value=shared\n\n Replace \u003cvar translate=\"no\"\u003esubnet-ids\u003c/var\u003e with the list of subnet IDs, separated by\n spaces. For example,\n `subnet-012345678abcdef subnet-abcdef123456789 subnet-123456789abcdef`."]]