I'm trying to create a disk from a snapshot using google cloud python API:
def createDisk(compute, project, zone):
config = {
'name': disk_name
}
return compute.disks().insert(
project=project,
zone=zone,
sourceSnapshot='global/snapshots/' + snap_name,
body=config).execute()
But it throws:
TypeError: Got an unexpected keyword argument "sourceSnapshot"
According to the docs it should be possible:
Creates a persistent disk in the specified project using the data in the request. You can create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.
I need it to automate an image creation which I want to base on the 'dummy' instance. The image should then be used to create a disk which in turn will be used in the instance template for the auto scaling.
Any tips on that one? Is it possible? If no, the sourceSnapshot reference be in the docs is really misleading?
Thank you in advance.
sourceImage. - BarmarsourceImageparameter for both, and it figures out whether it's an image or a snapshot automatically. - Barmar"Invalid value for field 'resource.sourceImage': ''. Must be a URL to a valid image resource."- Michał Lisowski