I plan to setup an environment on Google Compute Engine using Managed Instance Groups. I will be running Linux on the VMs.

I am new to Google cloud and am unable to find a method to keep all copies of web servers in sync on GCE. When we update a PHP code file on one server we would like it to be instantly replicated on the second web server and so on. There are hundreds of such files in different directories that keep getting updated from time to time.

Does GCE have any option for that? I can't seem to find it at all. On our current environment(non Google) we use rsync for this.


One way you could do this is to create a shell script that would

  1. Create a custom image
  2. Create a new instance template from the image
  3. And then deploy that instance template as a rolling update

A good practice in this case would also be to create a custom image family and create those images in the family with naming conventions such that they define what version of the image it is. Further, you could also create an image deprecation policy to avoid incurring storage charges.

Another way could be to use a tool like Ansible

And like always, rsync is still an option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.