Enabling virtual displays


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

Restrictions

  • Google supports virtual display devices on Linux instances and on Windows instances that use any 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.

Creating 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

  1. In the Google Cloud Console, go to the VM instances page.

    Go to the VM instances page

  2. Click Create instance.

  3. Define the properties for the instance, including the name, region, zone, and machine configuration.

  4. Under Machine configuration, click CPU platform and GPU to expand the CPU platform, GPUs, and Display device settings.

  5. Select the Turn on display device checkbox to enable the virtual display device, which allows you to use screen capturing and recording tools.

  6. Click Create to create the instance.

gcloud

In the gcloud command-line tool, 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.

After you create an instance with a virtual display device, you can configure remote desktop to remotely manage your Windows instance.

Adding 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

  1. Go to the VM instances page.

    Go to the VM instances page

  2. In the Name column, click the name of the instance to add or remove the virtual display device from.

  3. At the top of the VM instance details page, click Stop.

  4. At the top of the VM instance details page, click Edit.

  5. Under Display device, click Turn on display device to either enable or disable the virtual display device for this instance.

  6. 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 gcloud command-line tool 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 tool 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 either true to enable the virtual display device on the instance or false 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.

Installing 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:

  1. Connect to the Windows instance where the virtual display device is enabled.
  2. Open a PowerShell terminal as an administrator.
  3. Run the googet installer to install the google-compute-engine-driver-gga component:

    googet install google-compute-engine-driver-gga
    
  4. Restart the instance.

After you restart the instance, confirm the driver was installed by following the instructions below.

Verifying the virtual display driver install

If you had to manually install the device driver, follow these instructions to verify that the install was successful.

  1. Connect to the Windows instance where the virtual display device is enabled.
  2. Open the Run tool and run the devmgmt.msc Computer Management tool.
  3. In navigation for the Computer Management tool, click Device Manager to see a list of devices.
  4. Under the Display adapters list, check to ensure that the Google Graphics Array driver is listed. The Windows Computer Management window, which shows the Google Graphics Array listed as an installed display adapter.
  5. 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