
Google Cloud ComputeEngine
CertifiedEnterprise EditionRun tasks on a Google Compute Engine VM
Google Cloud ComputeEngine
Run tasks on a Google Compute Engine VM
Enterprise-only task runner that runs task scripts directly on a Compute Engine VM instance — no SSH, no IAP tunnel. The script is injected as the instance's startup-script metadata, its stdout/stderr is mirrored by the guest environment to the serial console (port 1) and streamed back from there, and completion is detected through a guest attribute (kestra/status) the script writes when it exits. This requires enable-guest-attributes (set automatically by this runner) and an instance image that provides bash, curl, and python3 — true of the default Debian/Ubuntu Compute Engine images.
You need the roles/compute.instanceAdmin.v1 role (or equivalent fine-grained permissions) to create, start, stop, delete instances, read guest attributes, and read the serial console, plus roles/iam.serviceAccountUser if the instance runs under a dedicated service account.
By default a new instance is created from instanceConfig — a raw JSON object matching the instances.insert request body (at minimum disks and networkInterfaces) — then stopped and/or deleted after the run according to stopInstance/deleteInstance. Set instanceName instead to target an already existing instance: since a metadata startup-script only runs on boot, ComputeEngine reboots (instances.reset) that instance to (re)trigger the script if it is already running — this interrupts anything else the instance was doing, so never point two concurrent Kestra executions at the same instanceName. ComputeEngine never deletes an instance it did not create, regardless of deleteInstance; use stopInstance if you also want it stopped.
Uses a GCS bucket for staging inputFiles/namespaceFiles and collecting outputFiles (required when using those features). The instance's own network must be able to reach Cloud Storage and the metadata server (an external IP, Cloud NAT, or Private Google Access all work) and its service account needs at least the https://www.googleapis.com/auth/devstorage.read_write scope for that bucket.
To access the task's working directory, use the {{workingDir}} Pebble expression or the WORKING_DIR environment variable — unlike the Batch and Cloud Run runners, commands here already execute from that directory. Output files can be created with the same name as listed in outputFiles anywhere in that directory, or under {{outputDir}} (OUTPUT_DIR) for automatic capture.
If the Kestra Worker running this task is terminated, the instance keeps running until completion; when resume is true (default) the Worker reattaches to it after restarting instead of creating a duplicate.
type: io.kestra.plugin.ee.gcp.runner.ComputeEngineExamples
Create a Compute Engine VM, run a Shell command, then delete the VM.
id: compute_engine_shell
namespace: company.team
variables:
projectId: "my-project"
zone: "europe-west1-b"
tasks:
- id: shell
type: io.kestra.plugin.scripts.shell.Commands
taskRunner:
type: io.kestra.plugin.ee.gcp.runner.ComputeEngine
projectId: "{{ vars.projectId }}"
zone: "{{ vars.zone }}"
serviceAccount: "{{ secret('GOOGLE_SA') }}"
instanceConfig:
disks:
- boot: true
initializeParams:
sourceImage: "projects/debian-cloud/global/images/family/debian-12"
networkInterfaces:
- network: "projects/{{ vars.projectId }}/global/networks/default"
accessConfigs:
- type: "ONE_TO_ONE_NAT"
commands:
- echo "Hello World"Pass input files to an existing named instance, execute a Shell command, then retrieve output files.
id: compute_engine_existing_instance
namespace: company.team
inputs:
- id: file
type: FILE
variables:
projectId: "my-project"
zone: "europe-west1-b"
bucket: "my-bucket"
tasks:
- id: shell
type: io.kestra.plugin.scripts.shell.Commands
inputFiles:
data.txt: "{{ inputs.file }}"
outputFiles:
- out.txt
taskRunner:
type: io.kestra.plugin.ee.gcp.runner.ComputeEngine
projectId: "{{ vars.projectId }}"
zone: "{{ vars.zone }}"
bucket: "{{ vars.bucket }}"
instanceName: "my-persistent-vm"
stopInstance: false
deleteInstance: false
serviceAccount: "{{ secret('GOOGLE_SA') }}"
commands:
- cp {{ workingDir }}/data.txt {{ workingDir }}/out.txtProperties
zone *Requiredstring
GCP zone
Zone the Compute Engine instance runs in, for example europe-west1-b.
bucket string
Staging GCS bucket
Bucket used to upload input/namespace files and retrieve outputs; required when using file transfer or {{outputDir}}.
completionCheckInterval string
PT5SCompletion poll interval
How often to check the completion guest attribute and the serial console for new log lines; defaults to PT5S. Setting this property to a lower value will reduce the number of API calls Kestra makes to the remote service — keep that in mind in case you see API rate limit errors.
deleteInstance booleanstring
trueDelete the instance after completion
Defaults to true; set false to inspect or resume but stale instances may be reused. Never deletes an instance targeted through instanceName — ComputeEngine never deletes an instance it did not create — but it still controls whether that run's staged GCS blob prefix is cleaned up, regardless of instance ownership.
impersonatedServiceAccount string
The GCP service account to impersonate
Service account email to impersonate for API calls.
For Cloud Run runner, this value applies to API calls used to create and run the job (--impersonate-service-account equivalent).
It does not set the job execution identity (--service-account).
instanceConfig object
New instance configuration
Raw JSON object used to create a new instance, in the same shape as the instances.insert request body — at minimum disks (with initializeParams.sourceImage) and networkInterfaces. Required unless instanceName is set. Any name field is ignored: ComputeEngine always generates the instance name from the flow/task/execution. The instance's network must be able to reach Cloud Storage and the metadata server (an external IP, Cloud NAT, or Private Google Access all work).
instanceName string
Existing instance name
Name of an already existing instance to run the task on, instead of creating a new one. Since a metadata startup-script only runs on boot, ComputeEngine reboots (instances.reset) the instance to (re)trigger it if it is already running when the task starts — this is destructive to anything else the instance is doing. Never target the same instanceName from two concurrent Kestra executions: the second run's reboot kills the first run's in-flight script. When set, instanceConfig is ignored. deleteInstance never deletes an instance targeted through instanceName — ComputeEngine never deletes an instance it did not create — but it still controls whether that run's staged GCS blob prefix is cleaned up, regardless of instance ownership.
machineType string
e2-mediumCompute machine type
VM type for a newly created instance; defaults to e2-medium. Always overrides any machineType set inside instanceConfig. Only applies when creating a new instance. See https://cloud.google.com/compute/docs/machine-types
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task runner.
projectId string
The GCP project ID
resume booleanstring
trueResume an existing instance
If true (default) and instanceName is not set, reattach to a matching Kestra-created instance instead of creating a new one — used when the Worker restarts mid-run.
scopes array
["https://www.googleapis.com/auth/cloud-platform"]The GCP scopes to be used
serviceAccount string
The GCP service account key
Service account JSON key used to authenticate API calls.
For Cloud Run runner job execution identity, this value is used as a fallback for --service-account
when runtimeServiceAccount is not provided.
stopInstance booleanstring
trueStop the instance after completion
Defaults to true. Ignored if deleteInstance is also true (deleting supersedes stopping), and never applies to an instance targeted through instanceName.
syncWorkingDirectory booleanstring
falseWhether to synchronize working directory from remote runner back to local one after run.
version Non-dynamicstring
Plugin Version
Defines the version of the plugin to use.
The version must follow the Semantic Versioning (SemVer) specification:
- A single-digit MAJOR version (e.g.,
1). - A MAJOR.MINOR version (e.g.,
1.1). - A MAJOR.MINOR.PATCH version, optionally with any qualifier
(e.g.,
1.1.2,1.1.0-SNAPSHOT).
waitForLogInterval string
PT5SPost-completion log wait
Quiet period after the task ends: Kestra keeps polling the serial console for new log lines until none have arrived for this long, then finalizes logs and outputs; defaults to PT5S.
waitUntilCompletion string
PT1HCompletion timeout
Maximum wall-clock duration to wait for the task script to complete before timing out; defaults to PT1H. Task timeout takes precedence.