0

I ran the command:

gcp compute scp my_user@10.97.25.64:/opt/myproject/myfile.txt "C:\myfolder" --zone=europe-west2-c --internal-ip

The source 10.97.25.64 is a VM instance hosted in GCP. I am trying to copy the file to my local machine "C:\myfolder".

But I always get error:

unrecognized argument --internal-ip

From the documentation, the --internal-ip is a valid argument. https://cloud.google.com/sdk/gcloud/reference/compute/scp. What did I do wrong?

ZZZ
  • 645
  • 4
  • 17
  • `--internal-ip` only works if you're in the same vpc as the VM. Are you trying to copy from the VM to your local PC? – Puteri Feb 13 '23 at 20:02
  • @ZZZ Are you copying files from, or to a Compute Engine VM? Are you trying to copy files from a local machine or another VM in another VPC? Kindly update your question with further details. – James S Feb 13 '23 at 21:25
  • @Puteri I am trying to copy from a GCP-hosted VM to my local machine. – ZZZ Feb 13 '23 at 21:58
  • @JamesS I am trying to copy from a GCP-hosted VM to my local machine. – ZZZ Feb 13 '23 at 21:58
  • Then `--internal-ip` will not work. The doc is very explicit on how this flag works and in what scenarios. Instead use `--tunnel-through-iap` – Puteri Feb 13 '23 at 23:26

1 Answers1

0

As commented by @Puteri and also stated in the documentation, the flag --internal-ip can only be specified when connecting from one instance to another on the same VPC network, over a VPN connection, or between two peered VPC networks. At this point, my assumption is that the GCP VM isn't connected to your on premise machine through vpn so this doesn't work.

An alternative would be to just transfer the files using SSH-in-browser as described in this documentation and from another post

To copy files from VM to your desktop you can simply SSH into the VM and on top right corner there is a settings button, there you will find the download file option just enter the path of file.

James S
  • 1,181
  • 1
  • 7