The code the code bellow someone shared it here (Starting a Google Compute instance with Python), I made some adaptations and it works perfectly for me to start one single vm. I'm wondering if It is possible to adapt this code to start multiples instances in the same function? here is the code:
from googleapiclient import discovery
service = discovery.build('compute', 'v1')
def autostart_vm(request):
# Project ID for this request.
project = 'secret-metrics-278618'
# The name of the zone for this request.
zone = 'us-central1-a'
# Name of the instance resource to start.
instance = 'devops1'
instance2 = 'devops-2'
request = service.instances().start(project=project, zone=zone, instance=instance)
response = request.execute()
print('VM Instance started')
requestas an argument on your function for this to work.