1

I am running preemptable instance on Google Cloud. To keep it up, I am using instance group that spawns this instance from an instance template once it gets killed. I want to run Mongo on this instance (I understand that it is a bad idea, it is good enough for me) so I need to add a persistent disk to the instance.

When I add a disk to the instance template, the mode radio button is greyed out and set on read-only. There is a warning stating that I can change mode only when manually spawn an instance from a template. It does not help me since I need the instance group to automatically spawn the new instances with a writable disk. How can I do it?

Guillermo Cacheda
  • 2,162
  • 14
  • 23
yabloki
  • 311
  • 2
  • 13

1 Answers1

1

Instances in a Managed Instance Group should be identical since they are based off of the same template. So any additional disk attached to them can be read only. GCP persistent disk can only be attached as "read only" if this will be attached to more than one instance which is done in the cases for Managed Instance Group. Also please note that Instances in a managed instance group are considered ephemeral and you shouldn't be storing persistent data inside disks attached to an instance in a managed instance group.

In order to retain your data, I would recommend that you regularly maintain up-to-date OS images, use startup scripts, and back up your data in a centralized location, such as Google Cloud Storage, as a best practice. In your instance templates, you can specify a custom image and relevant startup scripts, so that when an instance is recreated, it has the necessary software applications installed and has access to required data. This will help you to accomplish your need. Please see this link for more information. For more recommendations around creating instance templates, read Deterministic instance templates.

John Mathew
  • 419
  • 2
  • 5
  • thank you for the answer. -"you shouldn't be storing persistent data inside disks attached to an instance in a managed instance group" AFAIU the main concern here is that instance might be killed? My use case is tolerant to significant downtime, that's why I decided to run it on a preemptable instance. I am thinking about using Google Cloud Storage Fuse to achieve this goal. Performance degradation is the main concern. Would love to use some google service as db. Datastore would work for me, but unfortunately, there is no python asyncio based client for datastore. – yabloki Oct 04 '18 at 09:34
  • Google Cloud Platform has Cloud SQL which is a fully-managed database service that makes it easy to set up, maintain, manage, and administer relational databases. You can use Cloud SQL with either MySQL or PostgreSQL. You can read more information about CloudSQL on its official [documentation](https://cloud.google.com/sql/docs/). – John Mathew Oct 04 '18 at 18:48