Transfer files to Windows VMs

Stay organized with collections Save and categorize content based on your preferences.

To transfer files to Compute Engine virtual machine (VM) instances, different options are available depending on your workstation OS and the target instance OS.

Transfer from To Windows instances
Linux or macOS

Transfer files using the Google Cloud CLI

Transferring files using the Google Cloud CLI is only supported on Windows Server 2019 and later VMs that have SSH enabled.

The Google Cloud CLI provides an SCP file transfer utility, creating an SSH key pair for you the first time you connect. Your private key is stored on your local device and its corresponding public key is copied to project or VM instance metadata.

To transfer files using SCP, you must have a firewall rule on the network that your VM uses that allows SSH connections on port 22. You can verify that this firewall rules exists by looking for a firewall rule that allows tcp:22 connections in the Google Cloud console.

Go to Firewall rules.

If you don't have a firewall rule that allows SSH connections on port 22, create the firewall rule.

You can install the gcloud CLI and use it to copy files and directories to your VM using the scp command.

The following example copies a file from your workstation to the home directory of the VM.

gcloud compute scp LOCAL_FILE_PATH VM_NAME:C:\Users\USERNAME

Replace the following:

  • LOCAL_FILE_PATH: the path to the file on your workstation
  • VM_NAME: the name of your VM
  • USERNAME: your username on the VM

You can also copy files and directories from a VM to your local workstation. The following example recursively copies a directory from your VM (the source) to your local workstation (the destination).

gcloud compute scp --recurse VM_NAME:REMOTE_DIR LOCAL_DIR

Replace the following:

  • VM_NAME: the name of the VM
  • REMOTE_DIR: the path to the directory on your VM
  • LOCAL_DIR: the path where you want to put the directory on your workstation

For more information, see the gcloud compute scp reference documentation.

Transferring files through Cloud Storage

Cloud Storage buckets can be a convenient intermediate transfer point between you and your VMs.

This file transfer method works on almost all operating systems and VM types as long as your VM has access to your Cloud Storage bucket through a service account or through your personal user credentials.

Upload your files from your workstation to a Cloud Storage bucket. Then, download those files from the bucket to your instances.

  1. Create a Cloud Storage bucket or identify an existing bucket that you want to use to transfer files.
  2. From your workstation, upload files to the bucket.
  3. Connect to your VM using RDP.
  4. On your VM, download files from the bucket.

If you need to transfer files in the other direction, reverse the process. Upload the files from your VM, and then download those files to your workstation.

Transferring files through the Windows RDP client

Desktop RDP clients let you connect local devices and resources, including local drives, from your workstation to the Windows Server instance that you connect to. This makes your local workstation file system available as a remote resource while you are connected over RDP. Note that this is not available if you use the Google Cloud console with the Chrome RDP extension.

For example, on a Windows Server 2016 workstation:

  1. Open Remote Desktop Connection.
  2. Click Show Options.
  3. Click the Local Resources tab.
  4. Under Local devices and resources, click More.
  5. Select the Drives checkbox.
  6. Connect to the VM. When you open a connection to a remote instance, the local drives that you selected are available through Windows Explorer.

For more information, see Remote Desktop clients.

What's next