This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "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", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gcloud logging write batch-execution "Hello world from $(hostname)." | |
| gcp_zone=$(curl -H Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/zone -s | cut -d/ -f4) | |
| gcloud compute instances delete $(hostname) --zone ${gcp_zone} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Buffer = require('safe-buffer').Buffer; | |
| const Compute = require('@google-cloud/compute'); | |
| const compute = new Compute(); | |
| // Change this const value to your project | |
| const projectId = 'your-project'; | |
| const zone = 'us-central1-a'; | |
| const vmConfig = { | |
| kind: 'compute#instance', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "cloud-functions-create-batch-workload-vm", | |
| "version": "0.0.1", | |
| "private": true, | |
| "license": "Apache-2.0", | |
| "author": "Marcelo Costa", | |
| "main": "index.js", | |
| "engines": { | |
| "node": ">=8.13.0" | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "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", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If you receive any error while running the commands bellow, create the Service Account using the Cloud Console UI. | |
| # The Roles and Permissions are the same in the UI. | |
| # Change the PROJECT_ID value to your project | |
| PROJECT_ID=your-project-id | |
| SERVICE_ACCOUNT_NAME=compute-execute-batch-job | |
| # Create the service account | |
| gcloud beta iam service-accounts create ${SERVICE_ACCOUNT_NAME} \ | |
| --description "SA that will be used by the Compute Engine VM" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/functions/billing/main.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| with open('data.json', 'w') as outfile: | |
| json.dump(obj, outfile) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Beginning Entrypoint script execution." | |
| output=$(behave ./features --tags=-wip) | |
| status=$? | |
| echo "Behave finished executing." | |
| # Change this to your project |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Buffer = require('safe-buffer').Buffer; | |
| const Compute = require('@google-cloud/compute'); | |
| const compute = new Compute(); | |
| // Change this const value to your project | |
| const projectId = 'my-project'; | |
| const zone = 'us-central1-a'; | |
| const vmConfig = { | |
| kind: 'compute#instance', |