gcloud alpha network-connectivity policy-based-routes create

NAME
gcloud alpha network-connectivity policy-based-routes create - create a new policy-based route
SYNOPSIS
gcloud alpha network-connectivity policy-based-routes createPOLICY_BASED_ROUTE--network=NETWORK[--async][--description=DESCRIPTION][--destination-range=DESTINATION_RANGE][--ip-protocol=IP_PROTOCOL][--labels=[KEY=VALUE,…]][--priority=PRIORITY][--protocol-version=PROTOCOL_VERSION; default="IPV4"][--source-range=SOURCE_RANGE][--interconnect-attachment-region=INTERCONNECT_ATTACHMENT_REGION    |--tags=[TAGS,…]][--next-hop-ilb-ip=NEXT_HOP_ILB_IP    |--next-hop-other-routes=NEXT_HOP_OTHER_ROUTES][GCLOUD_WIDE_FLAG]
DESCRIPTION
(ALPHA) Create a new policy-based route with the given name.
EXAMPLES
To create a policy-based route with the namemy-pbr to route all traffic indefault network to an internal loadbalancer with IP 10.0.0.1, run:
gcloudalphanetwork-connectivitypolicy-based-routescreatemy-pbr--network="projects/my-project/global/networks/default"--next-hop-ilb-ip=10.0.0.1
POSITIONAL ARGUMENTS
Policy based route resource - Name of the policy-based route to be created. Thisrepresents a Cloud resource. (NOTE) Some attributes are not given arguments inthis group but can be set in other ways.

To set theproject attribute:

  • provide the argumentpolicy_based_route on the command line with afully specified name;
  • provide the argument--project on the command line;
  • set the propertycore/project.

This must be specified.

POLICY_BASED_ROUTE
ID of the policy based route or fully qualified identifier for the policy basedroute.

To set thepolicy_based_route attribute:

  • provide the argumentpolicy_based_route on the command line.
REQUIRED FLAGS
--network=NETWORK
Fully-qualified URL of the network that this route applies to. E.g.projects/my-project/global/networks/my-network
OPTIONAL FLAGS
--async
Return immediately, without waiting for the operation in progress to complete.
--description=DESCRIPTION
Optional description of this resource. Provide this field when you create theresource.
--destination-range=DESTINATION_RANGE
Destination IP range of outgoing packets that this policy-based route appliesto.
--ip-protocol=IP_PROTOCOL
IP protocol that this policy-based route applies to. Valid values areTCP,UDP, andALL. Default isALL.
--labels=[KEY=VALUE,…]
List of label KEY=VALUE pairs to add.

Keys must start with a lowercase character and contain only hyphens(-), underscores (_), lowercase characters, andnumbers. Values must contain only hyphens (-), underscores(_), lowercase characters, and numbers.

--priority=PRIORITY
Priority of this policy-based route. Priority is used to break ties in caseswhere there are more than one matching policy-based routes found. In cases wheremultiple policy-based routes are matched, the one with the lowest-numberedpriority value wins. The default value is 1000. The priority value must be from1 to 65535, inclusive. Note the priority of policy-based route is always higherthan other types of route (e.g. static routes/advanced routes)
--protocol-version=PROTOCOL_VERSION; default="IPV4"
Internet protocol versions that this policy-based route applies to. Valid valuesareIPV4, andIPV6. Default isIPV4'.PROTOCOL_VERSION must be one of: *ipv4*, *ipv6*,*protocol-version-unspecified*.
--source-range=SOURCE_RANGE
Source IP range of outgoing packets that this policy-based route applies to.
At most one of these can be specified:
--interconnect-attachment-region=INTERCONNECT_ATTACHMENT_REGION
Cloud region to install this policy-based route on interconnect attachment. Useall to install it on all interconnect attachments. Note if both--tags and--interconnect-attachment-region are notset, then the policy-based route will be installed in all network endpoints,including VMs, VPNs, and Interconnect attachements, in the network.
--tags=[TAGS,…]
List of VM instance tags that this route applies to. VM instances that have ANYof tags specified here installs this route. Note if both--tags and--interconnect-attachment-region are not set, then the policy-basedroute will be installed in all endpoints, including VMs, VPNs, and Interconnectattachements, in the network.
At most one of these can be specified:
--next-hop-ilb-ip=NEXT_HOP_ILB_IP
IP of a global access enabled L4 ILB that should be the next hop to handlepackets.
--next-hop-other-routes=NEXT_HOP_OTHER_ROUTES
Next hop should be other routes that handle packets. This effectively excludesmatching packets being applied on other policy-based routes with a lowerpriority.NEXT_HOP_OTHER_ROUTES must be one of:default-routing,other-routes-unspecified.
GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

API REFERENCE
This command uses thenetworkconnectivity/v1beta API. The fulldocumentation for this API can be found at:https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest
NOTES
This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudnetwork-connectivitypolicy-based-routescreate
gcloudbetanetwork-connectivitypolicy-based-routescreate

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-05-07 UTC.