Skip to main content

instances

Creates, updates, deletes, gets or lists an instances resource.

Overview

Nameinstances
TypeResource
Idgoogle.run.instances

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe fully qualified name of this Instance. In CreateInstanceRequest, this field is ignored, and instead composed from CreateInstanceRequest.parent and CreateInstanceRequest.instance_id.
annotationsobject
binaryAuthorizationobjectSettings for the Binary Authorization feature. (id: GoogleCloudRunV2BinaryAuthorization)
clientstringArbitrary identifier for the API client.
clientVersionstringArbitrary version identifier for the API client.
conditionsarrayOutput only. The Conditions of all other associated sub-resources. They contain additional diagnostics information in case the Instance does not reach its Serving state. See comments in reconciling for additional information on reconciliation process in Cloud Run.
containerStatusesarrayOutput only. Status information for each of the specified containers. The status includes the resolved digest for specified images.
containersarrayRequired. Holds the single container that defines the unit of execution for this Instance.
createTimestring (google-datetime)Output only. The creation time.
creatorstringOutput only. Email address of the authenticated creator.
defaultUriDisabledbooleanOptional. Disables public resolution of the default URI of this Instance.
deleteTimestring (google-datetime)Output only. The deletion time.
descriptionstringUser-provided description of the Instance. This field currently has a 512-character limit.
encryptionKeystringA reference to a customer managed encryption key (CMEK) to use to encrypt this container image. For more information, go to https://cloud.google.com/run/docs/securing/using-cmek
encryptionKeyRevocationActionstringThe action to take if the encryption key is revoked. (ENCRYPTION_KEY_REVOCATION_ACTION_UNSPECIFIED, PREVENT_NEW, SHUTDOWN)
encryptionKeyShutdownDurationstring (google-duration)If encryption_key_revocation_action is SHUTDOWN, the duration before shutting down all instances. The minimum increment is 1 hour.
etagstringOptional. A system-generated fingerprint for this version of the resource. May be used to detect modification conflict during updates.
expireTimestring (google-datetime)Output only. For a deleted resource, the time after which it will be permamently deleted.
generationstring (int64)Output only. A number that monotonically increases every time the user modifies the desired state. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a string instead of an integer.
gpuZonalRedundancyDisabledbooleanOptional. True if GPU zonal redundancy is disabled on this instance.
iapEnabledbooleanOptional. IAP settings on the Instance.
ingressstringOptional. Provides the ingress settings for this Instance. On output, returns the currently observed ingress settings, or INGRESS_TRAFFIC_UNSPECIFIED if no revision is active. (INGRESS_TRAFFIC_UNSPECIFIED, INGRESS_TRAFFIC_ALL, INGRESS_TRAFFIC_INTERNAL_ONLY, INGRESS_TRAFFIC_INTERNAL_LOAD_BALANCER, INGRESS_TRAFFIC_NONE)
invokerIamDisabledbooleanOptional. Disables IAM permission check for run.routes.invoke for callers of this Instance. For more information, visit https://cloud.google.com/run/docs/securing/managing-access#invoker_check.
labelsobject
lastModifierstringOutput only. Email address of the last authenticated modifier.
launchStagestringThe launch stage as defined by Google Cloud Platform Launch Stages. Cloud Run supports ALPHA, BETA, and GA. If no value is specified, GA is assumed. Set the launch stage to a preview stage on input to allow use of preview features in that stage. On read (or output), describes whether the resource uses preview features. For example, if ALPHA is provided as input, but only BETA and GA-level features are used, this field will be BETA on output. (LAUNCH_STAGE_UNSPECIFIED, UNIMPLEMENTED, PRELAUNCH, EARLY_ACCESS, ALPHA, BETA, GA, DEPRECATED)
logUristringOutput only. The Google Console URI to obtain logs for the Instance.
nodeSelectorobjectOptional. The node selector for the instance. (id: GoogleCloudRunV2NodeSelector)
observedGenerationstring (int64)Output only. The generation of this Instance currently serving traffic. See comments in reconciling for additional information on reconciliation process in Cloud Run. Please note that unlike v1, this is an int64 value. As with most Google APIs, its JSON representation will be a string instead of an integer.
reconcilingbooleanOutput only. Returns true if the Instance is currently being acted upon by the system to bring it into the desired state. When a new Instance is created, or an existing one is updated, Cloud Run will asynchronously perform all necessary steps to bring the Instance to the desired serving state. This process is called reconciliation. While reconciliation is in process, observed_generation will have a transient value that might mismatch the intended state. Once reconciliation is over (and this field is false), there are two possible outcomes: reconciliation succeeded and the serving state matches the Instance, or there was an error, and reconciliation failed. This state can be found in terminal_condition.state.
restartPolicystringOptional. Restart policy for the Instance. (RESTART_POLICY_UNSPECIFIED, ALWAYS, ON_FAILURE, NEVER)
satisfiesPzsbooleanOutput only. Reserved for future use.
serviceAccountstring
terminalConditionobjectDefines a status condition for a resource. (id: GoogleCloudRunV2Condition)
uidstringOutput only. Server assigned unique identifier for the trigger. The value is a UUID4 string and guaranteed to remain unchanged until the resource is deleted.
updateTimestring (google-datetime)Output only. The last-modified time.
urlsarrayOutput only. All URLs serving traffic for this Instance.
volumesarrayA list of Volumes to make available to containers.
vpcAccessobjectOptional. VPC Access configuration to use for this Revision. For more information, visit https://cloud.google.com/run/docs/configuring/connecting-vpc. (id: GoogleCloudRunV2VpcAccess)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, instancesIdGets an Instance
listselectprojectsId, locationsIdpageSize, pageToken, showDeletedLists Instances. Results are sorted by creation time, descending.
createinsertprojectsId, locationsIdvalidateOnly, instanceIdCreates an Instance.
patchupdateprojectsId, locationsId, instancesIdupdateMask, validateOnly, allowMissingUpdates an Instance.
deletedeleteprojectsId, locationsId, instancesIdetag, validateOnlyDeletes an Instance
stopexecprojectsId, locationsId, instancesIdStops an Instance.
startexecprojectsId, locationsId, instancesIdStarts an Instance.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
instancesIdstring
locationsIdstring
projectsIdstring
allowMissingboolean
etagstring
instanceIdstring
pageSizeinteger (int32)
pageTokenstring
showDeletedboolean
updateMaskstring (google-fieldmask)
validateOnlyboolean

