【问题标题】:How can I set Google_application_credentials in ec2 instance?如何在 ec2 实例中设置 Google_application_credentials?
【发布时间】:2022-02-09 02:49:07
【问题描述】:

我刚刚在我的 ec2-instance 中安装了 google-cloud-vision。 为了运行我的代码,我注意到我需要设置 GOOGLE_APPLICATION_CREDENTIALS。 (错误告诉我设置它。DefaultcredentialsError)

但我不知道如何获取 json 凭据并将其设置在我的 ec2 中。 我的真实计算机中有一个 JSON 密钥,但如何将其移动到我的虚拟计算机?

【问题讨论】:

    标签: python google-cloud-platform amazon-ec2 google-cloud-vision


    【解决方案1】:

    使用 SSH 文件复制将服务账户 JSON 密钥文件复制到 EC2 实例。将环境变量设置为文件的完整路径。确保您了解服务帐号密钥的安全风险。

    对于高级用户,请使用 Workload Identity Federation 将 AWS 凭证与 Google Cloud 凭证联合使用,这样就不需要服务帐户 JSON 密钥。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-10
      • 1970-01-01
      • 2019-11-29
      • 2021-04-26
      • 1970-01-01
      • 2015-09-18
      • 2018-08-12
      相关资源
      最近更新 更多