gcloud beta compute os-config os-upgrade - upgrade the instances OS version
gcloud beta compute os-config os-upgrade INSTANCE_NAME --source-os=SOURCE_OS --target-os=TARGET_OS [--async] [--auto-rollback] [--no-create-machine-backup] [--log-location=LOG_LOCATION] [--timeout=TIMEOUT; default="2h"] [--zone=ZONE] [GCLOUD_WIDE_FLAG ...]
(BETA) gcloud beta compute os-config os-upgrade upgrades the instance's OS version.
OS Upgrade involves:
Create a snapshot and/or machine image for the instance.
Create an install media disk and attach it to the instance.
Upgrade the OS version.
Cleanup install media disk after upgrade.
Virtual instances, snapshots, machine images, and disks in Compute Engine and files stored on Cloud Storage incur charges. See https://cloud.google.com/compute/docs/images/importing-virtual-disks#resource_cleanup.
To upgrade a instance named my-instance from windows-2008r2 to windows-2012r2, run:
$ gcloud beta compute os-config os-upgrade my-instance \ --source-os=windows-2008r2 --target-os=windows-2012r2
- INSTANCE_NAME
Name of the instance to os-upgrade. For details on valid instance names, refer to the criteria documented under the field 'name' at: https://cloud.google.com/compute/docs/reference/rest/v1/instances
- --source-os=SOURCE_OS
OS version of the source instance to upgrade. SOURCE_OS must be (currently only one value is supported): windows-2008r2.
- --target-os=TARGET_OS
Version of the OS after upgrade. TARGET_OS must be (currently only one value is supported): windows-2012r2.
- --async
Return immediately, without waiting for the operation in progress to complete.
- --auto-rollback
When auto rollback is enabled, the instance and its resources are restored to their original state. Otherwise, the instance and any temporary resources are left in the intermediate state of the time of failure. This is useful for debugging.
- --create-machine-backup
When enabled, a machine image is created that backs up the original state of your instance. Enabled by default, use --no-create-machine-backup to disable.
- --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.
- --timeout=TIMEOUT; default="2h"
Maximum time an upgrade 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.
- --zone=ZONE
Zone of the instance to os-upgrade. If not specified and the compute/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 compute/zone property:
$ gcloud config set compute/zone ZONE
A list of zones can be fetched by running:
$ gcloud compute zones list
To unset the property, run:
$ gcloud config unset compute/zone
Alternatively, the zone can be stored in the environment variable CLOUDSDK_COMPUTE_ZONE.
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.
This command is currently in beta and might change without notice. This variant is also available:
$ gcloud alpha compute os-config os-upgrade