Reputation: 1958
Today, I was uploading a 1.55gb zip file to a gcloud instance. I followed the instructions here and used the upload file command from a browser window.
After getting frustrated this was taking too long (I waited for an hour and it said it was 12% done), I looked elsewhere in the tutorial and used the following command from my local terminal
gcloud compute scp [FILE-NAME] [INSTANCE-NAME]:/tmp/
Where the file uploaded in ~1 minute and 7 seconds (as opposed to an estimated 10 or so hours for the other method).
Why was the scp
method so much faster? I don't see an explanation in https://cloud.google.com/compute/docs/instances/transfer-files, and intuitively, couldn't the upload
command just run the scp
command under the hood?
Upvotes: 3
Views: 1564
Reputation: 81336
The browser uses IAP tunneling, which is much slower than a direct SSH connection.
Note: Using the browser (IAP Tunneling) for file transfers is not recommended as there are data quotas. This is a convenience feature that is not designed for your use case.
Using an IAP tunnel does provide a useful benefit. Your Compute Engine instance does not need a public IP address. You can reach instances with only private IP addresses.
Browsers cannot launch programs such as scp.
The best method is to install an SSH/SCP product to do file transfers. I use Bitvise on Windows.
Here is a link for more information about IAP Tunneling (TCP Forwarding).
Upvotes: 4