Skip to content

Instantly share code, notes, and snippets.

@mesmacosta
Created August 10, 2019 17:10
Show Gist options
  • Select an option

  • Save mesmacosta/181dd477f60ba3aa7aadcf7b8152ec43 to your computer and use it in GitHub Desktop.

Select an option

Save mesmacosta/181dd477f60ba3aa7aadcf7b8152ec43 to your computer and use it in GitHub Desktop.
{
"kind": "compute#instance",
"name": "instance-1",
"zone": "projects/your-project/zones/us-central1-a",
"machineType": "projects/your-project/zones/us-central1-a/machineTypes/f1-micro",
"displayDevice": {
"enableDisplay": false
},
"metadata": {
"kind": "compute#metadata",
"items": [
{
"key": "startup-script",
"value": "gcloud logging write batch-execution \"Hello world from $(hostname).\"\ngcp_zone=$(curl -H Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/zone -s | cut -d/ -f4)\ngcloud compute instances delete $(hostname) --zone ${gcp_zone}"
}
]
},
"tags": {
"items": []
},
"disks": [
{
"kind": "compute#attachedDisk",
"type": "PERSISTENT",
"boot": true,
"mode": "READ_WRITE",
"autoDelete": true,
"deviceName": "instance-1",
"initializeParams": {
"sourceImage": "projects/debian-cloud/global/images/debian-9-stretch-v20190729",
"diskType": "projects/your-project/zones/us-central1-a/diskTypes/pd-standard",
"diskSizeGb": "10"
},
"diskEncryptionKey": {}
}
],
"canIpForward": false,
"networkInterfaces": [
{
"kind": "compute#networkInterface",
"subnetwork": "projects/your-project/regions/us-central1/subnetworks/default",
"accessConfigs": [
{
"kind": "compute#accessConfig",
"name": "External NAT",
"type": "ONE_TO_ONE_NAT",
"networkTier": "PREMIUM"
}
],
"aliasIpRanges": []
}
],
"description": "",
"labels": {},
"scheduling": {
"preemptible": false,
"onHostMaintenance": "MIGRATE",
"automaticRestart": true,
"nodeAffinities": []
},
"deletionProtection": false,
"reservationAffinity": {
"consumeReservationType": "ANY_RESERVATION"
},
"serviceAccounts": [
{
"email": "compute-execute-batch-job@your-project.iam.gserviceaccount.com",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment