各个云厂商获取实例metadata的地址
注意必须在云厂商的实例上运行谷歌云必须加-H “Metadata-Flavor: Google”例如:curl -s http://metadata.google.internal/computeMetadata/v1/instance/cpu-platform -H “Metadata-Flavor: Google”参考文档地址https://cloud.google.com/compute/d
注意必须在云厂商的实例上运行
谷歌云
必须加-H “Metadata-Flavor: Google”
例如:
curl -s http://metadata.google.internal/computeMetadata/v1/instance/cpu-platform -H “Metadata-Flavor: Google”
参考文档地址
https://cloud.google.com/compute/docs/storing-retrieving-metadata?hl=zh_cn
虚拟机认元数据
https://cloud.google.com/compute/docs/metadata/default-metadata-values?hl=zh_cn
外网ip地址
curl -sH "Metadata-Flavor: Google" http://metadata/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip
curl -s http://metadata.google.internal/computeMetadata/v1/instance/ -H "Metadata-Flavor: Google"
attributes/
cpu-platform
description
disks/
guest-attributes/
hostname
id
image
legacy-endpoint-access/
licenses/
machine-type
maintenance-event
name
network-interfaces/
preempted
remaining-cpu-time
scheduling/
service-accounts/
tags
virtual-clock/
zone
阿里云
http://100.100.100.200/2016-01-01/meta-data/
直接curl即可,例如获取内网地址
curl -s http://100.100.100.200/2016-01-01/meta-data/private-ipv4
文档
https://help.aliyun.com/document_detail/108460.html
常用信息
alias ecsstat="pssh \"curl -s http://100.100.100.200/2016-01-01/meta-data/private-ipv4; echo ''; curl -s http://100.100.100.200/2016-01-01/meta-data/eipv4; echo ''; curl -s http://100.100.100.200/2016-01-01/meta-data/instance-id; echo ''; curl -s http://100.100.100.200/2016-01-01/meta-data/zone-id; echo ''; curl -s http://100.100.100.200/2016-01-01/meta-data/image-id; echo ''; curl -s http://100.100.100.200/2016-01-01/meta-data/instance/instance-type; echo ''; echo 'last-host-landing-time'; curl -s http://100.100.100.200/2016-01-01/meta-data/instance/last-host-landing-time; echo ''\""
aws
http://169.254.169.254/latest/meta-data/
参考文档地址
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html
获取外网ip
curl cip.cc
curl checkip.amazonaws.com
腾讯云
腾讯云元数据请求地址
http://metadata.tencentyun.com/latest/meta-data/
文档
https://cloud.tencent.com/document/product/213/4934
更多推荐
所有评论(0)