Copy files between two Google Cloud instances

后端 未结 6 1997
北恋
北恋 2020-12-29 09:19

I have two projects in Google Cloud and I need to copy files from an instance in one project to an instance in another project. I tried to using the \'gcloud compute copy-fi

6条回答
  •  执笔经年
    2020-12-29 09:52

    I was able to replicate your issue with a brand new VM instance, getting the same error. Here are a few steps that I took to correct the problem:

    Make sure you are authenticated and have rights to both projects with the same account!

    $ gcloud config list (if you see the service account @developer.gserviceaccount.com, you need to switch to the account that is enabled on both projects. you can check that from the Devlopers Console > Permissions)

    $ gcloud auth login (copy the link to a new window, login, copy the code and paste it back in the prompt)

    $ gcloud compute copy-files test.tgz --project stack-complete-343 instance-IP:/home/ubuntu --zone us-central1-a (I would also use the instance name instead of the IP)

    This last command should also generate your ssh keys. You should see something like this, but do not worry about entering a passphrase :

    WARNING: [/usr/bin/ssh-keygen] will be executed to generate a key.

    Generating public/private rsa key pair

    Enter passphrase (empty for no passphrase):

提交回复
热议问题