1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-08 10:35:03 +00:00
gcloud-help/gcloud/compute/images/export
2022-06-02 08:41:25 +00:00

146 lines
6.1 KiB
Text

NAME
gcloud compute images export - export a Compute Engine image
SYNOPSIS
gcloud compute images export --destination-uri=DESTINATION_URI
(--image=IMAGE | --image-family=IMAGE_FAMILY) [--async]
[--compute-service-account=COMPUTE_SERVICE_ACCOUNT]
[--export-format=EXPORT_FORMAT] [--image-project=IMAGE_PROJECT]
[--log-location=LOG_LOCATION] [--network=NETWORK] [--subnet=SUBNET]
[--timeout=TIMEOUT; default="2h"] [--zone=ZONE] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
gcloud compute images export exports virtual disk images from Compute
Engine.
By default, images are exported in the Compute Engine format, which is a
disk.raw file that is tarred and gzipped.
The --export-format flag exports the image to a format supported by QEMU
using qemu-img. Valid formats include vmdk, vhdx, vpc, vdi, and qcow2.
Before exporting an image, set up access to Cloud Storage and grant
required roles to the user accounts and service accounts. For more
information, see
https://cloud.google.com/compute/docs/import/requirements-export-import-images.
EXAMPLES
To export a VMDK file my-image from a project my-project to a Cloud Storage
bucket my-bucket, run:
$ gcloud compute images export --image=my-image \
--destination-uri=gs://my-bucket/my-image.vmdk \
--export-format=vmdk --project=my-project
REQUIRED FLAGS
--destination-uri=DESTINATION_URI
The Cloud Storage URI destination for the exported virtual disk file.
Exactly one of these must be specified:
--image=IMAGE
The name of the disk image to export.
--image-family=IMAGE_FAMILY
The family of the disk image to be exported. When a family is used
instead of an image, the latest non-deprecated image associated with
that family is used.
OPTIONAL FLAGS
--async
Return immediately, without waiting for the operation in progress to
complete.
--compute-service-account=COMPUTE_SERVICE_ACCOUNT
A temporary virtual machine instance is created in your project during
image export. Image export tooling on this temporary instance must be
authenticated.
A Compute Engine service account is an identity attached to an
instance. Its access tokens can be accessed through the instance
metadata server and can be used to authenticate image export tooling on
the instance.
To set this option, specify the email address corresponding to the
required Compute Engine service account. If not provided, the image
export on the temporary instance uses the project's default Compute
Engine service account.
At minimum, the specified Compute Engine service account needs to have
the following roles assigned:
◆ roles/compute.storageAdmin
◆ roles/storage.objectAdmin
--export-format=EXPORT_FORMAT
Specify the format to export to, such as vmdk, vhdx, vpc, or qcow2.
--image-project=IMAGE_PROJECT
The Google Cloud project against which all image and image family
references will be resolved. It is best practice to define
image-project. A full list of available projects can be generated by
running gcloud projects list.
◆ If specifying one of our public images, image-project must be
provided.
◆ If there are several of the same image-family value in multiple
projects, image-project must be specified to clarify the image to be
used.
◆ If not specified and either image or image-family is provided, the
current default project is used.
--log-location=LOG_LOCATION
Directory in Cloud Storage to hold build logs. If not set,
gs://<project num>.cloudbuild-logs.googleusercontent.com/ is created
and used.
--network=NETWORK
The name of the network in your project to use for the image export.
When you export an image, the export tool creates and uses temporary
VMs in your project for the export process. Use this flag to specify
the network to use for these temporary VMs.
--subnet=SUBNET
Name of the subnetwork in your project to use for the image export.
When you export an image, the export tool creates and uses temporary
VMs in your project for the export process. Use this flag to specify
the subnetwork to use for these temporary VMs.
◆ If the network resource is in legacy mode, do not provide this
property.
◆ If the network is in auto subnet mode, specifying the subnetwork is
optional.
◆ If the network is in custom subnet mode, then this field must be
specified.
--timeout=TIMEOUT; default="2h"
Maximum time an export can last before it fails as "TIMEOUT". For
example, if you specify 2h, the process fails after 2 hours. See $
gcloud topic datetimes for information about duration formats.
This timeout option has a maximum value of 24 hours.
If you are exporting a large image that takes longer than 24 hours to
export, either use the RAW disk format to reduce the time needed for
converting the image, or split the data into several smaller images.
--zone=ZONE
The zone to use when exporting the image. When you export an image, the
export tool creates and uses temporary VMs in your project for the
export process. Use this flag to specify the zone to use for these
temporary VMs. Overrides the default compute/zone property value for
this command invocation.
GCLOUD WIDE FLAGS
These flags are available to all commands: --access-token-file, --account,
--billing-project, --configuration, --flags-file, --flatten, --format,
--help, --impersonate-service-account, --log-http, --project, --quiet,
--trace-token, --user-output-enabled, --verbosity.
Run $ gcloud help for details.
NOTES
These variants are also available:
$ gcloud alpha compute images export
$ gcloud beta compute images export