SUPPORT


Auto starting VMs in other project




This section describes how to use Money Saver VM to autostart preemptible vms from other projects.



  1. Make sure Money-Saver VM is deployed and up and running in the project as per GCP Getting Started Guide .
  2. money-saver-vm-provisioned-home-project

  3. Provision preemptible vms in other projects.
  4. To start preemptible vms from other projects,edit the money-saver vm's metadata as below:
  • Goto Money-Saver vm project, edit Money-Saver vm and add below meta data to Money-Saver VM

    key=project1

    value=project-id of VM created in step 2

    Note : Make sure you add the project-id and not project name in the value above

    Save the changes.

    If there are more than one other project to auto-start Preemptible VMs, repeat step 2 for each of the other projects, update key value to project2, project3 and so on
  • /img/gcp/money-saver-vm/money-saver-metadata.png

    1. In order for Money-Saver VM to auto-start VMs from other project, the other project needs to authorize Money-Saver VM to control VMs within that project. This is done by adding Money-Saver VM's service key to the other project as shown below.
  • Getting Money-Saver VM's service key:
  • Login to Money-Saver VM and run the command"gcloud auth list" and copy the service key as shown below

    /img/gcp/money-saver-vm/money-saver-service-key.png

  • Updating other project with Money-Saver service key:
    1. Now go to the other project, open IAM console (by typinng IAM in the search box)
    2. /img/gcp/money-saver-vm/IAM-console-01.png


    3. Click on Add
    4. /img/gcp/money-saver-vm/IAM-console.png


    5. paste the Money-Saver service key into "New Member" box
    6. /img/gcp/money-saver-vm/money-saver-IAM-role.png


    7. Select "Compute Admin" from "Role" drop down
    8. /img/gcp/money-saver-vm/money-saver-IAM-role-01.png


    9. Click "Save" to save changes
    10. if you have more external project to auto-start pre-emptible vms, repeat above steps (a-e) for each of those projects to add Money-Saver VM's service key.

    1. Now preemptible vms from other projects will autostart with the Money Saver VM
    2. You can monitor Money-Saver VM log available at /var/log/money-saver-vm.log for restart activities
    3. /img/gcp/money-saver-vm/log-file.png


    4. Just like for the home project, to skip any preemptible vm from auto start from other project, set a key autostart with a value no in that respective vms metadata.
    5. /img/gcp/money-saver-vm/money-saver-autostart-no.png