jun*_*sid 8 shell google-compute-engine google-cloud-platform google-cloud-sdk
有没有办法检索特定键的自定义实例元数据值?我试过gcloud compute instances describe instance-1命令,这返回整个元数据文本.但我只想检索特定键的值.
Jof*_*fre 11
该gcloud工具具有内置过滤器和格式,详情你可以阅读gcloud topic filters,gcloud topic formats和gcloud topic projections.
对于您的特定用例,您可以通过以下方式获取元数据值:
gcloud compute instances describe INSTANCE-ID \
--format='value[](metadata.items.YOUR-KEY)'
Run Code Online (Sandbox Code Playgroud)