v1

latestOpenAPI 3.0.0Creative Commons Attribution 3.02026-07-131,0021,0174.3 MB
regionBackendServices

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

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

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

kindstring

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

enableCDNboolean

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

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 toChoosing a load balancer.

customResponseHeadersstring[]

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

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.

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.

securityPolicystring

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

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.

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.

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.

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 or GRPC. depending on the chosen load balancer or Traffic Director configuration. Refer to the documentation for the load balancers or for Traffic Director 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.

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.

customRequestHeadersstring[]

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

edgeSecurityPolicystring

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

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.

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.

metadatasobject

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

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.

descriptionstring

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

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).
serviceLbPolicystring

URL to networkservices.ServiceLbPolicy resource.

Can only be set if load balancing scheme is EXTERNAL_MANAGED, INTERNAL_MANAGED or INTERNAL_SELF_MANAGED and the scope is global.

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.

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.

compressionMode'AUTOMATIC' | 'DISABLED'

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

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.

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.

creationTimestampstring

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

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.

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.

idstring uint64

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

Response

Successful response