This page describes how to create and manage individually addressable, singleton Cloud Run instances. Unlike Cloud Run services that scale based on incoming traffic, an instance is a dedicated compute container that you manage manually using lifecycle transitions (create, stop, start, update, delete).
Supported regions
Cloud Run instances can be created in any of the supported regions, except for the following regions:
europe-west1us-central1us-east1
Before you begin
Set up a new project for Cloud Run, as described in the setup page.
Enable the Cloud Run Admin API:
gcloud services enable run.googleapis.comUpdate
gcloudcomponents to the latest version:gcloud components update
If you are under a domain restriction organization policy restricting unauthenticated invocations for your project, you will need to access your deployed service as described under Testing private services.
Required roles
To get the permissions that you need to configure and deploy Cloud Run instances, ask your administrator to grant you the following IAM roles:
- Cloud Run Developer (
roles/run.developer) on the Cloud Run instance - Service Account User (
roles/iam.serviceAccountUser) on the service identity
For a list of IAM roles and permissions that are associated with Cloud Run, see Cloud Run IAM roles and Cloud Run IAM permissions. If your Cloud Run instance interfaces with Google Cloud APIs, such as Cloud Client Libraries, see the service identity configuration guide. For more information about granting roles, see deployment permissions and manage access.
Create an instance
You can deploy a container image to create a new instance. If you don't provide a name, one is automatically generated.
gcloud
To create a new Cloud Run instance using the
gcloud beta run instances create command:
gcloud beta run instances create INSTANCE_NAME \ --image IMAGE_URL \ --region REGION
To create a new Cloud Run instance using the
gcloud beta run instances deploy command:
gcloud beta run instances deploy INSTANCE_NAME \ --image IMAGE_URL \ --region REGION
Replace the following:
INSTANCE_NAME: the name of the instance you are creating. The instance name must be unique within your project and region. You cannot create an instance with the same name as an existing Cloud Run instance or service.IMAGE_URL: a reference to the container image, for example,us-docker.pkg.dev/cloudrun/container/instances:latest.REGION: the Google Cloud region where you are running your instance, for exampleeurope-west4.
Client libraries
To create a new instance from code:
REST API
To create a new Cloud Run instance, send a POST HTTP
request to the instances endpoint.
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d '{ "containers": [{ "image": "IMAGE_URL", "ports": [{"containerPort": PORT}] }], "ingress": "INGRESS_TRAFFIC_ALL", "invokerIamDisabled": true, "timeout": "3600s" }' \ "https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances?instance_id=INSTANCE_NAME"
Replace the following:
IMAGE_URL: your container image URL.PORT: the port your container listens on.PROJECT_ID: your Google Cloud project ID.REGION: the Google Cloud region of your deployment.INSTANCE_NAME: the name of your new instance.
After you create an instance, the instance receives a Cloud Run URL that has the following format:
https://INSTANCE_NAME-PROJECT_NUMBER.REGION.run.app
Update an instance
When you update an instance, such as its container image, port, or environment variables, the instance is restarted.
gcloud
To update a Cloud Run instance using the
gcloud beta run instances update command:
gcloud beta run instances update INSTANCE_NAME \ --image NEW_IMAGE_URL \ --region REGION
To update a Cloud Run instance using the
gcloud beta run instances deploy command:
gcloud beta run instances deploy INSTANCE_NAME \ --image IMAGE_URL \ --region REGION
REST API
To update a Cloud Run instance config from the API, send a
PATCH HTTP request to the instance URI endpoint.
curl -H "Content-Type: application/json" \ -X PATCH \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -d '{template: {containers: [{image: "IMAGE_URL"}]}}' \ "https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances/INSTANCE_NAME"
Stop an instance
Use the stop command or method to stop a running Cloud Run instance.
gcloud
To stop an instance:
gcloud beta run instances stop INSTANCE_NAME \ --region REGION
Client libraries
To stop a running instance from code:
REST API
To stop an instance, send a POST HTTP request with the :stop decorator:
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances/INSTANCE_NAME:stop"
Start or restart an instance
Use the start command or method to start up a stopped instance, or force a restart on an existing instance.
gcloud
To start or restart an instance:
gcloud beta run instances start INSTANCE_NAME \ --region REGION
Client libraries
To start a stopped instance from code:
REST API
To start an instance, send a POST HTTP request with the :start decorator:
curl -X POST \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances/INSTANCE_NAME:start"
View the list of instances in your project
You can view all active and inactive instances in your project.
gcloud
To list the instances in a specific region:
gcloud beta run instances list \ --region REGION
Replace REGION with the Google Cloud region
where you are running your instance.
Client libraries
To list active and inactive instances from code:
REST API
To retrieve a list of instances, send a GET HTTP request:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances"
View instance details
Use the describe command or method to view configuration details and current status.
gcloud
To describe an instance:
gcloud beta run instances describe INSTANCE_NAME \ --region REGION
Client libraries
To view instance configuration details and status from code:
REST API
To describe an instance, send a GET HTTP request:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances/INSTANCE_NAME"
Delete an instance
Delete an instance to permanently remove its configuration, metadata, public direct URL mapping, and identity roles from your project.
gcloud
To delete an instance:
gcloud beta run instances delete INSTANCE_NAME \ --region REGION
Client libraries
To delete an instance from code:
REST API
To delete an instance, send a DELETE HTTP request:
curl -X DELETE \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://run.googleapis.com/v2/projects/PROJECT_ID/locations/REGION/instances/INSTANCE_NAME"
Image tags and digests
You can specify container images and
sandbox template
images by mutable tag (for example, IMAGE:latest) or by
immutable digest (IMAGE@sha256:DIGEST).
When Cloud Run imports an image referenced by tag, it resolves
the tag to a specific digest and records that digest in
containerStatuses[].imageDigest. This digest resolution applies to all
containers in the instance (including sidecars) and sandbox templates.
Unlike Cloud Run service revisions, which are immutable and keep the digest resolved at creation time, Cloud Run might re-resolve mutable tags when an instance restarts:
- Instance updates: Cloud Run re-resolves mutable tags when an update restarts the instance.
- Automatic restarts: Cloud Run re-resolves mutable tags on
failure restarts (
on-failureoralways) and on the approximately 7-day lifecycle restart. - Stop and start cycles: Cloud Run re-resolves mutable tags
when the instance re-imports its containers. Don't rely on
stopandstartwith a mutable tag to roll out new image versions; instead, update the instance with an explicit image digest.
To view the exact image digest running on an instance, inspect
containerStatuses[].imageDigest using the REST API tab in
View instance details (the Cloud Run Admin API v2
instances.get method).
The gcloud beta run instances describe command displays your configured image
reference rather than the resolved digest.
For consistent behavior across restarts, pin your container and sandbox template
images by digest (IMAGE@sha256:DIGEST).
What's next
- To view the logging transactions for your instances, see Logging and viewing logs in Cloud Run.
- Configure your Cloud Run instance: