gcloud compute machine-images import IMAGE --cmd-deprecated --source-uri=SOURCE_URI [--no-address] [--async] [--byol] [--can-ip-forward] [--cloudbuild-service-account=CLOUDBUILD_SERVICE_ACCOUNT] [--compute-service-account=COMPUTE_SERVICE_ACCOUNT] [--description=DESCRIPTION] [--no-guest-environment] [--guest-flush] [--guest-os-features=[GUEST_OS_FEATURE,…]] [--labels=[KEY=VALUE,…]] [--log-location=LOG_LOCATION] [--machine-type=MACHINE_TYPE] [--network=NETWORK] [--network-tier=NETWORK_TIER] [--os=OS] [--no-restart-on-failure] [--storage-location=LOCATION] [--subnet=SUBNET] [--tags=TAG,[TAG,…]] [--timeout=TIMEOUT; default="2h"] [--zone=ZONE] [--custom-cpu=CUSTOM_CPU --custom-memory=CUSTOM_MEMORY : --custom-extensions --custom-vm-type=CUSTOM_VM_TYPE] [--scopes=[SCOPE,…] | --no-scopes] [--service-account=SERVICE_ACCOUNT | --no-service-account] [GCLOUD_WIDE_FLAG …]
(DEPRECATED) This command is being deprecated. Instead, use the
gcloud
migration vms machine-image-imports command. For more information,
See "gcloud alpha migration vms machine-image-imports --help".
gcloud compute machine-images import creates Compute Engine machine
image from virtual appliance in OVA/OVF format.
Importing OVF involves:
my-machine-image, run:
gcloud compute machine-images import my-machine-image --source-uri=gs://my-bucket/my-dirIMAGE--cmd-deprecatedgcloud compute
migration image-imports instead. See our official documentation for
more information. https://cloud.google.com/migrate/virtual-machines/docs/5.0/migrate/image_import.
--source-uri=SOURCE_URI--no-address--async--byol
--byol can be specified in any of the following ways:
+ `--byol --os=rhel-8`: imports a RHEL 8 image with an existing license. + `--os=rhel-8-byol`: imports a RHEL 8 image with an existing license. + `--byol`: detects the OS contained on the disk, and imports the image with an existing license.
--can-ip-forward--cloudbuild-service-account=CLOUDBUILD_SERVICE_ACCOUNT
Use this flag to to specify a user-managed service account for image import and
export. If you don't specify this flag, Cloud Build runs using your project's
default Cloud Build service account. To set this option, specify the email
address of the desired user-managed service account. Note: You must specify the
--logs-location flag when you set a user-managed service account.
--compute-service-account=COMPUTE_SERVICE_ACCOUNTA 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 machine image import tooling on the instance.
To set this option, specify the email address corresponding to the required Compute Engine service account. If not provided, the machine image import on the temporary instance uses the project's default Compute Engine service account.
At a minimum, you need to grant the following roles to the specified Cloud Build service account:--description=DESCRIPTION--guest-environment--no-guest-environment to disable.
--guest-flush--guest-os-features=[GUEST_OS_FEATURE,…]GUEST_OS_FEATURE must be (only one value is supported):
UEFI_COMPATIBLE.
--labels=[KEY=VALUE,…]-), underscores (_), lowercase characters, and
numbers. Values must contain only hyphens (-), underscores
(_), lowercase characters, and numbers.
--log-location=LOG_LOCATIONgs://<project num>.cloudbuild-logs.googleusercontent.com/ is
created and used.
--machine-type=MACHINE_TYPE--network=NETWORK--subnet is also specified, then the subnet must be a
subnetwork of network specified by --network. If neither is
specified, the default network is used.
--network-tier=NETWORK_TIERNETWORK_TIER must be one of:
PREMIUM, STANDARD. The default value is
PREMIUM.
--os=OSOS
must be one of: centos-7, centos-stream-8,
centos-stream-9, debian-10, debian-11,
debian-8, debian-9, opensuse-15,
rhel-6, rhel-6-byol, rhel-7,
rhel-7-byol, rhel-8, rhel-8-byol,
rhel-9, rhel-9-byol, rocky-8,
rocky-9, sles-12, sles-12-byol,
sles-15, sles-15-byol, sles-sap-12,
sles-sap-12-byol, sles-sap-15,
sles-sap-15-byol, ubuntu-1404,
ubuntu-1604, ubuntu-1804, ubuntu-2004,
ubuntu-2204, windows-10-x64-byol,
windows-10-x86-byol, windows-11-x64-byol,
windows-2008r2, windows-2008r2-byol,
windows-2012, windows-2012-byol,
windows-2012r2, windows-2012r2-byol,
windows-2016, windows-2016-byol,
windows-2019, windows-2019-byol,
windows-2022, windows-2022-byol,
windows-7-x64-byol, windows-7-x86-byol,
windows-8-x64-byol, windows-8-x86-byol.
--restart-on-failure--no-restart-on-failure to disable.
--storage-location=LOCATION--subnet=SUBNET--network is also specified, the subnet must be a subnetwork of the
network specified by --network.
--tags=TAG,[TAG,…]gcloud compute
firewall-rules create(1) for more details.
To read more about configuring network tags, read this guide: https://cloud.google.com/vpc/docs/add-remove-network-tags
To list VMs with their respective status and tags, run:
gcloud compute instances list --format='table(name,status,tags.list())'
To list VMs tagged with a specific tag, tag1, run:
gcloud compute instances list --filter='tags:tag1'--timeout=TIMEOUT; default="2h"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.
--zone=ZONEcompute/zone property isn't set, you might
be prompted to select a zone (interactive mode only).
To avoid prompting when this flag is omitted, you can set the
property:
compute/zone
gcloud config set compute/zone ZONEA list of zones can be fetched by running:
gcloud compute zones listTo unset the property, run:
gcloud config unset compute/zoneCLOUDSDK_COMPUTE_ZONE.
Custom machine type extensions.
--custom-cpu=CUSTOM_CPU
For some machine types, shared-core values can also be used. For example, for E2
machine types, you can specify micro, small, or
medium.
--custom-memory=CUSTOM_MEMORY--custom-extensions--custom-vm-type=CUSTOM_VM_TYPEn1. For more
information about custom machine types, see: https://cloud.google.com/compute/docs/general-purpose-machines#custom_machine_types
--scopes=[SCOPE,…]--scopes nor
--no-scopes are specified and the project has no default service
account, then the machine image is imported with no scopes. Note that the level
of access that a service account has is determined by a combination of access
scopes and IAM roles so you must configure both access scopes and IAM roles for
the service account to work properly.
SCOPE can be either the full URI of the scope or an alias. Default
scopes are assigned to all instances. Available aliases are:
DEPRECATION WARNING: https://www.googleapis.com/auth/sqlservice account scope and
Alias URI bigquery https://www.googleapis.com/auth/bigquery cloud-platform https://www.googleapis.com/auth/cloud-platform cloud-source-repos https://www.googleapis.com/auth/source.full_control cloud-source-repos-ro https://www.googleapis.com/auth/source.read_only compute-ro https://www.googleapis.com/auth/compute.readonly compute-rw https://www.googleapis.com/auth/compute datastore https://www.googleapis.com/auth/datastore default https://www.googleapis.com/auth/devstorage.read_only https://www.googleapis.com/auth/logging.write https://www.googleapis.com/auth/monitoring.write https://www.googleapis.com/auth/pubsub https://www.googleapis.com/auth/service.management.readonly https://www.googleapis.com/auth/servicecontrol https://www.googleapis.com/auth/trace.append gke-default https://www.googleapis.com/auth/devstorage.read_only https://www.googleapis.com/auth/logging.write https://www.googleapis.com/auth/monitoring https://www.googleapis.com/auth/service.management.readonly https://www.googleapis.com/auth/servicecontrol https://www.googleapis.com/auth/trace.append logging-write https://www.googleapis.com/auth/logging.write monitoring https://www.googleapis.com/auth/monitoring monitoring-read https://www.googleapis.com/auth/monitoring.read monitoring-write https://www.googleapis.com/auth/monitoring.write pubsub https://www.googleapis.com/auth/pubsub service-control https://www.googleapis.com/auth/servicecontrol service-management https://www.googleapis.com/auth/service.management.readonly sql (deprecated) https://www.googleapis.com/auth/sqlservice sql-admin https://www.googleapis.com/auth/sqlservice.admin storage-full https://www.googleapis.com/auth/devstorage.full_control storage-ro https://www.googleapis.com/auth/devstorage.read_only storage-rw https://www.googleapis.com/auth/devstorage.read_write taskqueue https://www.googleapis.com/auth/taskqueue trace https://www.googleapis.com/auth/trace.append userinfo-email https://www.googleapis.com/auth/userinfo.email
sql alias do not provide SQL instance management
capabilities and have been deprecated. Please, use https://www.googleapis.com/auth/sqlservice.admin
or sql-admin to manage your Google SQL Service instances.
--no-scopes--service-account=SERVICE_ACCOUNT--no-service-account--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.
gcloud alpha compute machine-images importgcloud beta compute machine-images importgcloud preview compute machine-images import
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.