- NAME
-
- gcloud network-connectivity service-connection-policies create - create a new Service Connection Policy
- SYNOPSIS
-
-
gcloud network-connectivity service-connection-policies createSERVICE_CONNECTION_POLICY--network=NETWORK--service-class=SERVICE_CLASS(--subnets=[SUBNETS,…] :--allowed-google-producers-resource-hierarchy-level=[ALLOWED_GOOGLE_PRODUCERS_RESOURCE_HIERARCHY_LEVEL,…]--producer-instance-location=PRODUCER_INSTANCE_LOCATION--psc-connection-limit=PSC_CONNECTION_LIMIT) [--async] [--description=DESCRIPTION] [--labels=[KEY=VALUE,…]] [--region=REGION] [GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
- Create a new Service Connection Policy with the given name.
- EXAMPLES
-
Create a Service Connection Policy with name
for networkmy-service-conn-policyand service classprojects/my-project/global/networks/net1in regionmy-service-class-ad32fa4busing subnet projects/my-project/regions/us-central1/subnetworks/subnet1 subject to custom-resource-hierarchy-levels that allows connections from Google-managed producer instances in projects/my-project.us-central1gcloud network-connectivity service-connection-policies create my-service-conn-policy --network="projects/my-project/global/networks/net1" --service-class=my-service-class-ad32fa4b --region=us-central1 --subnets=projects/my-project/regions/us-central1/subnetworks/subnet1 --psc-connection-limit=100 --producer-instance-location=custom-resource-hierarchy-levels --allowed-google-producers-resource-hierarchy-level=projects/my-project - POSITIONAL ARGUMENTS
-
-
Service connection policy resource - Name of the Service Connection Policy to be
created. This represents a Cloud resource. (NOTE) Some attributes are not given
arguments in this group but can be set in other ways.
To set the
projectattribute:-
provide the argument
service_connection_policyon the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
To set the
regionattribute:-
provide the argument
service_connection_policyon the command line with a fully specified name; -
provide the argument
--regionon the command line.
This must be specified.
SERVICE_CONNECTION_POLICY-
ID of the service connection policy or fully qualified identifier for the
service connection policy.
To set the
service_connection_policyattribute:-
provide the argument
service_connection_policyon the command line.
-
provide the argument
-
provide the argument
-
Service connection policy resource - Name of the Service Connection Policy to be
created. This represents a Cloud resource. (NOTE) Some attributes are not given
arguments in this group but can be set in other ways.
- REQUIRED FLAGS
-
-
Network resource - Network that this service connection policy applies to. E.g.
projects/my-project/global/networks/net1 This represents a Cloud resource.
(NOTE) Some attributes are not given arguments in this group but can be set in
other ways.
To set the
projectattribute:-
provide the argument
--networkon the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
This must be specified.
--network=NETWORK-
ID of the network or fully qualified identifier for the network.
To set the
networkattribute:-
provide the argument
--networkon the command line.
-
provide the argument
-
provide the argument
--service-class=SERVICE_CLASS- Service class that this policy is created for. E.g. my-service-class-ad32fa4b
-
This must be specified.
-
Subnetwork resource - Subnetwork to use for IP address management. This
represents a Cloud resource. (NOTE) Some attributes are not given arguments in
this group but can be set in other ways.
To set the
projectattribute:-
provide the argument
--subnetson the command line with a fully specified name; -
provide the argument
--projecton the command line; -
set the property
core/project.
To set the
regionattribute:-
provide the argument
--subnetson the command line with a fully specified name; -
provide the argument
--regionon the command line.
This must be specified.
--subnets=[SUBNETS,…]-
IDs of the subnetworks or fully qualified identifiers for the subnetworks.
To set the
subnetworkattribute:-
provide the argument
--subnetson the command line.
-
provide the argument
-
provide the argument
--allowed-google-producers-resource-hierarchy-level=[ALLOWED_GOOGLE_PRODUCERS_RESOURCE_HIERARCHY_LEVEL,…]- List of projects, folders, or orgs where the producer instance can be located in the form "projects/123456789", folders/123456789", or "organizations/123456789".
--producer-instance-location=PRODUCER_INSTANCE_LOCATION-
Option that determines where the producer instances can be located for which
connections can be created in the network controlled by this policy.
PRODUCER_INSTANCE_LOCATIONmust be one of:custom-resource-hierarchy-levels- The producer instance must be located in one of the values provided in the allowed-google-producers-resource-hierarchy-level flag.
none- The producer instance must be within the same project as this connection policy.
--psc-connection-limit=PSC_CONNECTION_LIMIT- Max number of PSC connections for this policy.
-
Subnetwork resource - Subnetwork to use for IP address management. This
represents a Cloud resource. (NOTE) Some attributes are not given arguments in
this group but can be set in other ways.
-
Network resource - Network that this service connection policy applies to. E.g.
projects/my-project/global/networks/net1 This represents a Cloud resource.
(NOTE) Some attributes are not given arguments in this group but can be set in
other ways.
- OPTIONAL FLAGS
-
--async- Return immediately, without waiting for the operation in progress to complete.
--description=DESCRIPTION- Description of the Service Connection Policy to be created.
--labels=[KEY=VALUE,…]- List of label KEY=VALUE pairs to add.
--region=REGION- For resources [service_connection_policy, subnets], provides fallback value for resource region attribute. When the resource's full URI path is not provided, region will fallback to this flag value.
- 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 helpfor details. - API REFERENCE
-
This command uses the
networkconnectivity/v1API. The full documentation for this API can be found at: https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest
gcloud network-connectivity service-connection-policies 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 2025-07-15 UTC.