Skip to main content

machine_images

Creates, updates, deletes, gets or lists a machine_images resource.

Overview

Namemachine_images
TypeResource
Idgoogle.compute.machine_images

Fields

NameDatatypeDescription
idstring[Output Only] A unique identifier for this machine image. The server defines this identifier.
namestringName of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression [a-z]([-a-z0-9]*[a-z0-9])? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
descriptionstringAn optional description of this resource. Provide this property when you create the resource.
creationTimestampstring[Output Only] The creation timestamp for this machine image in RFC3339 text format.
guestFlushboolean[Input Only] Whether to attempt an application consistent machine image by informing the OS to prepare for the snapshot process.
instancePropertiesobject
kindstring[Output Only] The resource type, which is always compute#machineImage for machine image.
machineImageEncryptionKeyobject
satisfiesPzibooleanOutput only. Reserved for future use.
satisfiesPzsboolean[Output Only] Reserved for future use.
savedDisksarrayAn array of Machine Image specific properties for disks attached to the source instance
selfLinkstring[Output Only] The URL for this machine image. The server defines this URL.
sourceDiskEncryptionKeysarray[Input Only] The customer-supplied encryption key of the disks attached to the source instance. Required if the source disk is protected by a customer-supplied encryption key.
sourceInstancestringThe source instance used to create the machine image. You can provide this as a partial or full URL to the resource. For example, the following are valid values: - https://www.googleapis.com/compute/v1/projects/project/zones/zone /instances/instance - projects/project/zones/zone/instances/instance
sourceInstancePropertiesobjectDEPRECATED: Please use compute#instanceProperties instead. New properties will not be added to this field.
statusstring[Output Only] The status of the machine image. One of the following values: INVALID, CREATING, READY, DELETING, and UPLOADING.
storageLocationsarrayThe regional or multi-regional Cloud Storage bucket location where the machine image is stored.
totalStorageBytesstring[Output Only] Total size of the storage used by the machine image.

Methods

NameAccessible byRequired ParamsDescription
getSELECTmachineImage, projectReturns the specified machine image.
listSELECTprojectRetrieves a list of machine images that are contained within the specified project.
insertINSERTprojectCreates a machine image in the specified project using the data that is included in the request. If you are creating a new machine image to update an existing instance, your new machine image should use the same network or, if applicable, the same subnetwork as the original instance.
deleteDELETEmachineImage, projectDeletes the specified machine image. Deleting a machine image is permanent and cannot be undone.

SELECT examples

Retrieves a list of machine images that are contained within the specified project.

SELECT
id,
name,
description,
creationTimestamp,
guestFlush,
instanceProperties,
kind,
machineImageEncryptionKey,
satisfiesPzi,
satisfiesPzs,
savedDisks,
selfLink,
sourceDiskEncryptionKeys,
sourceInstance,
sourceInstanceProperties,
status,
storageLocations,
totalStorageBytes
FROM google.compute.machine_images
WHERE project = '{{ project }}';

INSERT example

Use the following StackQL query and manifest file to create a new machine_images resource.

/*+ create */
INSERT INTO google.compute.machine_images (
project,
name,
description,
sourceInstance,
status,
sourceInstanceProperties,
instanceProperties,
savedDisks,
storageLocations,
machineImageEncryptionKey,
guestFlush,
sourceDiskEncryptionKeys,
totalStorageBytes,
satisfiesPzs
)
SELECT
'{{ project }}',
'{{ name }}',
'{{ description }}',
'{{ sourceInstance }}',
'{{ status }}',
'{{ sourceInstanceProperties }}',
'{{ instanceProperties }}',
'{{ savedDisks }}',
'{{ storageLocations }}',
'{{ machineImageEncryptionKey }}',
{{ guestFlush }},
'{{ sourceDiskEncryptionKeys }}',
'{{ totalStorageBytes }}',
{{ satisfiesPzs }}
;

DELETE example

Deletes the specified machine_images resource.

/*+ delete */
DELETE FROM google.compute.machine_images
WHERE machineImage = '{{ machineImage }}'
AND project = '{{ project }}';