regionBackendServices

POST /projects/{project}/regions/{region}/backendServices

Changed on

Creates a regional BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview.

Request

  • Base URL
    https://compute.googleapis.com/compute/v1
  • URL
    https://compute.googleapis.com/compute/v1/projects/{project}/regions/{region}/backendServices
  • Auth
    • OAuth 2 and OAuth 2
      Implicit: https://accounts.google.com/o/oauth2/auth
      Scopes: https://www.googleapis.com/auth/cloud-platform
      Authorization code: https://accounts.google.com/o/oauth2/auth
      Token URL: https://accounts.google.com/o/oauth2/token scopes: https://www.googleapis.com/auth/cloud-platform
    • or OAuth 2 and OAuth 2
      Implicit: https://accounts.google.com/o/oauth2/auth
      Scopes: https://www.googleapis.com/auth/compute
      Authorization code: https://accounts.google.com/o/oauth2/auth
      Token URL: https://accounts.google.com/o/oauth2/token scopes: https://www.googleapis.com/auth/compute

Path parameters

projectstring required

Project ID for this request.

regionstring required

Name of the region scoping this request.

Query parameters

requestIdstring

An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed.

For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments.

The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

Request body

affinityCookieTtlSecinteger

Lifetime of cookies in seconds. This setting is applicable to Application Load Balancers and Traffic Director and requires GENERATED_COOKIE or HTTP_COOKIE session affinity.

If set to 0, the cookie is non-persistent and lasts only until the end of the browser session (or equivalent). The maximum allowed value is two weeks (1,209,600).

Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.

compressionMode'AUTOMATIC' | 'DISABLED'

Compress text responses using Brotli or gzip compression, based on the client's Accept-Encoding header.

creationTimestampstring

Output only. [Output Only] Creation timestamp inRFC3339 text format.

customRequestHeadersstring[]

Headers that the load balancer adds to proxied requests. See Creating custom headers.

customResponseHeadersstring[]

Headers that the load balancer adds to proxied responses. See Creating custom headers.

descriptionstring

An optional description of this resource. Provide this property when you create the resource.

edgeSecurityPolicystring

[Output Only] The resource URL for the edge security policy associated with this backend service.

enableCDNboolean

If true, enables Cloud CDN for the backend service of a global external Application Load Balancer.

externalManagedMigrationState'PREPARE' | 'TEST_ALL_TRAFFIC' | 'TEST_BY_PERCENTAGE'

Specifies the canary migration state. Possible values are PREPARE, TEST_BY_PERCENTAGE, and TEST_ALL_TRAFFIC.

To begin the migration from EXTERNAL to EXTERNAL_MANAGED, the state must be changed to PREPARE. The state must be changed to TEST_ALL_TRAFFIC before the loadBalancingScheme can be changed to EXTERNAL_MANAGED. Optionally, the TEST_BY_PERCENTAGE state can be used to migrate traffic by percentage using externalManagedMigrationTestingPercentage.

Rolling back a migration requires the states to be set in reverse order. So changing the scheme from EXTERNAL_MANAGED to EXTERNAL requires the state to be set to TEST_ALL_TRAFFIC at the same time. Optionally, the TEST_BY_PERCENTAGE state can be used to migrate some traffic back to EXTERNAL or PREPARE can be used to migrate all traffic back to EXTERNAL.

externalManagedMigrationTestingPercentagenumber float

Determines the fraction of requests that should be processed by the Global external Application Load Balancer.

The value of this field must be in the range [0, 100].

Session affinity options will slightly affect this routing behavior, for more details, see:Session Affinity.

This value can only be set if the loadBalancingScheme in the BackendService is set to EXTERNAL (when using the classic Application Load Balancer) and the migration state is TEST_BY_PERCENTAGE.

fingerprintstring byte

Fingerprint of this resource. A hash of the contents stored in this object. This field is used in optimistic locking. This field will be ignored when inserting a BackendService. An up-to-date fingerprint must be provided in order to update the BackendService, otherwise the request will fail with error 412 conditionNotMet.

To see the latest fingerprint, make a get() request to retrieve a BackendService.

healthChecksstring[]

The list of URLs to the healthChecks, httpHealthChecks (legacy), or httpsHealthChecks (legacy) resource for health checking this backend service. Not all backend services support legacy health checks. See Load balancer guide. Currently, at most one health check can be specified for each backend service. Backend services with instance group or zonal NEG backends must have a health check unless haPolicy is specified. Backend services with internet or serverless NEG backends must not have a health check.

healthChecks[] cannot be specified with haPolicy.

idstring uint64

[Output Only] The unique identifier for the resource. This identifier is defined by the server.

ipAddressSelectionPolicy'IPV4_ONLY' | 'IPV6_ONLY' | 'IP_ADDRESS_SELECTION_POLICY_UNSPECIFIED' | 'PREFER_IPV6'

