【问题标题】:Google Compute Engine: Get specific data associated with a Google Compute Engine virtual machine instanceGoogle Compute Engine:获取与 Google Compute Engine 虚拟机实例关联的特定数据
【发布时间】:2016-03-13 05:59:27
【问题描述】:

我正在使用以下命令显示与 Google Compute Engine 虚拟机实例关联的所有数据。

gcloud compute instances describe <instance>

我只想要“标签”、“机器类型”等特定信息,而不是全部信息。

提前致谢

【问题讨论】:

    标签: google-compute-engine google-cloud-platform


    【解决方案1】:

    您可以将grep添加到命令中,如下所示:

    gcloud compute instances describe INSTANCE_NAME --zone INSTANCE'S_ZONE | grep machineType:
    
    gcloud compute instances describe INSTANCE_NAME --zone INSTANCE'S_ZONE | grep tags:
    

    【讨论】:

      【解决方案2】:

      您可以将格式选项设置为您想要的唯一信息。

      gcloud 计算实例列表 --format='value(name, tags.items, 机器类型)'

      您可以使用表格使输出更漂亮

      gcloud 计算实例列表 --format='table[](name, tags.items, 机器类型)'

      查看列表属性:

      gcloud 计算实例列表 --format=flattened

      要了解有关格式的更多信息:

      gcloud 主题格式

      【讨论】:

        猜你喜欢
        • 2020-09-13
        • 2015-10-23
        • 1970-01-01
        • 2018-12-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-11-22
        • 2014-11-12
        相关资源
        最近更新 更多