gcloud compute forwarding-rules set-target - modify a forwarding rule to direct network traffic to a new target
gcloud compute forwarding-rules set-target NAME [--global | --region REGION] [--target-http-proxy TARGET_HTTP_PROXY | --target-https-proxy TARGET_HTTPS_PROXY | --target-instance TARGET_INSTANCE | --target-pool TARGET_POOL | --target-vpn-gateway TARGET_VPN_GATEWAY] [--target-instance-zone TARGET_INSTANCE_ZONE] [GLOBAL-FLAG ...]
gcloud compute forwarding-rules set-target is used to set a new target for a forwarding rule. Forwarding rules match and direct certain types of traffic to a load balancer which is controlled by a target pool, a target instance, or a target HTTP proxy. Target pools and target instances perform load balancing at the layer 3 of the OSI networking model (http://en.wikipedia.org/wiki/Network_layer). Target HTTP proxies perform load balancing at layer 7.
Forwarding rules can be either regional or global. They are regional if they point to a target pool or a target instance and global if they point to a target HTTP proxy.
For more information on load balancing, see https://cloud.google.com/compute/docs/load-balancing-and-autoscaling/.
When creating a forwarding rule, exactly one of --target-instance, --target-pool, --target-http-proxy, -target-https-proxy, and --target-vpn-gateway must be specified.
NAMEThe name of the forwarding rule.
--globalIf provided, assume the forwarding rules are global. A forwarding rule is global if it references a target HTTP proxy.--region REGION
The region of the forwarding rule to operate on. If not specified, you will be prompted to select a region.--target-http-proxy TARGET_HTTP_PROXY
To avoid prompting when this flag is omitted, you can set the compute/region property:
$ gcloud config set compute/region REGION
A list of regions can be fetched by running:
$ gcloud compute regions list
To unset the property, run:
$ gcloud config unset compute/region
Alternatively, the region can be stored in the environment variable CLOUDSDK_COMPUTE_REGION.
The target HTTP proxy that will receive the traffic.--target-https-proxy TARGET_HTTPS_PROXY
The target HTTPS proxy that will receive the traffic.--target-instance TARGET_INSTANCE
The name of the target instance that will receive the traffic. The target instance must be in a zone thats in the forwarding rules region. Global forwarding rules may not direct traffic to target instances. If not specified, you will be prompted to select a zone.--target-instance-zone TARGET_INSTANCE_ZONE
To avoid prompting when this flag is omitted, you can set the compute/zone property:
$ gcloud config set compute/zone ZONE
A list of zones can be fetched by running:
$ gcloud compute zones list
To unset the property, run:
$ gcloud config unset compute/zone
Alternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE.
The zone of the target instance.--target-pool TARGET_POOL
The target pool that will receive the traffic. The target pool must be in the same region as the forwarding rule. Global forwarding rules may not direct traffic to target pools.--target-vpn-gateway TARGET_VPN_GATEWAY
The target VPN gateway that will receive forwarded traffic.
Run $ gcloud help for a description of flags available to all commands.