SELECT examples

Gets an Instance

SELECT
name,
annotations,
binaryAuthorization,
client,
clientVersion,
conditions,
containerStatuses,
containers,
createTime,
creator,
defaultUriDisabled,
deleteTime,
description,
encryptionKey,
encryptionKeyRevocationAction,
encryptionKeyShutdownDuration,
etag,
expireTime,
generation,
gpuZonalRedundancyDisabled,
iapEnabled,
ingress,
invokerIamDisabled,
labels,
lastModifier,
launchStage,
logUri,
nodeSelector,
observedGeneration,
reconciling,
restartPolicy,
satisfiesPzs,
serviceAccount,
terminalCondition,
uid,
updateTime,
urls,
volumes,
vpcAccess
FROM google.run.instances
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND instancesId = '{{ instancesId }}' -- required
;

INSERT examples

Creates an Instance.

INSERT INTO google.run.instances (
data__ingress,
data__clientVersion,
data__gpuZonalRedundancyDisabled,
data__labels,
data__volumes,
data__client,
data__restartPolicy,
data__encryptionKeyRevocationAction,
data__binaryAuthorization,
data__invokerIamDisabled,
data__annotations,
data__nodeSelector,
data__encryptionKey,
data__iapEnabled,
data__serviceAccount,
data__containers,
data__description,
data__launchStage,
data__etag,
data__name,
data__encryptionKeyShutdownDuration,
data__defaultUriDisabled,
data__vpcAccess,
projectsId,
locationsId,
validateOnly,
instanceId
)
SELECT
'{{ ingress }}',
'{{ clientVersion }}',
{{ gpuZonalRedundancyDisabled }},
'{{ labels }}',
'{{ volumes }}',
'{{ client }}',
'{{ restartPolicy }}',
'{{ encryptionKeyRevocationAction }}',
'{{ binaryAuthorization }}',
{{ invokerIamDisabled }},
'{{ annotations }}',
'{{ nodeSelector }}',
'{{ encryptionKey }}',
{{ iapEnabled }},
'{{ serviceAccount }}',
'{{ containers }}',
'{{ description }}',
'{{ launchStage }}',
'{{ etag }}',
'{{ name }}',
'{{ encryptionKeyShutdownDuration }}',
{{ defaultUriDisabled }},
'{{ vpcAccess }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ validateOnly }}',
'{{ instanceId }}'
RETURNING
name,
done,
error,
metadata,
response
;

UPDATE examples

Updates an Instance.

UPDATE google.run.instances
SET
data__ingress = '{{ ingress }}',
data__clientVersion = '{{ clientVersion }}',
data__gpuZonalRedundancyDisabled = {{ gpuZonalRedundancyDisabled }},
data__labels = '{{ labels }}',
data__volumes = '{{ volumes }}',
data__client = '{{ client }}',
data__restartPolicy = '{{ restartPolicy }}',
data__encryptionKeyRevocationAction = '{{ encryptionKeyRevocationAction }}',
data__binaryAuthorization = '{{ binaryAuthorization }}',
data__invokerIamDisabled = {{ invokerIamDisabled }},
data__annotations = '{{ annotations }}',
data__nodeSelector = '{{ nodeSelector }}',
data__encryptionKey = '{{ encryptionKey }}',
data__iapEnabled = {{ iapEnabled }},
data__serviceAccount = '{{ serviceAccount }}',
data__containers = '{{ containers }}',
data__description = '{{ description }}',
data__launchStage = '{{ launchStage }}',
data__etag = '{{ etag }}',
data__name = '{{ name }}',
data__encryptionKeyShutdownDuration = '{{ encryptionKeyShutdownDuration }}',
data__defaultUriDisabled = {{ defaultUriDisabled }},
data__vpcAccess = '{{ vpcAccess }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND instancesId = '{{ instancesId }}' --required
AND updateMask = '{{ updateMask}}'
AND validateOnly = {{ validateOnly}}
AND allowMissing = {{ allowMissing}}
RETURNING
name,
done,
error,
metadata,
response;

DELETE examples

Deletes an Instance

DELETE FROM google.run.instances
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND instancesId = '{{ instancesId }}' --required
AND etag = '{{ etag }}'
AND validateOnly = '{{ validateOnly }}'
;

Lifecycle Methods

Stops an Instance.

EXEC google.run.instances.stop
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@instancesId='{{ instancesId }}' --required
@@json=
'{
"validateOnly": {{ validateOnly }},
"etag": "{{ etag }}"
}'
;