If applications on your VM instances require a display device, but do not require the full power or cost of a GPU, you can configure your instances to use a virtual display device. These devices allow you to run remote system management tools and remote desktop software that require a display device.
Configure a virtual display device when you create a new instance or add a virtual display device to an existing instance while it is stopped. There is no cost to enable your instances with a virtual display device.
Before you begin
- If you want to use the command-line examples in this guide, do the following:
- Install or update to the latest version of the Google Cloud CLI.
- Set a default region and zone.
- If you want to use the API examples in this guide, set up API access.
Restrictions
Google supports virtual display devices on Linux instances and on Windows instances that use any x64-based Windows images v20190312 or later.
If your VM instance is running a Windows image that is older than v20190312, you must also manually install the device driver after enabling virtual displays for the instance. Images that are newer than v20190312 come preinstalled with the device drivers.
Virtual display devices are functional only after the guest operating system boots and initializes the virtual display driver. You cannot use virtual display devices during POST or while the guest operating system is booting.
Virtual display devices are not compatible with instances running the Sandy Bridge CPU platform.
Create an instance with a virtual display device
Enable a virtual display device on an instance when you create a new instance. Alternatively, you can add a virtual display device to an existing instance.
Console
In the Google Cloud console, go to the Create an instance page.
Define the properties for the VM, including the name, region, zone, and machine configuration.
To turn on the virtual display device, select the Enable display device checkbox from the Machine configuration > Display device settings.
The virtual display device allows you to use screen capturing.
To create the VM, click Create.
gcloud
In the Google Cloud CLI, use the
compute instances create
command and include the --enable-display-device
flag:
gcloud compute instances create [INSTANCE_NAME] --enable-display-device
where [INSTANCE_NAME]
is the name of the instance that you want to
create.
API
In the API, construct a POST
request to the
compute.instances.insert
method.
In the request body, include the instance properties as well as the
displayDevice
property with enableDisplay
set to true
.
POST https://compute.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances
{
"name": "[INSTANCE_NAME]",
"machineType": "zones/[ZONE]/machineTypes/[MACHINE_TYPE]",
"displayDevice": {
"enableDisplay": true
},
⋮
}]
where:
[INSTANCE_NAME]
is the name of the instance.[PROJECT_ID]
is your project ID.[ZONE]
is the zone where your instance is located.
Terraform
You can use the
Terraform resource
to create an instance with virtual display enabled by setting the enable_display
argument to true
.
After you create an instance with a virtual display device, you can configure remote desktop to remotely manage your Windows instance.
Add or removing a virtual display device on an existing instance
You can enable a virtual display device on an existing instance. Alternatively, you can enable a virtual display device when you create a new instance.
Before you can enable or disable a virtual display device on a running instance, you must stop the instance.
Console
Go to the VM instances page.
In the Name column, click the name of the instance to add or remove the virtual display device from.
At the top of the VM instance details page, click Stop.
At the top of the VM instance details page, click Edit.
Under Display device, click Turn on display device to either enable or disable the virtual display device for this instance.
At the bottom of the instance creation settings, click Save.
gcloud
To add a virtual display device, use the
compute instances update
command in the Google Cloud CLI and include the
--enable-display-device
flag:
gcloud compute instances update [INSTANCE_NAME] --enable-display-device
where [INSTANCE_NAME]
is the name of the instance that you want to
create.
To remove a virtual display device, use the
compute instances update
command in the gcloud CLI and include the
--no-enable-display-device
flag:
gcloud compute instances update [INSTANCE_NAME] --no-enable-display-device
where [INSTANCE_NAME]
is the name of the instance that you want to
create.
API
In the API, construct a POST
request to the
compute.instances.updateDisplayDevice
method. In the request body, include the enableDisplay
property. To enable
the virtual display device on this instance, set enableDisplay
to true
.
To disable the virtual display device on the instance, set enableDisplay
to false
.
POST https://compute.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]/updateDisplayDevice
{
"enableDisplay": [ENABLE_DISPLAY]
}
where:
[INSTANCE_NAME]
is the name of the instance where you want to enable or disable the virtual display device.[PROJECT_ID]
is your project ID.[ZONE]
is the zone where your instance is located.[ENABLE_DISPLAY]
is eithertrue
to enable the virtual display device on the instance orfalse
to disable the virtual display device on the instance.
After you create an instance with a virtual display device, you can configure remote desktop to remotely manage your Windows instance.
Install the virtual display driver
Google provides a display driver that allows Windows instances to use virtual display devices correctly. The driver is required for several Compute Engine features. Google provides and supports this display driver only for Windows instances.
After you create an instance with a virtual display device or add a virtual display device to an existing instance, you can install the virtual display device on the instance using the following process:
- Connect to the Windows instance where the virtual display device is enabled.
- Open a PowerShell terminal as an administrator.
Run the
googet
installer to install thegoogle-compute-engine-driver-gga
component:googet install google-compute-engine-driver-gga
Restart the instance.
After you restart the instance, confirm the driver was installed by following the instructions below.
Verify the virtual display driver install
If you had to manually install the device driver, follow these instructions to verify that the install was successful.
- Connect to the Windows instance where the virtual display device is enabled.
- Open the Run tool and run the
devmgmt.msc
Computer Management tool. - In navigation for the Computer Management tool, click Device Manager to see a list of devices.
- Under the Display adapters list, check to ensure that the
Google Graphics Array driver is listed.
- If the Microsoft Basic Display adapter is listed as a display adapter instead of the Google Graphics Array, repeat the driver install process and check the driver again.
What's next
- Review the Setting up Chrome Remote Desktop for Linux on Compute Engine tutorial.
- Learn about different methods for connecting to Windows instances.
- Learn how to stop and start an instance.