【问题标题】:Why does Google Cloud Compute Engine IP differ from the static one I have reserved?为什么 Google Cloud Compute Engine IP 与我保留的静态 IP 不同?
【发布时间】:2021-11-14 11:28:57
【问题描述】:

我为我的 Google Cloud Compute Engine 设置了一个静态 IP 地址。当我转到引擎的网络详细信息时,它告诉它是 34.88.xx.xx

但是 - 当我现在在云 shell 中运行一个测试 python 脚本时,它告诉我请求来自一个 34.91.xx.xx 的 IP

看起来我不应该在 Shell 上运行脚本,而是在计算引擎中运行它。很难弄清楚如何做到这一点。

【问题讨论】:

  • 需要有关您的配置的更多详细信息。
  • 要么您没有将静态 IP 附加到您的虚拟机,要么您只是从 cloudshell 而不是您的实际虚拟机获取数据
  • 你是对的。它是我用来运行它的 cloudshell。我想知道如何在实际的虚拟机上运行它
  • 在您的虚拟机中使用 ssh 登录并在其中运行您的脚本!
  • 在 cloudshell 中,使用此命令 gcloud compute ssh VMname 或单击 MENU>COMPUTE ENGINE 中的 SSH 按钮

标签: python google-cloud-platform google-compute-engine google-cloud-shell static-ip-address


【解决方案1】:

正如@Dany L 建议的那样,如果您想在虚拟机上运行 python 脚本,您需要通过 SSH 连接到虚拟机。您可以通过 Google Cloud Console 或 gcloud 命令行工具连接到 VM 实例。连接后,使用终端在您的 VM 实例上运行命令。

请参阅 Connecting to VMsgcloud command ssh

【讨论】:

    猜你喜欢
    • 2021-09-19
    • 1970-01-01
    • 1970-01-01
    • 2016-06-12
    • 1970-01-01
    • 1970-01-01
    • 2018-05-01
    • 2018-05-17
    • 2018-03-19
    相关资源
    最近更新 更多