gcloud compute network-endpoint-groups create NAME [--default-port=DEFAULT_PORT] [--network=NETWORK] [--network-endpoint-type=NETWORK_ENDPOINT_TYPE; default="gce-vm-ip-port"] [--producer-port=PRODUCER_PORT] [--psc-target-service=PSC_TARGET_SERVICE] [--subnet=SUBNET] [--cloud-function-name=CLOUD_FUNCTION_NAME --cloud-function-url-mask=CLOUD_FUNCTION_URL_MASK | --cloud-run-service=CLOUD_RUN_SERVICE --cloud-run-tag=CLOUD_RUN_TAG --cloud-run-url-mask=CLOUD_RUN_URL_MASK | --[no-]app-engine-app --app-engine-service=APP_ENGINE_SERVICE --app-engine-url-mask=APP_ENGINE_URL_MASK --app-engine-version=APP_ENGINE_VERSION] [--global | --region=REGION | --zone=ZONE] [GCLOUD_WIDE_FLAG …]
gcloud compute network-endpoint-groups create my-neg --zone=us-central1-a --network=my-network --subnet=my-subnetworkNAME--default-port=DEFAULT_PORT
If this flag isn't specified for a NEG with endpoint type
gce-vm-ip-port, gce-vm-ip-portmap or
non-gcp-private-ip-port, then every network endpoint in the network
endpoint group must have a port specified. For a global NEG with endpoint type
internet-ip-port and internet-fqdn-port if the default
port is not specified, the well-known port for your backend protocol is used (80
for HTTP, 443 for HTTPS).
This flag is not supported for NEGs with endpoint type serverless.
private-service-connect.
--network=NETWORKGCE_VM_IP_PORT, GCE_VM_IP_PORTMAP or
NON_GCP_PRIVATE_IP_PORT, if this field is not specified, a default
network will be used. This field cannot be set for NEGs with networkEndpointType
set to SERVERLESS or PRIVATE_SERVICE_CONNECT and for
global NEGs.
For all other network endpoint types, this field is required.
This is only supported for NEGs with endpoint type gce-vm-ip-port,
non-gcp-private-ip-port, gce-vm-ip,
private-service-connect, internet-ip-port,
internet-fqdn-port, or gce-vm-ip-portmap.
--network-endpoint-type=NETWORK_ENDPOINT_TYPE; default="gce-vm-ip-port"gce-vm-ip-port--default-port must be
specified or every network endpoint in the network endpoint group must have a
port specified.
internet-ip-portinternet-fqdn-portgcloud compute
network-endpoint-groups update command with the
--add-endpoint flag. Example:
--add-endpoint="fqdn=backend.example.com,port=443"
non-gcp-private-ip-port--default-port must be specified
or every network endpoint in the network endpoint group must have a port
specified.
serverlessprivate-service-connectgce-vm-ipgce-vm-ip-portmap--default-port must be specified or every network
endpoint in the network endpoint group must have a port specified.
NETWORK_ENDPOINT_TYPE must be one of:
gce-vm-ip-port, internet-ip-port,
internet-fqdn-port, non-gcp-private-ip-port,
serverless, gce-vm-ip,
private-service-connect, gce-vm-ip-portmap.
--producer-port=PRODUCER_PORTprivate-service-connect, the PSC NEG will connect to
port 443 or the first available port in the PSC producer port range, or to port
1 if the PSC producer's forwarding rule ports flag is set to all-ports.
This flag is not supported for NEGs with endpoint type other than
private-service-connect.
--psc-target-service=PSC_TARGET_SERVICE--subnet=SUBNETIf not specified, network endpoints may belong to any subnetwork in the region where the network endpoint group is created.
This is only supported for NEGs with endpoint typegce-vm-ip-port,
gce-vm-ip, private-service-connect, or
gce-vm-ip-portmap. For Private Service Connect NEGs, you can
optionally specify --network and --subnet if --psc-target-service points to a
published service. If --psc-target-service points to the regional service
endpoint of a Google API, do not specify --network or --subnet.
The serverless routing configurations are only valid when endpoint type of the
network endpoint group is serverless.
At most one of these can be specified:
Configuration for a Cloud Function network endpoint group. Cloud Function name
must be provided explicitly or in the URL mask.
--cloud-function-name=CLOUD_FUNCTION_NAME--cloud-function-url-mask=CLOUD_FUNCTION_URL_MASK--cloud-run-service=CLOUD_RUN_SERVICE--cloud-run-tag=CLOUD_RUN_TAG--cloud-run-url-mask=CLOUD_RUN_URL_MASKapp-engine-app flag is only used for default routing. The App
Engine app must be in the same project as the Serverless network endpoint groups
(NEG).
--[no-]app-engine-app--app-engine-app to enable
and --no-app-engine-app to disable.
--app-engine-service=APP_ENGINE_SERVICE--app-engine-url-mask=APP_ENGINE_URL_MASK--app-engine-version=APP_ENGINE_VERSION--global--region=REGION
To avoid prompting when this flag is omitted, you can set the
property:
compute/region
gcloud config set compute/region REGIONA list of regions can be fetched by running:
gcloud compute regions listTo unset the property, run:
gcloud config unset compute/regionCLOUDSDK_COMPUTE_REGION.
--zone=ZONEcompute/zone property isn't set, you might
be prompted to select a zone (interactive mode only).
To avoid prompting when this flag is omitted, you can set the
property:
compute/zone
gcloud config set compute/zone ZONEA list of zones can be fetched by running:
gcloud compute zones listTo unset the property, run:
gcloud config unset compute/zoneCLOUDSDK_COMPUTE_ZONE.
--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-endpoint-groups creategcloud beta compute network-endpoint-groups creategcloud preview compute network-endpoint-groups 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.