Specifies a preference for traffic sent from the proxy to the backend (or from the client to the backend for proxyless gRPC). The possible values are:

  • IPV4_ONLY: Only send IPv4 traffic to the backends of the backend service (Instance Group, Managed Instance Group, Network Endpoint Group), regardless of traffic from the client to the proxy. Only IPv4 health checks are used to check the health of the backends. This is the default setting.
  • PREFER_IPV6: Prioritize the connection to the endpoint's IPv6 address over its IPv4 address (provided there is a healthy IPv6 address).
  • IPV6_ONLY: Only send IPv6 traffic to the backends of the backend service (Instance Group, Managed Instance Group, Network Endpoint Group), regardless of traffic from the client to the proxy. Only IPv6 health checks are used to check the health of the backends.

This field is applicable to either:

  • Advanced global external Application Load Balancer (load balancing scheme EXTERNAL_MANAGED),
  • Regional external Application Load Balancer,
  • Internal proxy Network Load Balancer (load balancing scheme INTERNAL_MANAGED),
  • Regional internal Application Load Balancer (load balancing scheme INTERNAL_MANAGED),
  • Traffic Director with Envoy proxies and proxyless gRPC (load balancing scheme INTERNAL_SELF_MANAGED).
kindstring

Output only. [Output Only] Type of resource. Always compute#backendService for backend services.

loadBalancingScheme'EXTERNAL' | 'EXTERNAL_MANAGED' | 'INTERNAL' | 'INTERNAL_MANAGED' | 'INTERNAL_SELF_MANAGED' | 'INVALID_LOAD_BALANCING_SCHEME'

Specifies the load balancer type. A backend service created for one type of load balancer cannot be used with another. For more information, refer to Backend services product and scheme table.

localityLbPolicy'INVALID_LB_POLICY' | 'LEAST_REQUEST' | 'MAGLEV' | 'ORIGINAL_DESTINATION' | 'RANDOM' | 'RING_HASH' | 'ROUND_ROBIN' | 'WEIGHTED_GCP_RENDEZVOUS' | 'WEIGHTED_MAGLEV' | 'WEIGHTED_ROUND_ROBIN'

The load balancing algorithm used within the scope of the locality. The possible values are:

  • ROUND_ROBIN: This is a simple policy in which each healthy backend is selected in round robin order. This is the default.
  • LEAST_REQUEST: An O(1) algorithm which selects two random healthy hosts and picks the host which has fewer active requests.
  • RING_HASH: The ring/modulo hash load balancer implements consistent hashing to backends. The algorithm has the property that the addition/removal of a host from a set of N hosts only affects 1/N of the requests.
  • RANDOM: The load balancer selects a random healthy host.
  • ORIGINAL_DESTINATION: Backend host is selected based on the client connection metadata, i.e., connections are opened to the same address as the destination address of the incoming connection before the connection was redirected to the load balancer.
  • MAGLEV: used as a drop in replacement for the ring hash load balancer. Maglev is not as stable as ring hash but has faster table lookup build times and host selection times. For more information about Maglev, see Maglev: A Fast and Reliable Software Network Load Balancer.
  • WEIGHTED_ROUND_ROBIN: Per-endpoint Weighted Round Robin Load Balancing using weights computed from Backend reported Custom Metrics. If set, the Backend Service responses are expected to contain non-standard HTTP response header field Endpoint-Load-Metrics. The reported metrics to use for computing the weights are specified via thecustomMetrics field.
  • WEIGHTED_MAGLEV: Per-endpoint weighted load balancing via health check reported weights. If set, the backend service must configure an HTTP-based Health Check, and health check replies are expected to contain the non-standard HTTP response header fieldX-Load-Balancing-Endpoint-Weight to specify the per-endpoint weights. If set, load balancing is weighted based on the per-endpoint weights reported in the last processed health check replies, as long as every instance either reported a valid weight or had UNAVAILABLE_WEIGHT. Otherwise, load balancing remains equal-weight.

This field is applicable to either:

  • A regional backend service with the service protocol set to HTTP, HTTPS, HTTP2 or H2C, and load_balancing_scheme set to INTERNAL_MANAGED.
  • A global backend service with the load_balancing_scheme set to INTERNAL_SELF_MANAGED, INTERNAL_MANAGED, or EXTERNAL_MANAGED.

If sessionAffinity is not configured—that is, if session affinity remains at the default value of NONE—then the default value for localityLbPolicy is ROUND_ROBIN. If session affinity is set to a value other than NONE, then the default value for localityLbPolicy isMAGLEV.

Only ROUND_ROBIN and RING_HASH are supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.

localityLbPolicy cannot be specified with haPolicy.

metadatasobject

Deployment metadata associated with the resource to be set by a GKE hub controller and read by the backend RCTH

namestring

Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply withRFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.

networkstring

The URL of the network to which this backend service belongs.

This field must be set for Internal Passthrough Network Load Balancers when the haPolicy is enabled, and for External Passthrough Network Load Balancers when the haPolicy fastIpMove is enabled.

This field can only be specified when the load balancing scheme is set toINTERNAL, or when the load balancing scheme is set toEXTERNAL and haPolicy fastIpMove is enabled.

