lb.services.update

Change a service’s health check or sticky sessions

PATCH /lb/api/load-balancers/{id}/services/{serviceId}IAM lb:UpdateServiceChanges stateDestructive

Only the fields sent change; the rules across fields are checked against the service as it then is. healthCheckTimeout may not exceed healthCheckInterval, an interval under 3 s is refused on lb11/lb21/lb31, and sticky sessions are refused (400) on a tcp service. The change reaches the load balancer within seconds; an https service still waiting for its certificate gets it when the certificate is served.

Request syntax

PATCH /lb/api/load-balancers/{id}/services/{serviceId}
{
  "healthCheckProtocol": "enum",
  "healthCheckPath": "string",
  "healthCheckInterval": "number",
  "healthCheckTimeout": "number",
  "healthCheckRetries": "number",
  "stickySessions": "boolean",
  "stickyCookieName": "string",
  "stickyCookieLifetime": "number"
}

Path parameters

  • idRequired

    string

    Constraints: uuid

  • serviceIdRequired

    string

    Constraints: uuid

Request body

  • healthCheckProtocolOptional

    enum

    http (default): GET the health-check path, 2xx/3xx is healthy. tcp: a connection is enough

    One of: http, tcp

  • healthCheckPathOptional

    string

    HTTP path probed for health when healthCheckProtocol is http: starts with /, at most 256 characters (default /)

    Constraints: 1-256 chars, /^\//

  • healthCheckIntervalOptional

    number

    Seconds between health checks (default 15): 3–60 on lb11/lb21/lb31 (400 below 3), 1–60 on application and dedicated load balancers

    Constraints: integer, 1-60

  • healthCheckTimeoutOptional

    number

    Seconds a health check may take, 1–60 and at most the interval (400 above it; default 10)

    Constraints: integer, 1-60

  • healthCheckRetriesOptional

    number

    Failed checks in a row before a target stops taking traffic (0–5, default 3). A dead target keeps traffic for about interval × (retries + 1)

    Constraints: integer, 0-5

  • stickySessionsOptional

    boolean

    http/https: pin each client to one target with a cookie the load balancer sets (default false; refused with 400 on a tcp service)

  • stickyCookieNameOptional

    string

    Name of the sticky-session cookie (default EWSLB)

    Constraints: /^[A-Za-z0-9_-]{1,64}$/

  • stickyCookieLifetimeOptional

    number

    Seconds the sticky-session cookie lasts (60 s – 7 days, default 300)

    Constraints: integer, 60-604800

Response

200 with the service as now set (every field `services add` returns). 400 with no field sent, or when the result breaks a rule across fields; 404 when the service is not on this load balancer. A load balancer another service owns (a Kubernetes Service, a database endpoint) is refused with 409: change it through its owner.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow lb:UpdateService on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud lb services update id serviceId

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_lb_services_update.