From a01dec90fea55c43e19e3a0e2662ae3cca57b264 Mon Sep 17 00:00:00 2001 From: James Blair Date: Wed, 13 Jan 2021 14:57:48 +1300 Subject: [PATCH] Ensure compute engine apis enabled and zone declared. --- 3-create-virtual-machine.sh | 5 ++++- README.org | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/3-create-virtual-machine.sh b/3-create-virtual-machine.sh index 925a080..d3430e3 100755 --- a/3-create-virtual-machine.sh +++ b/3-create-virtual-machine.sh @@ -7,8 +7,11 @@ # Tangle the shell block below to a shell script by pressing *, b t* in emacs command mode: +# Ensure compute engine apis are enabled in the project +gcloud services enable compute.googleapis.com + # Create name for virtual machine based on date export gcp_machine_name="gitlab-gcp-"$(date +"%Y-%m-%d") # Create the new machine -gcloud compute instances create $gcp_machine_name +gcloud compute instances create $gcp_machine_name --zone australia-southeast1-a diff --git a/README.org b/README.org index 6384dec..2b4b75f 100644 --- a/README.org +++ b/README.org @@ -70,14 +70,17 @@ gcloud config set project $gcp_project_id #+end_src -Once we have a project we can create a new virtual machine. +Once we have a project we can create a new virtual machine. To create a virtual machine we need to ensure compute engine apis are enabled. Tangle the shell block below to a shell script by pressing *, b t* in emacs command mode: #+begin_src bash :shebang #!/bin/bash :tangle 3-create-virtual-machine.sh +# Ensure compute engine apis are enabled in the project +gcloud services enable compute.googleapis.com + # Create name for virtual machine based on date export gcp_machine_name="gitlab-gcp-"$(date +"%Y-%m-%d") # Create the new machine -gcloud compute instances create $gcp_machine_name +gcloud compute instances create $gcp_machine_name --zone australia-southeast1-a #+end_src