GCLOUD_COMPUTE_FORWARDING-RULES_CREATE(1)

NAME

gcloud compute forwarding-rules create - create a forwarding rule to direct network traffic to a load balancer

SYNOPSIS

gcloud compute forwarding-rules create NAME (--backend-service=BACKEND_SERVICE | --target-http-proxy=TARGET_HTTP_PROXY | --target-https-proxy=TARGET_HTTPS_PROXY | --target-instance=TARGET_INSTANCE | --target-pool=TARGET_POOL | --target-ssl-proxy=TARGET_SSL_PROXY | --target-vpn-gateway=TARGET_VPN_GATEWAY) [--address=ADDRESS] [--description=DESCRIPTION] [--ip-protocol=IP_PROTOCOL] [--load-balancing-scheme=LOAD_BALANCING_SCHEME; default="EXTERNAL"] [--network=NETWORK] [--subnet=SUBNET] [--subnet-region=SUBNET_REGION] [--target-instance-zone=TARGET_INSTANCE_ZONE] [--target-pool-region=TARGET_POOL_REGION] [--target-vpn-gateway-region=TARGET_VPN_GATEWAY_REGION] [--address-region=ADDRESS_REGION | --global-address] [--backend-service-region=BACKEND_SERVICE_REGION | --global-backend-service] [--global | --region=REGION] [--port-range=[PORT | PORT-PORT] | --ports=[PORT | PORT-PORT],[[PORT | PORT-PORT],...]] [GLOBAL-FLAG ...]

DESCRIPTION
gcloud compute forwarding-rules create is used to create 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, --target-ssl-proxy, or --target-vpn-gateway must be specified.

POSITIONAL ARGUMENTS

    NAME
        The name of the forwarding rule.

REQUIRED FLAGS
Exactly one of these must be specified:

    --backend-service=BACKEND_SERVICE
        The target backend service that will receive the traffic.

    --target-http-proxy=TARGET_HTTP_PROXY
        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 that's in the forwarding rule's region. Global forwarding rules may not direct traffic to target instances. If not specified, you will be prompted to select a 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.

    --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-ssl-proxy=TARGET_SSL_PROXY
        The target SSL proxy that will receive the traffic.

    --target-vpn-gateway=TARGET_VPN_GATEWAY
        The target VPN gateway that will receive forwarded traffic.

OPTIONAL FLAGS

    --address=ADDRESS
        The external IP address that the forwarding rule will serve. All traffic sent to this IP address is directed to the target pointed to by the forwarding rule. If the address is reserved, it must either (1) reside in the global scope if the forwarding rule is being configured to point to a target HTTP proxy or (2) reside in the same region as the forwarding rule if the forwarding rule is being configured to point to a target pool or target instance. If this flag is omitted, an ephemeral IP address is assigned. Note: --address only accepts IPv4 addresses in the format of 1.2.3.4.

    --description=DESCRIPTION
        An optional textual description for the forwarding rule.

    --ip-protocol=IP_PROTOCOL
        The IP protocol that the rule will serve. The default is TCP. IP_PROTOCOL must be one of: AH, ESP, ICMP, SCTP, TCP, UDP.

    --load-balancing-scheme=LOAD_BALANCING_SCHEME; default="EXTERNAL"
        This signifies what the forwarding rule will be used for. LOAD_BALANCING_SCHEME must be one of:

        EXTERNAL
            Used for HTTP or HTTPS for External Load Balancing.

        INTERNAL
            Used for Internal Network Load Balancing.

    --network=NETWORK
        (Only for Internal Load Balancing) The network that this forwarding rule applies to. If this field is not specified, the default network will be used. In the absence of the default network, this field must be specified.

    --subnet=SUBNET
        (Only for Internal Load Balancing) The subnetwork that this forwarding rule applies to. If the network configured for this forwarding rule is in auto subnet mode, the subnetwork is optional. However, if the network is in custom subnet mode, a subnetwork must be specified.

    --subnet-region=SUBNET_REGION
        The region of the subnetwork to operate on. If not specified it will be set the region of the forwarding rule. Overrides the default compute/region property value for this command invocation.

    --target-instance-zone=TARGET_INSTANCE_ZONE
        The zone of the target instance to operate on. Overrides the default compute/zone property value for this command invocation.

    --target-pool-region=TARGET_POOL_REGION
        The region of the target pool to operate on. If not specified it will be set the region of the forwarding rule. Overrides the default compute/region property value for this command invocation.

    --target-vpn-gateway-region=TARGET_VPN_GATEWAY_REGION
        The region of the VPN gateway to operate on. If not specified it will be set the region of the forwarding rule. Overrides the default compute/region property value for this command invocation.

At most one of these may be specified:

    --address-region=ADDRESS_REGION
        The region of the address to operate on. If not specified, you will be prompted to select a region. 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.

    --global-address
        If provided, it is assumed the address is global.

At most one of these may be specified:

    --backend-service-region=BACKEND_SERVICE_REGION
        The region of the backend service to operate on. If not specified it will be set the region of the forwarding rule. Overrides the default compute/region property value for this command invocation.

    --global-backend-service
        If provided, it is assumed the backend service is global.

At most one of these may be specified:

    --global
        If provided, it is assumed the forwarding rule is global.

    --region=REGION
        The region of the forwarding rule to operate on. If not specified, you will be prompted to select a region. 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.

At most one of these may be specified:

    --port-range=[PORT | PORT-PORT]
        DEPRECATED, use --ports. If specified, only packets addressed to ports in the specified range will be forwarded. If not specified for regional forwarding rules, all ports are matched. This flag is required for global forwarding rules. Either an individual port (--port-range 80) or a range of ports (--port-range 3000-3100) may be specified.

    --ports=[PORT | PORT-PORT],[[PORT | PORT-PORT],...]
        If specified, only packets addressed to ports in the specified list will be forwarded. If not specified for regional forwarding rules, all ports are matched. This flag is required for global forwarding rules and accepts a single continuous set of ports. Individual ports and ranges can be specified, for example (--ports 8000-8004 or --ports 80).

GLOBAL FLAGS
Run $ gcloud help for a description of flags available to all commands.