gcloud compute images import IMAGE_NAME --cmd-deprecated (--source-file=SOURCE_FILE | --source-image=SOURCE_IMAGE | --aws-access-key-id=AWS_ACCESS_KEY_ID --aws-region=AWS_REGION --aws-secret-access-key=AWS_SECRET_ACCESS_KEY --aws-session-token=AWS_SESSION_TOKEN (--aws-source-ami-file-path=AWS_SOURCE_AMI_FILE_PATH | --aws-ami-export-location=AWS_AMI_EXPORT_LOCATION --aws-ami-id=AWS_AMI_ID)) [--no-address] [--async] [--cloudbuild-service-account=CLOUDBUILD_SERVICE_ACCOUNT] [--compute-service-account=COMPUTE_SERVICE_ACCOUNT] [--description=DESCRIPTION] [--family=FAMILY] [--no-guest-environment] [--guest-os-features=[GUEST_OS_FEATURE,…]] [--log-location=LOG_LOCATION] [--network=NETWORK] [--storage-location=STORAGE_LOCATION] [--subnet=SUBNET] [--timeout=TIMEOUT; default="2h"] [--zone=ZONE] [--data-disk | --byol --os=OS] [GCLOUD_WIDE_FLAG …]
(DEPRECATED) This command is being deprecated. Instead, use the
gcloud
migration vms image-imports command. For more information, see https://cloud.google.com/migrate/virtual-machines/docs/5.0/migrate/image_import.
gcloud compute images import imports Virtual Disk images, such as
VMWare VMDK files and VHD files, into Compute Engine.
Importing images involves four steps:
Before importing 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.
To override the detected OS, specify the --os flag. You can omit
the translation step using the --data-disk flag.
If you exported your disk from Compute Engine then you don't need to re-import
it. Instead, use gcloud compute images
create to create more images from the disk.
Files stored on Cloud Storage and images in Compute Engine incur charges. See https://cloud.google.com/compute/docs/images/importing-virtual-disks#resource_cleanup.
Troubleshooting: Image import/export tools rely on CloudBuild default behavior. They has been using the default CloudBuild service account in order to import/export images to/from Google Cloud Platform. However, Cloud Build has changed this default behavior and in new projects a custom user managed service account may need to be provided to perform the builds. If you get a CloudBuild service account related error, run gcloud with --cloudbuild-service-account=<custom service account>. Seegcloud
compute images import --help for details.
gcloud compute images import myimage-name --os=centos-7 --source-file=mysourcefileTo import a data disk without operating system, run:
gcloud compute images import myimage-name --data-disk --source-file=mysourcefileIMAGE_NAME--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-file=SOURCE_FILEgs://my-bucket/my-image.vmdk or
./my-local-image.vmdk. For more information
about Cloud Storage URIs, see https://cloud.google.com/storage/docs/request-endpoints#json-api.
--source-image=SOURCE_IMAGE--aws-access-key-id=AWS_ACCESS_KEY_ID--aws-region=AWS_REGION--aws-secret-access-key=AWS_SECRET_ACCESS_KEY--aws-session-token=AWS_SESSION_TOKEN--aws-source-ami-file-path=AWS_SOURCE_AMI_FILE_PATH--aws-ami-export-location=AWS_AMI_EXPORT_LOCATION--aws-ami-id=AWS_AMI_ID--no-address--async--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 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 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--family=FAMILY--guest-environment--no-guest-environment to disable.
--guest-os-features=[GUEST_OS_FEATURE,…]GUEST_OS_FEATURE must be (only one value is supported):
UEFI_COMPATIBLE.
--log-location=LOG_LOCATIONgs://<project num>.cloudbuild-logs.googleusercontent.com/ is
created and used.
--network=NETWORK--storage-location=STORAGE_LOCATION--subnet=SUBNET--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.
If you are importing a large image that takes longer than 24 hours to import, either use the RAW disk format to reduce the time needed for converting the image, or split the data into several smaller images.--zone=ZONEcompute/zone property value for this command invocation.
--data-disk--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.
--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.
--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 images importgcloud beta compute images importgcloud preview compute 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.