弹性云服务器 ECS-通过元数据获取ECS基本信息:Network data(OpenStack元数据API)
Network data(OpenStack元数据API)
查询弹性云服务器的网络信息,支持查询云服务器挂载的全部网卡的信息,包括网卡所在子网的 DNS地址 、网络带宽、网卡ID、网卡私有IP地址、网卡弹性公网IP地址、网卡的MAC地址。
- URI
- 方法
- 示例
instance_max_bandwidth、instance_min_bandwidth的单位是Mbps,如果取值为-1,说明对带宽大小无限制。
Linux操作系统:
curl http://169.254.169.254/openstack/latest/network_data.json
Windows操作系统:
Invoke-RestMethod http://169.254.169.254/openstack/latest/network_data.json | ConvertTo-Json
{ "services": [{ "type": "dns", "address": "xxx.xx.x.x" }, { "type": "dns", "address": "100.125.21.250" }], "qos":{ "instance_min_bandwidth": 100, "instance_max_bandwidth": 500 }, "networks": [{ "network_id": "67dc10ce-441f-4592-9a80-cc709f6436e7", "type": "ipv4_dhcp", "link": "tap68a9272d-71", "id": "network0" }], "links": [{ "vif_id": "68a9272d-7152-4ae7-a138-3ef53af669e7", "public_ipv4": "100.100.xx.xx", "ethernet_mac_address": "fa:16:3e:f7:c1:47", "mtu": null, "local_ipv4": "192.169.10.10", "type": "cascading", "id": "tap68a9272d-71" }] }