
Google Cloud Create
CertifiedCreate a Compute Engine instance
Google Cloud Create
Create a Compute Engine instance
Creates a new virtual machine instance on Google Compute Engine, with an optional startup script, network tags, and custom metadata. By default, an ephemeral external IP is attached to the instance's default network interface.
type: io.kestra.plugin.gcp.compute.CreateExamples
Create a VM instance and then stop it.
id: compute_engine_create
namespace: company.team
tasks:
- id: create_instance
type: io.kestra.plugin.gcp.compute.Create
serviceAccount: "{{ secret('GCP_SERVICE_ACCOUNT_KEY') }}"
projectId: "{{ secret('GCP_PROJECT_ID') }}"
zone: "us-central1-a"
instanceName: "kestra-job-{{ execution.id }}"
machineType: "n1-standard-2"
sourceImage: "projects/debian-cloud/global/images/family/debian-11"
startupScript: "apt-get update && apt-get install -y python3"
waitUntilRunning: "true"
- id: stop_instance
type: io.kestra.plugin.gcp.compute.Stop
serviceAccount: "{{ secret('GCP_SERVICE_ACCOUNT_KEY') }}"
projectId: "{{ secret('GCP_PROJECT_ID') }}"
zone: "us-central1-a"
instanceName: "{{ outputs.create_instance.instanceName }}"
Properties
instanceName *Requiredstring
The name of the Compute Engine instance
machineType *Requiredstring
The machine type to use for the instance
e.g. n1-standard-1.
sourceImage *Requiredstring
The boot disk source image
e.g. projects/debian-cloud/global/images/family/debian-11.
zone *Requiredstring
The zone where the instance is located
e.g. us-central1-a.
diskSizeGb integerstring
The boot disk size, in GB
Must be at least 10GB, the minimum GCP allows for most public images.
diskType string
The boot disk type
e.g. pd-standard, pd-ssd.
impersonatedServiceAccount string
The GCP service account to impersonate
metadata object
Custom metadata key-value pairs to attach to the instance
networkName string
The network to attach the instance to
e.g. global/networks/my-network. When neither networkName nor subnetworkName is set, the project's default network is used. On projects that use a custom subnet-mode network, leave this unset and set subnetworkName instead so the network is inferred from the subnetwork.
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
preemptible booleanstring
falseWhether the instance is preemptible
Default: false.
projectId string
The GCP project ID
scopes array
["https://www.googleapis.com/auth/cloud-platform"]The GCP scopes to be used
serviceAccount string
The GCP service account
startupScript string
A startup script to run when the instance boots
Stored as the startup-script instance metadata entry.
subnetworkName string
The subnetwork to attach the instance to
e.g. regions/us-central1/subnetworks/my-subnetwork. Required on projects whose network is in custom subnet mode.
timeout string
PT10MThe maximum duration to wait for the operation to complete
Default: PT10M. Hitting this timeout fails the task but does not cancel the in-flight GCP operation.
waitUntilRunning booleanstring
trueWhether to wait for the instance to reach the RUNNING state before completing the task
Default: true.
Outputs
externalIp string
The instance's external (public) IP address, if any
Typically null once an instance is stopped, since ephemeral external IPs are released on stop.
instanceId string
The unique GCP instance ID
instanceName string
The name of the instance
internalIp string
The instance's internal (private) IP address
status string
The instance status after the operation
e.g. PROVISIONING, STAGING, RUNNING, STOPPING, TERMINATED.