gcloud compute network-firewall-policies rules create PRIORITY --action=ACTION --firewall-policy=FIREWALL_POLICY --layer4-configs=[LAYER4_CONFIG,…] [--description=DESCRIPTION] [--dest-address-groups=[DEST_ADDRESS_GROUPS,…]] [--dest-fqdns=[DEST_FQDNS,…]] [--dest-ip-ranges=[DEST_IP_RANGE,…]] [--dest-network-context=DEST_NETWORK_CONTEXT] [--dest-region-codes=[DEST_REGION_CODES,…]] [--dest-threat-intelligence=[DEST_THREAT_INTELLIGENCE_LISTS,…]] [--direction=DIRECTION] [--[no-]disabled] [--[no-]enable-logging] [--security-profile-group=SECURITY_PROFILE_GROUP] [--src-address-groups=[SOURCE_ADDRESS_GROUPS,…]] [--src-fqdns=[SOURCE_FQDNS,…]] [--src-ip-ranges=[SRC_IP_RANGE,…]] [--src-network-context=SRC_NETWORK_CONTEXT] [--src-networks=[SRC_NETWORKS,…]] [--src-region-codes=[SOURCE_REGION_CODES,…]] [--src-secure-tags=[SOURCE_SECURE_TAGS,…]] [--src-threat-intelligence=[SOURCE_THREAT_INTELLIGENCE_LISTS,…]] [--target-forwarding-rules=[TARGET_FORWARDING_RULES,…]] [--target-secure-tags=[TARGET_SECURE_TAGS,…]] [--target-service-accounts=[TARGET_SERVICE_ACCOUNTS,…]] [--target-type=TARGET_TYPE] [--[no-]tls-inspect] [--firewall-policy-region=FIREWALL_POLICY_REGION | --global-firewall-policy] [GCLOUD_WIDE_FLAG …]
gcloud compute network-firewall-policies rules create is used to
create network firewall policy rules.
10 in a
global network firewall policy with name
my-policy and description
example rule, run:
gcloud compute network-firewall-policies rules create 10 --firewall-policy=my-policy --action=allow --description="example rule" --global-firewall-policy
To create a rule with priority in a
regional network firewall policy with name
10 and description
my-region-policy, in region
example rule, run:
region-a
gcloud compute network-firewall-policies rules create 10 --firewall-policy=my-policy --action=allow --description="example rule"PRIORITY--action=ACTIONACTION must be one of: allow,
deny, goto_next,
apply_security_profile_group.
--firewall-policy=FIREWALL_POLICY--layer4-configs=[LAYER4_CONFIG,…]--description=DESCRIPTION--dest-address-groups=[DEST_ADDRESS_GROUPS,…]--dest-fqdns=[DEST_FQDNS,…]egress.
--dest-ip-ranges=[DEST_IP_RANGE,…]--dest-network-context=DEST_NETWORK_CONTEXT--dest-region-codes=[DEST_REGION_CODES,…]egress. Cannot be specified when the source network
context is NON_INTERNET.
--dest-threat-intelligence=[DEST_THREAT_INTELLIGENCE_LISTS,…]egress. Cannot be specified when source
network context is NON_INTERNET. The available lists can be found here: https://cloud.google.com/vpc/docs/firewall-policies-rule-details#threat-intelligence-fw-policy.
--direction=DIRECTIONDIRECTION must be one of:
INGRESS, EGRESS.
--[no-]disabled--disabled to enable and --no-disabled to disable.
--[no-]enable-logging--enable-logging to enable and
--no-enable-logging to disable.
--security-profile-group=SECURITY_PROFILE_GROUP--src-address-groups=[SOURCE_ADDRESS_GROUPS,…]--src-fqdns=[SOURCE_FQDNS,…]ingress.
--src-ip-ranges=[SRC_IP_RANGE,…]--src-network-context=SRC_NETWORK_CONTEXT--src-networks=[SRC_NETWORKS,…]--src-region-codes=[SOURCE_REGION_CODES,…]ingress. Cannot be specified when the source network context is
NON_INTERNET, VPC_NETWORK or INTRA_VPC.
--src-threat-intelligence=[SOURCE_THREAT_INTELLIGENCE_LISTS,…]ingress. Cannot be specified when the source
network context is NON_INTERNET, VPC_NETWORK or INTRA_VPC. The available lists
can be found here: https://cloud.google.com/vpc/docs/firewall-policies-rule-details#threat-intelligence-fw-policy.
--target-forwarding-rules=[TARGET_FORWARDING_RULES,…]--target-service-accounts=[TARGET_SERVICE_ACCOUNTS,…]--target-type=TARGET_TYPETARGET_TYPE must be one of: INSTANCES,
INTERNAL_MANAGED_LB.
--[no-]tls-inspect--tls-inspect to enable and
--no-tls-inspect to disable.
--firewall-policy-region=FIREWALL_POLICY_REGIONcompute/region property value for this command invocation.
--global-firewall-policy--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.
gcloud alpha compute network-firewall-policies rules creategcloud beta compute network-firewall-policies rules creategcloud preview compute network-firewall-policies rules create
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 2026-05-27 UTC.