File: //snap/google-cloud-cli/396/help/man/man1/gcloud_beta_compute_images_import.1
.TH "GCLOUD_BETA_COMPUTE_IMAGES_IMPORT" 1
.SH "NAME"
.HP
gcloud beta compute images import \- import an image into Compute Engine
.SH "SYNOPSIS"
.HP
\f5gcloud beta compute images import\fR \fIIMAGE_NAME\fR \fB\-\-cmd\-deprecated\fR (\fB\-\-source\-file\fR=\fISOURCE_FILE\fR\ |\ \fB\-\-source\-image\fR=\fISOURCE_IMAGE\fR\ |\ \fB\-\-aws\-access\-key\-id\fR=\fIAWS_ACCESS_KEY_ID\fR\ \fB\-\-aws\-region\fR=\fIAWS_REGION\fR\ \fB\-\-aws\-secret\-access\-key\fR=\fIAWS_SECRET_ACCESS_KEY\fR\ \fB\-\-aws\-session\-token\fR=\fIAWS_SESSION_TOKEN\fR\ (\fB\-\-aws\-source\-ami\-file\-path\fR=\fIAWS_SOURCE_AMI_FILE_PATH\fR\ |\ \fB\-\-aws\-ami\-export\-location\fR=\fIAWS_AMI_EXPORT_LOCATION\fR\ \fB\-\-aws\-ami\-id\fR=\fIAWS_AMI_ID\fR)) [\fB\-\-no\-address\fR] [\fB\-\-async\fR] [\fB\-\-cloudbuild\-service\-account\fR=\fICLOUDBUILD_SERVICE_ACCOUNT\fR] [\fB\-\-compute\-service\-account\fR=\fICOMPUTE_SERVICE_ACCOUNT\fR] [\fB\-\-description\fR=\fIDESCRIPTION\fR] [\fB\-\-family\fR=\fIFAMILY\fR] [\fB\-\-no\-guest\-environment\fR] [\fB\-\-guest\-os\-features\fR=[\fIGUEST_OS_FEATURE\fR,...]] [\fB\-\-log\-location\fR=\fILOG_LOCATION\fR] [\fB\-\-network\fR=\fINETWORK\fR] [\fB\-\-storage\-location\fR=\fISTORAGE_LOCATION\fR] [\fB\-\-subnet\fR=\fISUBNET\fR] [\fB\-\-timeout\fR=\fITIMEOUT\fR;\ default="2h"] [\fB\-\-zone\fR=\fIZONE\fR] [\fB\-\-data\-disk\fR\ |\ \fB\-\-byol\fR\ \fB\-\-os\fR=\fIOS\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(BETA)\fR \fB(DEPRECATED)\fR This command is being deprecated. Instead, use
the \f5gcloud migration vms image\-imports\fR command. For more information, see
https://cloud.google.com/migrate/virtual\-machines/docs/5.0/migrate/image_import.
\fBgcloud beta compute images import\fR imports Virtual Disk images, such as
VMWare VMDK files and VHD files, into Compute Engine.
Importing images involves four steps:
.RS 2m
.IP "\(bu" 2m
Upload the virtual disk file to Cloud Storage.
.IP "\(bu" 2m
Import the image to Compute Engine.
.IP "\(bu" 2m
Detect the OS and bootloader contained on the disk.
.IP "\(bu" 2m
Translate the image to make a bootable image. This command performs all four of
these steps as required, depending on the input arguments specified.
.RE
.sp
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 \f5\-\-os\fR flag. You can omit the
translation step using the \f5\-\-data\-disk\fR flag.
If you exported your disk from Compute Engine then you don't need to re\-import
it. Instead, use \f5gcloud beta compute images create\fR 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>. See \f5gcloud compute
images import \-\-help\fR for details.
.SH "EXAMPLES"
To import a centos\-7 VMDK file, run:
.RS 2m
$ gcloud beta compute images import myimage\-name \-\-os=centos\-7 \e
\-\-source\-file=mysourcefile
.RE
To import a data disk without operating system, run:
.RS 2m
$ gcloud beta compute images import myimage\-name \-\-data\-disk \e
\-\-source\-file=mysourcefile
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fIIMAGE_NAME\fR
Name of the disk image to create.
.RE
.sp
.SH "REQUIRED FLAGS"
.RS 2m
.TP 2m
\fB\-\-cmd\-deprecated\fR
The command you're using is deprecated and will be removed by December 31, 2025.
We recommend using \f5gcloud compute migration image\-imports\fR instead. See
our official documentation for more information.
https://cloud.google.com/migrate/virtual\-machines/docs/5.0/migrate/image_import.
.TP 2m
Exactly one of these must be specified:
.RS 2m
.TP 2m
Image import from local file, Cloud Storage or Compute Engine image.
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-source\-file\fR=\fISOURCE_FILE\fR
A local file, or the Cloud Storage URI of the virtual disk file to import. For
example: \f5\fIgs://my\-bucket/my\-image.vmdk\fR\fR or
\f5\fI./my\-local\-image.vmdk\fR\fR. For more information about Cloud Storage
URIs, see https://cloud.google.com/storage/docs/request\-endpoints#json\-api.
.TP 2m
\fB\-\-source\-image\fR=\fISOURCE_IMAGE\fR
An existing Compute Engine image from which to import.
.RE
.sp
.TP 2m
Image import from AWS.
.RS 2m
.TP 2m
\fB\-\-aws\-access\-key\-id\fR=\fIAWS_ACCESS_KEY_ID\fR
Access key ID for a temporary AWS credential. This ID must be generated using
the AWS Security Token Service.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
\fB\-\-aws\-region\fR=\fIAWS_REGION\fR
AWS region of the image that you want to import.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
\fB\-\-aws\-secret\-access\-key\fR=\fIAWS_SECRET_ACCESS_KEY\fR
Secret access key for a temporary AWS credential. This key must be generated
using the AWS Security Token Service.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
\fB\-\-aws\-session\-token\fR=\fIAWS_SESSION_TOKEN\fR
Session token for a temporary AWS credential. This session token must be
generated using the AWS Security Token Service.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
Specify whether to import from an AMI or disk image.
Exactly one of these must be specified:
.RS 2m
.TP 2m
If importing a disk image, specify the following:
.RS 2m
.TP 2m
\fB\-\-aws\-source\-ami\-file\-path\fR=\fIAWS_SOURCE_AMI_FILE_PATH\fR
S3 resource path of the exported image file that you want to import.
.RE
.sp
.TP 2m
If importing an AMI, specify the following two flags:
.RS 2m
.TP 2m
\fB\-\-aws\-ami\-export\-location\fR=\fIAWS_AMI_EXPORT_LOCATION\fR
An AWS S3 bucket location where the converted image file can be temporarily
exported to before the import to Cloud Storage.
This flag argument must be specified if any of the other arguments in this group
are specified.
.TP 2m
\fB\-\-aws\-ami\-id\fR=\fIAWS_AMI_ID\fR
AWS AMI ID of the image to import.
This flag argument must be specified if any of the other arguments in this group
are specified.
.RE
.RE
.RE
.RE
.RE
.sp
.SH "OPTIONAL FLAGS"
.RS 2m
.TP 2m
\fB\-\-no\-address\fR
Temporary VMs are created in your project during image import. Set this flag so
that these temporary VMs are not assigned external IP addresses.
Note: The image import process requires package managers to be installed on the
operating system for the virtual disk. These package managers might need to make
requests to package repositories that are outside Google Cloud. To allow access
for these updates, you need to configure Cloud NAT and Private Google Access.
For more information, see
https://cloud.google.com/compute/docs/import/importing\-virtual\-disks#no\-external\-ip.
.TP 2m
\fB\-\-async\fR
Return immediately, without waiting for the operation in progress to complete.
.TP 2m
\fB\-\-cloudbuild\-service\-account\fR=\fICLOUDBUILD_SERVICE_ACCOUNT\fR
Image import and export tools use Cloud Build to import and export images to and
from your project. Cloud Build uses a specific service account to execute builds
on your behalf. The Cloud Build service account generates an access token for
other service accounts and it is also used for authentication when building the
artifacts for the image import tool.
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
\f5\-\-logs\-location\fR flag when you set a user\-managed service account.
At minimum, the specified user\-managed service account needs to have the
following roles assigned:
.RS 2m
.IP "\(em" 2m
roles/compute.admin
.IP "\(em" 2m
roles/iam.serviceAccountTokenCreator
.IP "\(em" 2m
roles/iam.serviceAccountUser
.RE
.sp
.TP 2m
\fB\-\-compute\-service\-account\fR=\fICOMPUTE_SERVICE_ACCOUNT\fR
A temporary virtual machine instance is created in your project during image
import. Image import 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 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:
.RS 2m
.IP "\(em" 2m
roles/compute.storageAdmin
.IP "\(em" 2m
roles/storage.objectViewer
.RE
.sp
.TP 2m
\fB\-\-description\fR=\fIDESCRIPTION\fR
Description to set for the imported image.
.TP 2m
\fB\-\-family\fR=\fIFAMILY\fR
Family to set for the imported image.
.TP 2m
\fB\-\-guest\-environment\fR
Installs the guest environment on the image. See
https://cloud.google.com/compute/docs/images/guest\-environment. Enabled by
default, use \fB\-\-no\-guest\-environment\fR to disable.
.TP 2m
\fB\-\-guest\-os\-features\fR=[\fIGUEST_OS_FEATURE\fR,...]
Enables one or more features for VM instances that use the image for their boot
disks. See the descriptions of supported features at:
https://cloud.google.com/compute/docs/images/create\-delete\-deprecate\-private\-images#guest\-os\-features.
\fIGUEST_OS_FEATURE\fR must be (only one value is supported):
\fBUEFI_COMPATIBLE\fR.
.TP 2m
\fB\-\-log\-location\fR=\fILOG_LOCATION\fR
Directory in Cloud Storage to hold build logs. If not set, \f5gs://<project
num>.cloudbuild\-logs.googleusercontent.com/\fR is created and used.
.TP 2m
\fB\-\-network\fR=\fINETWORK\fR
Name of the network in your project to use for the image import. When you import
an image, the import tool creates and uses temporary VMs in your project for the
import process. Use this flag to specify the network to use for these temporary
VMs.
.TP 2m
\fB\-\-storage\-location\fR=\fISTORAGE_LOCATION\fR
Specifies a Cloud Storage location, either regional or multi\-regional, where
image content is to be stored. If not specified, the multi\-region location
closest to the source is chosen automatically.
.TP 2m
\fB\-\-subnet\fR=\fISUBNET\fR
Name of the subnetwork in your project to use for the image import. When you
import an image, the import tool creates and uses temporary VMs in your project
for the import process. Use this flag to specify the subnetwork to use for these
temporary VMs.
.RS 2m
.IP "\(em" 2m
If the network resource is in legacy mode, do not provide this property.
.IP "\(em" 2m
If the network is in auto subnet mode, specifying the subnetwork is optional.
.IP "\(em" 2m
If the network is in custom subnet mode, then this field must be specified.
.RE
.sp
.TP 2m
\fB\-\-timeout\fR=\fITIMEOUT\fR; default="2h"
Maximum time an import can last before it fails as "TIMEOUT". For example, if
you specify \f52h\fR, 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.
.TP 2m
\fB\-\-zone\fR=\fIZONE\fR
Zone to use when importing the image. When you import an image, the import tool
creates and uses temporary VMs in your project for the import process. Use this
flag to specify the zone to use for these temporary VMs. Overrides the default
\fBcompute/zone\fR property value for this command invocation.
.TP 2m
At most one of these can be specified:
.RS 2m
.TP 2m
\fB\-\-data\-disk\fR
Specifies that the disk has no bootable OS installed on it. Imports the disk
without making it bootable or installing Google tools on it.
.TP 2m
\fB\-\-byol\fR
Specifies that you want to import an image with an existing license. Importing
an image with an existing license is known as bring your own license (BYOL).
\f5\-\-byol\fR can be specified in any of the following ways:
.RS 2m
+ `\-\-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.
.RE
For more information about BYOL, see:
https://cloud.google.com/compute/docs/nodes/bringing\-your\-own\-licenses
.TP 2m
\fB\-\-os\fR=\fIOS\fR
Specifies the OS of the disk image being imported. \fIOS\fR must be one of:
\fBcentos\-7\fR, \fBcentos\-stream\-8\fR, \fBcentos\-stream\-9\fR,
\fBdebian\-10\fR, \fBdebian\-11\fR, \fBdebian\-8\fR, \fBdebian\-9\fR,
\fBopensuse\-15\fR, \fBrhel\-6\fR, \fBrhel\-6\-byol\fR, \fBrhel\-7\fR,
\fBrhel\-7\-byol\fR, \fBrhel\-8\fR, \fBrhel\-8\-byol\fR, \fBrhel\-9\fR,
\fBrhel\-9\-byol\fR, \fBrocky\-8\fR, \fBrocky\-9\fR, \fBsles\-12\fR,
\fBsles\-12\-byol\fR, \fBsles\-15\fR, \fBsles\-15\-byol\fR, \fBsles\-sap\-12\fR,
\fBsles\-sap\-12\-byol\fR, \fBsles\-sap\-15\fR, \fBsles\-sap\-15\-byol\fR,
\fBubuntu\-1404\fR, \fBubuntu\-1604\fR, \fBubuntu\-1804\fR, \fBubuntu\-2004\fR,
\fBubuntu\-2204\fR, \fBwindows\-10\-x64\-byol\fR, \fBwindows\-10\-x86\-byol\fR,
\fBwindows\-11\-x64\-byol\fR, \fBwindows\-2008r2\fR,
\fBwindows\-2008r2\-byol\fR, \fBwindows\-2012\fR, \fBwindows\-2012\-byol\fR,
\fBwindows\-2012r2\fR, \fBwindows\-2012r2\-byol\fR, \fBwindows\-2016\fR,
\fBwindows\-2016\-byol\fR, \fBwindows\-2019\fR, \fBwindows\-2019\-byol\fR,
\fBwindows\-2022\fR, \fBwindows\-2022\-byol\fR, \fBwindows\-7\-x64\-byol\fR,
\fBwindows\-7\-x86\-byol\fR, \fBwindows\-8\-x64\-byol\fR,
\fBwindows\-8\-x86\-byol\fR.
.RE
.RE
.sp
.SH "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 \fB$ gcloud help\fR for details.
.SH "NOTES"
This command is currently in beta and might change without notice. These
variants are also available:
.RS 2m
$ gcloud compute images import
.RE
.RS 2m
$ gcloud alpha compute images import
.RE