首页 文章

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

提问于
浏览
3

我想在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:~/

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

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

1 回答

  • 4

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

    $ gsutil cp gs://example/123googlesearchconsoleexample.html .
    $ gcloud compute copy-files 123googlesearchconsoleexample.html example-prd-vm:~/
    

    第一个命令从Google Cloud 存储复制到运行Cloud Shell的VM . 然后,第二个命令从该VM复制到 example-prd-vm ...当前获取的's now copying a local file, so the error you'将不适用 .

相关问题