Ensure compute engine apis enabled and zone declared.

This commit is contained in:
2021-01-13 14:57:48 +13:00
parent 029a535f52
commit a01dec90fe
2 changed files with 9 additions and 3 deletions

View File

@ -7,8 +7,11 @@
# Tangle the shell block below to a shell script by pressing *, b t* in emacs command mode: # 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 # Create name for virtual machine based on date
export gcp_machine_name="gitlab-gcp-"$(date +"%Y-%m-%d") export gcp_machine_name="gitlab-gcp-"$(date +"%Y-%m-%d")
# Create the new machine # Create the new machine
gcloud compute instances create $gcp_machine_name gcloud compute instances create $gcp_machine_name --zone australia-southeast1-a

View File

@ -70,14 +70,17 @@ gcloud config set project $gcp_project_id
#+end_src #+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: 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 #+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 # Create name for virtual machine based on date
export gcp_machine_name="gitlab-gcp-"$(date +"%Y-%m-%d") export gcp_machine_name="gitlab-gcp-"$(date +"%Y-%m-%d")
# Create the new machine # Create the new machine
gcloud compute instances create $gcp_machine_name gcloud compute instances create $gcp_machine_name --zone australia-southeast1-a
#+end_src #+end_src