Have you ever needed to upgrade an existing virtual machine to access premium security or support features, but dreaded the thought of rebuilding the VM from scratch?
Google Cloud’s mutable license feature solves this problem. It allows you to swap the OS license associated with a VM’s boot disk in-place. This means you can seamlessly transition your existing workloads between standard Ubuntu LTS and Ubuntu Pro without losing your data or configurations.
Here is a quick guide on how to perform these in-place upgrades and downgrades.
1. Upgrading from Ubuntu LTS to Ubuntu Pro
If you need enterprise-grade security (like Livepatch and Expanded Security Maintenance), you can upgrade your VM in-place.
Rule: You can only upgrade within the same Ubuntu series (e.g., Ubuntu 22.04 LTS to Ubuntu Pro 22.04 LTS).
How to Upgrade:
-
Stop your VM:
gcloud compute instances stop $INSTANCE_NAME -
Replace the license on the disk:
gcloud compute disks update $INSTANCE_NAME --zone=$ZONE \ --replace-license=$PREVIOUS_LICENSE_URI,$NEW_LICENSE_URI -
Start your VM:
gcloud compute instances start $INSTANCE_NAME
License URI Reference:
| Version | Standard LTS License URI ($PREVIOUS_LICENSE_URI) |
Ubuntu Pro License URI ($NEW_LICENSE_URI) |
|---|---|---|
| 16.04 | projects/ubuntu-os-cloud/global/licenses/ubuntu-1604-lts |
projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1604-lts |
| undefined | ---- | ---- |
| 18.04 | projects/ubuntu-os-cloud/global/licenses/ubuntu-1804-lts |
projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1804-lts |
| undefined | ---- | ---- |
| 20.04 | projects/ubuntu-os-cloud/global/licenses/ubuntu-2004-lts |
projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2004-lts |
| undefined | ---- | ---- |
| 22.04 | projects/ubuntu-os-cloud/global/licenses/ubuntu-2204-lts |
projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2204-lts |
| undefined | ---- | ---- |
| 24.04 | projects/ubuntu-os-cloud/global/licenses/ubuntu-2404-lts |
projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2404-lts |
| undefined | ---- | ---- |
Example (Upgrading 22.04):
gcloud compute disks update my-vm --zone=us-central1-a \
--replace-license=projects/ubuntu-os-cloud/global/licenses/ubuntu-2204-lts,projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2204-lts
Verify your Upgrade:
SSH into your VM and run:
pro status
You should see that premium services like livepatch and esm-apps are now entitled and enabled.
2. Downgrading from Ubuntu Pro to Ubuntu LTS
If you no longer require Ubuntu Pro’s premium features, you can reverse the process and downgrade back to standard Ubuntu LTS.
Important Restrictions:
-
The 90-day Rule: You must keep the Pro license active for at least 90 days. The downgrade will fail if the Pro license was attached less than 90 days ago.
-
Standard Support Rule: You cannot downgrade if the target OS version has already reached End of Standard Support (EOS). For example, you cannot downgrade Ubuntu 16.04, 18.04, or 20.04. Only versions still actively supported under standard LTS (22.04 and 24.04) are eligible.
How to Downgrade:
-
Stop your VM:
gcloud compute instances stop $INSTANCE_NAME -
Replace the license (Pro to LTS):
gcloud compute disks update $INSTANCE_NAME --zone=$ZONE \ --replace-license=$PRO_LICENSE_URI,$LTS_LICENSE_URI -
Start your VM:
gcloud compute instances start $INSTANCE_NAME
Example (Downgrading 22.04):
gcloud compute disks update my-vm --zone=us-central1-a \
--replace-license=projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2204-lts,projects/ubuntu-os-cloud/global/licenses/ubuntu-2204-lts
Verify your Downgrade:
SSH into your VM and run pro status. The output will confirm that your Ubuntu Pro services are no longer entitled.
Conclusion
GCP’s mutable license feature makes managing your operating systems highly flexible. Whether you are scaling up to enterprise compliance or optimization-tuning your cloud budget, you can transition between Ubuntu LTS and Ubuntu Pro with just a few simple gcloud commands.
For comprehensive details, make sure to check out the official Google Cloud documentation.