portinteger

Deprecated in favor of portName. The TCP port to connect on the backend. The default value is 80. For internal passthrough Network Load Balancers and external passthrough Network Load Balancers, omit port.

portNamestring

A named port on a backend instance group representing the port for communication to the backend VMs in that group. The named port must be defined on each backend instance group. This parameter has no meaning if the backends are NEGs. For internal passthrough Network Load Balancers and external passthrough Network Load Balancers, omit port_name.

protocol'GRPC' | 'H2C' | 'HTTP' | 'HTTP2' | 'HTTPS' | 'SSL' | 'TCP' | 'UDP' | 'UNSPECIFIED'

The protocol this BackendService uses to communicate with backends.

Possible values are HTTP, HTTPS, HTTP2, H2C, TCP, SSL, UDP, GRPC, or UNSPECIFIED, depending on the chosen load balancer or Traffic Director configuration. Refer to Load balancing features for more information.

Must be set to GRPC when the backend service is referenced by a URL map that is bound to target gRPC proxy.

regionstring

Output only. [Output Only] URL of the region where the regional backend service resides. This field is not applicable to global backend services. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.

securityPolicystring

[Output Only] The resource URL for the security policy associated with this backend service.

selfLinkstring

[Output Only] Server-defined URL for the resource.

serviceBindingsstring[]

URLs of networkservices.ServiceBinding resources.

Can only be set if load balancing scheme is INTERNAL_SELF_MANAGED. If set, lists of backends and health checks must be both empty.

serviceLbPolicystring

URL to networkservices.ServiceLbPolicy resource.

Can only be set if load balancing scheme is EXTERNAL_MANAGED, INTERNAL_MANAGED or INTERNAL_SELF_MANAGED for a global backend service, and EXTERNAL_MANAGED or INTERNAL_MANAGED for a regional backend service. For a global backend service, the service lb policy must be global. For a regional backend service, the service lb policy must be regional and in the same region.

sessionAffinity'CLIENT_IP' | 'CLIENT_IP_NO_DESTINATION' | 'CLIENT_IP_PORT_PROTO' | 'CLIENT_IP_PROTO' | 'GENERATED_COOKIE' | 'HEADER_FIELD' | 'HTTP_COOKIE' | 'NONE' | 'STRONG_COOKIE_AFFINITY'

Type of session affinity to use. The default is NONE.

Only NONE and HEADER_FIELD are supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true.

For more details, see: Session Affinity.

sessionAffinity cannot be specified with haPolicy.

timeoutSecinteger

The backend service timeout has a different meaning depending on the type of load balancer. For more information see, Backend service settings. The default is 30 seconds. The full range of timeout values allowed goes from 1 through 2,147,483,647 seconds.

This value can be overridden in the PathMatcher configuration of the UrlMap that references this backend service.

Not supported when the backend service is referenced by a URL map that is bound to target gRPC proxy that has validateForProxyless field set to true. Instead, use maxStreamDuration.

Response

Successful response

clientOperationIdstring

[Output Only] The value of requestId if you provided it in the request. Not present otherwise.

creationTimestampstring

[Deprecated] This field is deprecated.

descriptionstring

[Output Only] A textual description of the operation, which is set when the operation is created.

endTimestring

[Output Only] The time that this operation was completed. This value is inRFC3339 text format.

httpErrorMessagestring

[Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND.

httpErrorStatusCodeinteger

[Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found.

idstring uint64

[Output Only] The unique identifier for the operation. This identifier is defined by the server.

insertTimestring

[Output Only] The time that this operation was requested. This value is inRFC3339 text format.

kindstring

Output only. [Output Only] Type of the resource. Always compute#operation for Operation resources.

namestring

[Output Only] Name of the operation.

operationGroupIdstring

Output only. [Output Only] An ID that represents a group of operations, such as when a group of operations results from a bulkInsert API request.

operationTypestring

[Output Only] The type of operation, such as insert, update, or delete, and so on.

progressinteger

[Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses.

regionstring

[Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations.

selfLinkstring

[Output Only] Server-defined URL for the resource.

startTimestring

[Output Only] The time that this operation was started by the server. This value is inRFC3339 text format.

status'DONE' | 'PENDING' | 'RUNNING'

[Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE.

statusMessagestring

[Output Only] An optional textual description of the current status of the operation.

targetIdstring uint64

[Output Only] The unique target ID, which identifies a specific incarnation of the target resource.

targetLinkstring

[Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the disk that the snapshot was created from.

userstring

[Output Only] User who requested the operation, for example: user@example.com or alice_smith_identifier (global/workforcePools/example-com-us-employees).

zonestring

[Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations.

Changes

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/compute was removed from the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/compute was removed from the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/cloud-platform was added to the endpoint's security scheme Oauth2c

    • info

      the security scope https://www.googleapis.com/auth/compute was removed from the endpoint's security scheme Oauth2

    • info

      the security scope https://www.googleapis.com/auth/compute was removed from the endpoint's security scheme Oauth2c