如何使用gcloud终端将文件从Google Cloud Storage传输到Compute Engine实例?

Mat*_*ski 3 google-cloud-storage google-compute-engine google-cloud-platform

我想通过将文件上传到我的网站来验证我在Google Search Console中的网站 - example.com是在Google Cloud Compute Engine上托管的(使用Google Cloud Launcher部署的Wordpress网站).它必须作为example.com/123googlesearchconsoleexample.html放置在网站上,但我无法通过Cloud Shell从Google Cloud Storage存储桶上传它.有没有办法做到这一点?

我试过gcloud compute copy-files命令

gcloud compute copy-files gs://example/123googlesearchconsoleexample.html example-prd-vm:~/
Run Code Online (Sandbox Code Playgroud)

,但似乎它在浏览器中不起作用,这就是我想要这样做的方式(不安装SDK).我得到的错误是:

(gcloud.compute.copy-files)目标为远程时,所有源都必须是本地文件.

Jon*_*eet 6

我不知道是否有一种方法可以一步完成,但看起来应该很容易分两步完成:

$ gsutil cp gs://example/123googlesearchconsoleexample.html .
$ gcloud compute copy-files 123googlesearchconsoleexample.html example-prd-vm:~/
Run Code Online (Sandbox Code Playgroud)

第一个命令从Google Cloud Storage复制到运行Cloud Shell的VM.然后第二个命令从该VM example-prd-vm复制到...它现在正在复制本地文件,因此您当前获得的错误将不适用.