[英]cannot Copy file from google cloud bucket to VM instance
I am trying to transfer file from cloud bucket to VM instance.我正在尝试将文件从云存储桶传输到 VM 实例。
I connected to VM instance by SSH, And used gsutil code like this :我通过 SSH 连接到 VM 实例,并使用了这样的 gsutil 代码:
gsutil cp gs://[bucket name]/[file name] /home gsutil cp gs://[存储桶名称]/[文件名] /home
and then error was occur然后发生错误
Copying gs://huji/final-project-deep-learning-19-tf.tar... OSError: Permission denied.正在复制 gs://huji/final-project-deep-learning-19-tf.tar... OSError: Permission denied。 GiB] GiB]
So I tried this command :所以我尝试了这个命令:
sudo gsutil cp gs://[bucket name]/[file name] /home sudo gsutil cp gs://[存储桶名称]/[文件名] /home
And then, downloading completed.然后,下载完成。
Copying gs://huji/final-project-deep-learning-19-tf.tar... |复制 gs://huji/final-project-deep-learning-19-tf.tar... | [1 files][ 1.7 GiB/ 1.7 GiB] 76.2 MiB/s [1 个文件][ 1.7 GiB/ 1.7 GiB] 76.2 MiB/s
but I cannot find any files and the disk volume hasn't changed.但是我找不到任何文件并且磁盘卷没有改变。 Can anybody explain why this happens and how to copy files from cloud?任何人都可以解释为什么会发生这种情况以及如何从云中复制文件? thanks.谢谢。
Create a service account link :创建服务帐户链接:
gcloud iam service-accounts create transfer --description "transfer" --display-name "transfer"
Set up a new instance to run as a service account:设置一个新实例以作为服务帐户运行:
gcloud compute instances create instance --service-account transfer@my-project.iam.gserviceaccount.com --scopes https://www.googleapis.com/auth/devstorage.full_control
For example, the scope for full access to Cloud Storage is https://www.googleapis.com/auth/devstorage.full_control .例如,完全访问 Cloud Storage 的范围是https://www.googleapis.com/auth/devstorage.full_control 。 The alias for this scope is storage-full此作用域的别名是 storage-full
SSH to the VM instance:通过 SSH 连接到 VM 实例:
gcloud beta compute --project "my-project" ssh --zone "us-central1-a" "instance"
Copy the files :复制文件:
gsutil cp gs://bucket/file.csv .
List the files:列出文件:
ls file.csv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.