'Managing multiple google cloud VM instances / compute engines at the same time

I have created a few servers on google cloud. I made them in VM instances. They run the same script everyday but each server runs with different arguments.

However, when changes need to be made to them or updates, I have to do them one by one, all the changes are the same, only different arguments. Meaning I would ssh into the server, run apt updates, download some files, upload some files, change some arguments and test. Then I repeat this process on all the servers.

I would like to be able to keep one copy of the server somewhere which would upload to the rest, or make changes that would apply automatically to each server.

Is there some way I can achieve this? Update all the servers (apt update, or download new files or make changes to scripts) all at once?



Solution 1:[1]

I would suggest creating a managed instance group that uses an instance template to create the VMs. Then, you can roll out updates to MIGs.

Solution 2:[2]

You can provide a startup script stored on Cloud Storage and apply it to the running instances.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 marian.vladoi
Solution 2 Smart Manoj