Manual scaling for worker pools

Preview — Cloud Run manual scaling

This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.

This page shows you how to manually scale your worker pool.

Overview

Manual scaling lets you set a specific instancecountwithout requiring redeployment.This gives you the option to write your ownscaling logic using an external system. See theKafka Autoscalerfor an example of this.

Billing considerations when using manual scaling

When you use manual scaling, all the instances that you requested arebilled asactive instances, even if they happen to be idle.For complete billing details, see thepricing page.

Required roles

To get the permissions that you need to deploy Cloud Run worker pools, ask your administrator to grant you the following IAM roles:

For a list of IAM roles and permissions that are associated withCloud Run, seeCloud Run IAM rolesandCloud Run IAM permissions.If your Cloud Run worker pool interfaces withGoogle Cloud APIs, such as Cloud Client Libraries, see theservice identity configuration guide.For more information about granting roles, seedeployment permissionsandmanage access.

Configure scaling

Changing scaling mode or changing the manual instance countdoes not create a new revision.

To configure the scaling mode, use the Google Cloud console, the Google Cloud CLI,YAML, Terraform, or REST API:

Console

  1. In the Google Cloud console, go to Cloud Run:

    Go to Cloud Run

  2. If you are configuring a new worker pool, selectWorker pools from the menu, andclickDeploy container. If you areconfiguring an existing worker pool, click the worker pool to display itsdetail pane, then click the pen icon next toScaling at the top rightof the detail panel.

  3. Locate theScaling form (for a new worker pool) or theEdit scaling form for an existing worker pool.

    image

  4. In the field labelledNumber of instances, specify the number of container instances for the service.

  5. Finish the specification.

  6. ClickCreate for a new worker pool orSave for an existing worker pool.

gcloud

To specify scaling for a new worker pool, use thedeploycommand:

gcloudbetarunworker-poolsdeployWORKER_POOL\--instances=INSTANCE_COUNT\--imageIMAGE_URL

Replace the following:

  • WORKER_POOL: the name of your worker pool.
  • INSTANCE_COUNT: the number of instances for the worker pool.This sets the worker pool to manual scaling. Specify a value of0 to disablethe worker pool.
  • IMAGE_URL: a reference to the container image thatcontains the worker pool, such asus-docker.pkg.dev/cloudrun/container/worker-pool:latest.

Specify scaling for an existing worker pool by using the followingupdate command:

gcloudbetarunworker-poolsupdateWORKER_POOL\--instances=INSTANCE_COUNT

YAML

  1. If you are creating a new worker pool, skip this step.If you are updating an existing worker pool, download itsYAML configuration:

    gcloudbetarunworker-poolsdescribeWORKER_POOL--formatexport>workerpool.yaml
  2. The following example contains the YAML configuration:

    apiVersion:run.googleapis.com/v1kind:WorkerPoolmetadata:name:WORKER_POOLannotations:run.googleapis.com/launch-stage:BETArun.googleapis.com/manualInstanceCount:`INSTANCE_COUNT`

    Replace the following:

    • WORKER_POOL: the name of your Cloud Run worker pool.
    • INSTANCE_COUNT: the number of instances you are manuallyscaling for the worker pool. Specify a value of0 to disable theworker pool.
  3. Create or update the worker pool using the following command:

    gcloudbetarunworker-poolsreplaceworkerpool.yaml

Terraform

To learn how to apply or remove a Terraform configuration, seeBasic Terraform commands.

resource"google_cloud_run_v2_worker_pool""default"{name="WORKER_POOL"location="REGION"launch_stage="BETA"template{containers{image="IMAGE_URL"}}scaling{scaling_mode="MANUAL"manual_instance_count="INSTANCE_COUNT"}}

Replace the following:

  • WORKER_POOL: the name of the worker pool.
  • REGION: the Google Cloud region—for example,europe-west1.
  • IMAGE_URL: a reference to the container image thatcontains the worker pool, such asus-docker.pkg.dev/cloudrun/container/worker-pool:latest.
  • INSTANCE_COUNT: the number of instances for the worker pool.This sets the worker pool to manual scaling. Specify a value of0 todisable the worker pool.

REST API

To update the number of instances for a given worker pool, send aPATCHHTTP request to the Cloud Run Admin APIworkerPools endpoint.

For example, usingcurl:

curl-H"Content-Type: application/json"\-H"Authorization: BearerACCESS_TOKEN"\-XPATCH\-d'{"scaling":{"manualInstanceCount":INSTANCE_COUNT }}'\https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/workerPools/WORKER_POOL?update_mask=scaling.manualInstanceCount

Replace the following:

  • ACCESS_TOKEN: a valid access token for an account thathas theIAM permissions to update a worker pool.For example, if you are logged intogcloud, you can retrieve anaccess token usinggcloud auth print-access-token.From within a Cloud Run container instance, you can retrievean access token using thecontainer instance metadata server.
  • INSTANCE_COUNT: the number of instances for the worker pool.
  • PROJECT_ID: the Google Cloud project ID.
  • REGION: the Google Cloud region that the worker pool isdeployed in.
  • WORKER_POOL: the name of the worker pool.

View scaling configuration for a worker pool

  1. In the Google Cloud console, go to Cloud Run:

    Go to Cloud Run

  2. ClickWorker pools to display the list of deployed worker pools.

  3. Click the worker pool you want to examine to display its details pane.

  4. The current scaling setting is shown above the worker pools revision list:Scaling: Manual (Instances: ).

Note: You can also use the Google Cloud CLI commandgcloud beta run worker-pools describe to view configuration details.

Disable a worker pool

To disable a worker pool, use the following command to set scaling to zero:

gcloudbetarunworker-poolsupdateWORKER_POOL--instances=0

ReplaceWORKER_POOL with the name of your worker pool.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.