relentless-coder
relentless-coder

Reputation: 1546

Google Cloud Compute API: Create a vm with a larger disk size

I am using nodejs client library, and I am stuck in a situation. I need to create disposable VM on demand, which means those instances would be up for a couple of days and then would be deleted. All of this would happen via an API.

The default size of the disk while creating a VM is 10GB, and I need a larger disk than that.

Is it possible to do that, without creating a disk first and then attaching it to my VM? As that would be a hassle since I'd have to make sure that I'd delete the disk too, whenever I'd delete the instance.

Upvotes: 1

Views: 207

Answers (1)

Maxim
Maxim

Reputation: 4441

You can use the compute.instances.insert API method to create a Compute Engine instance, and set its disks[].initializeParams.diskSizeGb parameter specifying the desired disk size. You can find more information regarding this API call here.

Upvotes: 3

Related Questions