Copy files between two Google Cloud instances

后端 未结 6 2006
北恋
北恋 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:53

    Go to the permissions tab on the remote instance(i.e. the instance you WON'T be running gcloud compute copy-files on). Then go to service accounts and create a new one, give it a name and check the box to get a key file for it and leave JSON selected. Upload that key file from your personal machine using gcloud compute copy-files and your personal account to the local instance(i.e. the machine you're SSHing into and running the gcloud compute copy-files command on.) Then run this from the local instance via SSH. gcloud auth activate-service-account ACCOUNT --key-file KEY-FILE replacing ACCOUNT with the email like address that was generated and KEY-FILE with the path to the key file you uploaded from your personal machine earlier. Then you should be able to access the instance that setup the account. These steps have to be repeated on every instance you want to copy files between. If these instructions weren't clear let me know and I'll try to help out.

提交回复
热议问题