Mapsy
Mapsy

Reputation: 4272

Is it possible to dynamically allocate a Google Compute Engine Instance?

I'm working on an application where I don't know beforehand how many instances of a Google Compute Engine I need, but theoretically the number of machines provisioned will have to scale in proportion to the size of my userbase.

So, my question is, is there an existing API for dynamically allocating and deallocating server instances on the fly? If so, is there scope for cloning an existing instance as a means to guarantee the availabilty of runtime dependencies, and is it possible to compute the cost of doing so in the Billing API?

If this isn't possible, are there any recommended design patterns for informing a server-delegation process of a newly available worker instance that can be deployed to?

Upvotes: 1

Views: 461

Answers (1)

Amir Rahwane
Amir Rahwane

Reputation: 674

Since your planning to use Compute Engine I think you can achieve this with Googles Load Balancer and a managed instance group as described here.

Not all apps are the same, So my way of going about it in short:

  1. Create all shared resources (Session storage, database,nfs etc) externally. (you can use CloudSql for example or just install on a diffrent server)
  2. Create an instance which is ephemeral and can connect to those services. ( for me it is a web server with Apache running php code shared on nfs )
  3. Create an image from this instance
  4. Create a managed instance group using the image we created
  5. Create a load balancer and choose the group I created as a backend service.

Hope this helps.

Upvotes: 2

Related Questions