简体   繁体   English

无法将文件从谷歌云存储桶复制到 VM 实例

[英]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.谢谢。

  1. Create a service account link :创建服务帐户链接

     gcloud iam service-accounts create transfer --description "transfer" --display-name "transfer"
  2. 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

  1. SSH to the VM instance:通过 SSH 连接到 VM 实例:

     gcloud beta compute --project "my-project" ssh --zone "us-central1-a" "instance"
  2. Copy the files :复制文件:

     gsutil cp gs://bucket/file.csv .
  3. List the files:列出文件:

     ls file.csv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google云端平台,虚拟机实例的ssh权限 - Google cloud platform, vm instance's ssh permission Google Cloud Platform权限问题(发布/订阅->数据流-> Google Cloud Storage存储桶) - Google Cloud Platform permission question (pub/sub -> Dataflow -> Google Cloud Storage bucket) 是否可以向非 Google 管理的电子邮件地址授予对 Google Cloud Storage 存储分区中对象的访问权限? - Is it possible to grant access to objects in a Google Cloud Storage bucket to non-Google adminstered email addresses? 从GCP Compute实例复制到存储桶时的AccessDeniendException - AccessDeniendException on copying from GCP Compute instance to Storage bucket 在Google云端存储分区/对象上设置“域”权限-仅UI或API? - Setting “domain” permission on google cloud storage bucket/object - UI or API only? 从我的 Google Cloud 帐号中移除项目 - Remove project from my Google Cloud account c从另一个文件复制文件权限 - c copy file permissions from another file 我应该为S3存储桶分配什么权限,以使其只能使用IAM角色从EC2实例进行访问? - What permissions should i assign to an S3 bucket to only make it accessible from an EC2 instance using IAM roles? 无法在新 GCE 虚拟机上列出服务帐户 - Cannot list service accounts on new GCE VM 我可以复制文件,但不能从Mac终端移动文件 - I can copy file but can not move it from my Mac Terminal
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM