Update BGP route policies

This guide describes how to do the following updates to BGP route policies for Cloud Router:

Remove a BGP route policy

Run the following:

gcloud compute routers remove-route-policy ROUTER_NAME \
 --policy-name=BGP_ROUTE_POLICY_NAME

Replace the following:

  • ROUTER_NAME: the name of your Cloud Router
  • BGP_ROUTE_POLICY_NAME: the name of the BGP route policy that you want to remove

Add a BGP route policy term

Run the following:

gcloud compute routers add-route-policy-term ROUTER_NAME \
 --policy-name=BGP_ROUTE_POLICY_NAME \
 --priority=PRIORITY \
 --match="CEL_MATCH_EXPRESSION" \
 --actions="CEL_ACTIONS_EXPRESSION"
 --region=REGION

Replace the following:

  • ROUTER_NAME: the name of your Cloud Router
  • BGP_ROUTE_POLICY_NAME: the name of the BGP route policy that you want to export
  • PRIORITY: the order of this term within the BGP route policy, where lower values indicate higher priority. The accepted range is [0, 2^31).
  • CEL_MATCH_EXPRESSION: a Common Expression Language (CEL) element that matches routes that this term applies to
  • CEL_ACTIONS_EXPRESSION: a semicolon separated CEL expression for actions to take for items that match this rule
  • REGION: the region that the Cloud Router is located in

Update a BGP route policy term

Run the following:

gcloud compute routers update-route-policy-term ROUTER_NAME \
 --policy-name=BGP_ROUTE_POLICY_NAME \
 --priority=PRIORITY \
 --match="CEL_MATCH_EXPRESSION" \
 --actions="CEL_ACTIONS_EXPRESSION" \
 --region=REGION

Replace the following:

  • ROUTER_NAME: the name of your Cloud Router
  • BGP_ROUTE_POLICY_NAME: the name of the BGP route policy that you want to export
  • PRIORITY: The order of this term within the BGP route policy, where lower values indicate higher priority. The accepted range is [0, 2^31).
  • CEL_MATCH_EXPRESSION: a CEL element that matches routes that this term applies to
  • CEL_ACTIONS_EXPRESSION: a semicolon separated CEL expression for actions to take for items that match this rule
  • REGION: the region that the Cloud Router is located in

Remove a BGP route policy term

Run the following:

gcloud compute routers remove-route-policy-term ROUTER_NAME \
 --policy-name=BGP_ROUTE_POLICY_NAME \
 --priority=PRIORITY
 --region=REGION

Replace the following:

  • ROUTER_NAME: the name of your Cloud Router
  • BGP_ROUTE_POLICY_NAME: the name of the BGP route policy that you want to export
  • PRIORITY: the order of this term within the BGP route policy, where lower values indicate higher priority. The accepted range is [0, 2^31).
  • REGION: the region that the Cloud Router is located in

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

Last updated 2025年10月24日 UTC.