【问题标题】:Is it possible to obtain instance metadata for GCP on Google Collaboratory?是否可以在 Google Collaboratory 上获取 GCP 的实例元数据?
【发布时间】:2020-05-26 16:03:06
【问题描述】:

我正在尝试在 Google Collaboratory 上获取实例元数据。我有兴趣找出计算区域。

具体来说,在 Google Collaboratory 的托管运行时,我尝试运行以下命令,但它们超时。

!curl "http://metadata.google.internal/computeMetadata/v1/?recursive=true&alt=json" -H "Metadata-Flavor: Google"

curl: (7) Failed to connect to metadata.google.internal port 80: Connection timed out
!curl "http://169.254.169.254/computeMetadata/v1/instance/?recursive=true&alt=json" -H "Metadata-Flavor: Google"

curl: (7) Failed to connect to 169.254.169.254 port 80: Connection timed out

是我做错了什么,还是有其他解决方法?

谢谢!

【问题讨论】:

  • 您是指 AI Platform Notebooks 而不是 Colab?

标签: google-cloud-platform gcp-ai-platform-notebook


【解决方案1】:

您无法从 Google Cloud Platform 外部访问元数据服务器,因为它是 Google Compute Engine (GCE) 特有的。

为了了解计算区域,您可以将您的 Google 协作笔记本与 GCE 中的实例虚拟机链接在一起,然后您的笔记本将在该特定实例虚拟机中运行。

另一种方法是使用 AI platform notebooks 而不是 Google Collaboratory,因为它使用 GCE 作为后端。

【讨论】:

    猜你喜欢
    • 2021-10-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-22
    • 1970-01-01
    • 2020-08-23
    相关资源
    最近更新 更多