gcloud compute backend-services add-backend <BACKEND_SERVICE_NAME>

Add a backend to a backend service

Arguments

NameDescription
BACKEND_SERVICE_NAMEName of the backend service to operate on

Options

NameDescription
--account <ACCOUNT>Google Cloud Platform user account to use for invocation. Overrides the default *core/account* property value for this command invocation
--balancing-mode <BALANCING_MODE>Defines how to measure whether a backend can handle additional traffic or is fully loaded. For more information, see https://cloud.google.com/load-balancing/docs/backend-service#balancing-mode. + This cannot be used when the endpoint type of an attached network endpoint group is INTERNET_IP_PORT, INTERNET_FQDN_PORT, or SERVERLESS. + _BALANCING_MODE_ must be one of: + *CONNECTION*::: Available if the backend service's load balancing scheme is either `INTERNAL` or `EXTERNAL`. Available if the backend service's protocol is one of `SSL`, `TCP`, or `UDP`. + Spreads load based on how many concurrent connections the backend can handle. + For backend services with --load-balancing-scheme `EXTERNAL`, you must specify exactly one of these additional parameters: `--max-connections`, `--max-connections-per-instance`, or `--max-connections-per-endpoint`. + For backend services where `--load-balancing-scheme` is `INTERNAL`, you must omit all of these parameters. + *RATE*::: Available if the backend service's load balancing scheme is `INTERNAL_MANAGED`, `INTERNAL_SELF_MANAGED`, or `EXTERNAL`. Available if the backend service's protocol is one of HTTP, HTTPS, or HTTP/2. + Spreads load based on how many HTTP requests per second (RPS) the backend can handle. + You must specify exactly one of these additional parameters: `--max-rate`, `--max-rate-per-instance`, or `--max-rate-per-endpoint`. + *UTILIZATION*::: Available if the backend service's load balancing scheme is `INTERNAL_MANAGED`, `INTERNAL_SELF_MANAGED`, or `EXTERNAL`. Available only for managed or unmanaged instance group backends. + Spreads load based on the backend utilization of instances in a backend instance group. + The following additional parameters may be specified: `--max-utilization`, `--max-rate`, `--max-rate-per-instance`, `--max-connections`, `--max-connections-per-instance`. For valid combinations, see `--max-utilization`. + ::: +
--billing-project <BILLING_PROJECT>The Google Cloud Platform project that will be charged quota for operations performed in gcloud. If you need to operate on one project, but need quota against a different project, you can use this flag to specify the billing project. If both `billing/quota_project` and `--billing-project` are specified, `--billing-project` takes precedence. Run `$ gcloud config set --help` to see more information about `billing/quota_project`
--capacity-scaler <CAPACITY_SCALER>A setting that applies to all balancing modes. This value is multiplied by the balancing mode value to set the current max usage of the instance group. You can set the capacity scaler to `0.0` or from `0.1` (10%) to `1.0` (100%). You cannot configure a setting that is larger than `0.0` and smaller than `0.1`. A scale factor of zero (`0.0`) prevents all new connections. You cannot configure a setting of `0.0` when there is only one backend attached to the backend service. Note that draining a backend service only prevents new connections to instances in the group. All existing connections are allowed to continue until they close by normal means. This cannot be used for internal load balancing. + This cannot be used when the endpoint type of an attached network endpoint group is INTERNET_IP_PORT, INTERNET_FQDN_PORT, or SERVERLESS
--configuration <CONFIGURATION>The configuration to use for this command invocation. For more information on how to use configurations, run: `gcloud topic configurations`. You can also use the CLOUDSDK_ACTIVE_CONFIG_NAME environment variable to set the equivalent of this flag for a terminal session
--description <DESCRIPTION>An optional, textual description for the backend
--failoverDesignates whether this is a failover backend. More than one failover backend can be configured for a given BackendService. Not compatible with the --global flag
--flags-file <YAML_FILE>A YAML or JSON file that specifies a *--flag*:*value* dictionary. Useful for specifying complex flag values with special characters that work with any command interpreter. Additionally, each *--flags-file* arg is replaced by its constituent flags. See $ gcloud topic flags-file for more information
--flatten <KEY>Flatten _name_[] output resource slices in _KEY_ into separate records for each item in each slice. Multiple keys and slices may be specified. This also flattens keys for *--format* and *--filter*. For example, *--flatten=abc.def* flattens *abc.def[].ghi* references to *abc.def.ghi*. A resource record containing *abc.def[]* with N elements will expand to N records in the flattened output. This flag interacts with other flags that are applied in this order: *--flatten*, *--sort-by*, *--filter*, *--limit*
--format <FORMAT>Set the format for printing command output resources. The default is a command-specific human-friendly output format. The supported formats are: `config`, `csv`, `default`, `diff`, `disable`, `flattened`, `get`, `json`, `list`, `multi`, `none`, `object`, `table`, `text`, `value`, `yaml`. For more details run $ gcloud topic formats
--globalIf set, the backend service is global
--global-network-endpoint-groupIf set, the network endpoint group is global
--helpDisplay detailed help
--impersonate-service-account <SERVICE_ACCOUNT_EMAIL>For this gcloud invocation, all API requests will be made as the given service account instead of the currently selected account. This is done without needing to create, download, and activate a key for the account. In order to perform operations as the service account, your currently selected account must have an IAM role that includes the iam.serviceAccounts.getAccessToken permission for the service account. The roles/iam.serviceAccountTokenCreator role has this permission or you may create a custom role. Overrides the default *auth/impersonate_service_account* property value for this command invocation
--instance-group <INSTANCE_GROUP>Name of the instance group to add to the backend service. For details on valid instance names, refer to the criteria documented under the field 'name' at: https://cloud.google.com/compute/docs/reference/rest/v1/instances
--instance-group-region <INSTANCE_GROUP_REGION>Region of the instance group to add to the backend service. If not specified, you may be prompted to select a region. + To avoid prompting when this flag is omitted, you can set the ``compute/region'' property: + $ gcloud config set compute/region REGION + A list of regions can be fetched by running: + $ gcloud compute regions list + To unset the property, run: + $ gcloud config unset compute/region + Alternatively, the region can be stored in the environment variable ``CLOUDSDK_COMPUTE_REGION''
--instance-group-zone <INSTANCE_GROUP_ZONE>Zone of the instance group to add to the backend service. If not specified and the ``compute/zone'' property isn't set, you may be prompted to select a zone. + To avoid prompting when this flag is omitted, you can set the ``compute/zone'' property: + $ gcloud config set compute/zone ZONE + A list of zones can be fetched by running: + $ gcloud compute zones list + To unset the property, run: + $ gcloud config unset compute/zone + Alternatively, the zone can be stored in the environment variable ``CLOUDSDK_COMPUTE_ZONE''
--log-httpLog all HTTP server requests and responses to stderr. Overrides the default *core/log_http* property value for this command invocation
--max-connections <MAX_CONNECTIONS>Maximum concurrent connections that the backend can handle. Valid for network endpoint group and instance group backends (except for regional managed instance groups). + This cannot be used when the endpoint type of an attached network endpoint group is INTERNET_IP_PORT, INTERNET_FQDN_PORT, or SERVERLESS
--max-connections-per-endpoint <MAX_CONNECTIONS_PER_ENDPOINT>Only valid for network endpoint group backends. Defines a maximum number of connections per endpoint if all endpoints are healthy. When one or more endpoints are unhealthy, an effective maximum number of connections per healthy endpoint is calculated by multiplying `MAX_CONNECTIONS_PER_ENDPOINT` by the number of endpoints in the network endpoint group, then dividing by the number of healthy endpoints. + This cannot be used when the endpoint type of an attached network endpoint group is INTERNET_IP_PORT, INTERNET_FQDN_PORT, or SERVERLESS
--max-connections-per-instance <MAX_CONNECTIONS_PER_INSTANCE>Only valid for instance group backends. Defines a maximum number of concurrent connections per instance if all instances in the instance group are healthy. When one or more instances are unhealthy, an effective maximum number of connections per healthy instance is calculated by multiplying `MAX_CONNECTIONS_PER_INSTANCE` by the number of instances in the instance group, then dividing by the number of healthy instances
--max-rate <MAX_RATE>Maximum number of HTTP requests per second (RPS) that the backend can handle. Valid for network endpoint group and instance group backends (except for regional managed instance groups). Must not be defined if the backend is a managed instance group using load balancing-based autoscaling. + This cannot be used when the endpoint type of an attached network endpoint group is INTERNET_IP_PORT, INTERNET_FQDN_PORT, or SERVERLESS
--max-rate-per-endpoint <MAX_RATE_PER_ENDPOINT>Only valid for network endpoint group backends. Defines a maximum number of HTTP requests per second (RPS) per endpoint if all endpoints are healthy. When one or more endpoints are unhealthy, an effective maximum rate per healthy endpoint is calculated by multiplying `MAX_RATE_PER_ENDPOINT` by the number of endpoints in the network endpoint group, then dividing by the number of healthy endpoints. + This cannot be used when the endpoint type of an attached network endpoint group is INTERNET_IP_PORT, INTERNET_FQDN_PORT, or SERVERLESS
--max-rate-per-instance <MAX_RATE_PER_INSTANCE>Only valid for instance group backends. Defines a maximum number of HTTP requests per second (RPS) per instance if all instances in the instance group are healthy. When one or more instances are unhealthy, an effective maximum RPS per healthy instance is calculated by multiplying `MAX_RATE_PER_INSTANCE` by the number of instances in the instance group, then dividing by the number of healthy instances. This parameter is compatible with managed instance group backends that use autoscaling based on load balancing
--max-utilization <MAX_UTILIZATION>Defines the maximum target for average utilization of the backend instance in the backend instance group. Acceptable values are `0.0` (0%) through `1.0`(100%). Available for all backend service protocols, with `--balancing-mode=UTILIZATION`. + For backend services that use SSL, TCP, or UDP protocols, the following configuration options are supported: + * no additional parameter * only `--max-utilization` * only `--max-connections` (except for regional managed instance groups) * only `--max-connections-per-instance` * both `--max-utilization` and `--max-connections` (except for regional managed instance groups) * both `--max-utilization` and `--max-connections-per-instance` + The meanings for `-max-connections` and `--max-connections-per-instance` are the same as for --balancing-mode=CONNECTION. If one is used with `--max-utilization`, instances are considered at capacity when either maximum utilization or maximum connections is reached. + For backend services that use HTTP, HTTPS, or HTTP/2 protocols, the following configuration options are supported: + * no additional parameter * only `--max-utilization` * only `--max-rate` (except for regional managed instance groups) * only `--max-rate-per-instance` * both `--max-utilization` and `--max-rate` (except for regional managed instance groups) * both `--max-utilization` and `--max-rate-per-instance` + The meanings for `--max-rate` and `--max-rate-per-instance` are the same as for --balancing-mode=RATE. If one is used in conjunction with `--max-utilization`, instances are considered at capacity when *either* maximum utilization or the maximum rate is reached
--network-endpoint-group <NETWORK_ENDPOINT_GROUP>Name of the network endpoint group to add to the backend service
--network-endpoint-group-region <NETWORK_ENDPOINT_GROUP_REGION>Region of the network endpoint group to add to the backend service. If not specified, you may be prompted to select a region. + To avoid prompting when this flag is omitted, you can set the ``compute/region'' property: + $ gcloud config set compute/region REGION + A list of regions can be fetched by running: + $ gcloud compute regions list + To unset the property, run: + $ gcloud config unset compute/region + Alternatively, the region can be stored in the environment variable ``CLOUDSDK_COMPUTE_REGION''
--network-endpoint-group-zone <NETWORK_ENDPOINT_GROUP_ZONE>Zone of the network endpoint group to add to the backend service. If not specified and the ``compute/zone'' property isn't set, you may be prompted to select a zone. + To avoid prompting when this flag is omitted, you can set the ``compute/zone'' property: + $ gcloud config set compute/zone ZONE + A list of zones can be fetched by running: + $ gcloud compute zones list + To unset the property, run: + $ gcloud config unset compute/zone + Alternatively, the zone can be stored in the environment variable ``CLOUDSDK_COMPUTE_ZONE''
--project <PROJECT_ID>The Google Cloud Platform project ID to use for this invocation. If omitted, then the current project is assumed; the current project can be listed using `gcloud config list --format='text(core.project)'` and can be set using `gcloud config set project PROJECTID`. + `--project` and its fallback `core/project` property play two roles in the invocation. It specifies the project of the resource to operate on. It also specifies the project for API enablement check, quota, and billing. To specify a different project for quota and billing, use `--billing-project` or `billing/quota_project` property
--quietDisable all interactive prompts when running gcloud commands. If input is required, defaults will be used, or an error will be raised. Overrides the default core/disable_prompts property value for this command invocation. This is equivalent to setting the environment variable `CLOUDSDK_CORE_DISABLE_PROMPTS` to 1
--region <REGION>Region of the backend service to operate on. Overrides the default *compute/region* property value for this command invocation
--trace-token <TRACE_TOKEN>Token used to route traces of service requests for investigation of issues. Overrides the default *core/trace_token* property value for this command invocation
--user-output-enabledPrint user intended output to the console. Overrides the default *core/user_output_enabled* property value for this command invocation. Use *--no-user-output-enabled* to disable
--verbosity <VERBOSITY>Override the default verbosity for this command. Overrides the default *core/verbosity* property value for this command invocation. _VERBOSITY_ must be one of: *debug*, *info*, *warning*, *error*, *critical*, *none*