描述实例信息

最近更新时间:2021-03-19 17:59:15

查看PDF

DescribeInstances(描述实例信息)

主网卡信息直接在返回值中体现;

NetworkInterfaceSet体现所有网卡的信息;

Request Parameters(请求参数)

MaxResults

  • 单次调用所返回的最大实例数目,取值为5~1000,超过1000记为1000
  • 类型: Integer
  • 缺省: 10
  • 是否可缺省: 是

Marker

  • 分页标识,单次调用未返回全部实例时,标记下次调用的返回值的起点,默认值是0
  • 类型: Integer
  • 是否可缺省: 是

InstanceId.N(N的范围为1-100)

  • 待返回描述信息的实例ID列表
  • 类型: String 列表
  • 缺省: 返回全部实例描述信息
  • 是否可缺省: 是

ProjectId.N(N的范围为1-100)

  • 待返回实例信息的项目ID列表
  • 类型:Long列表
  • 是否可缺省:是
  • 缺省:默认项目(如果没传项目ID信息,只会查询默认项目(ProjectId=0)下的资源)

Filter.N(N的范围为1-100)

  • 一个或者多个过滤器
  • 类型: 过滤器(Filter)列表
  • 有效值:支持如下过滤器名称
    • instance-id 实例ID
    • subnet-id 子网ID
    • vpc-id vpc ID
    • instance-name 实例名称
    • instance-type 实例类型
    • private-ip-address 内网IP
    • image-id 镜像ID
    • charge-type 计费模式(Monthly(包年包月)、Daily(按量付费(按日月结))、HourlyInstantSettlement(按量付费)、Spot(竞价型实例))
    • ProjectId.N 所属项目
    • network-interface.subnet-id 网络接口关联的子网ID
    • network-interface.network-interface-id 网卡的ID
    • network-interface.group-id 网络接口关联的安全组ID
    • instance-state.name 实例状态
    • availability-zone-name 可用区(AvailabilityZone)
    • 是否可缺省: 是

以查看回收站中云服务器实例为例:

1)、Filter.N中instance-state.name-实例状态为recycling,则显示回收站的实例列表信息。

输入:

Filter.1.Name      instance-state.name
Filter.1.Value.1    recycling

2)、默认不返回状态为recycling的实例

Filter.N过滤器实现多值查询实例:

1)、通过两个过滤器,对instance-state.name-实例状态为active,instance-id-实例ID实现多值查询。

输入:

http://kec.{{region}}.api.ksyun.com/?Action=DescribeInstances&Filter.1.Name=instance-state.name&Filter.1.Value.1=active&Filter.2.Name=instance-id&Filter.2.Value.1=82d2b48b-a6e7-4135-84cb-23d9ec877a0b&Filter.2.Value.2=86f98f2e-9829-4061-a690-04bd3037ba1b&Filter.2.Value.3=89ab170b-0bf0-44b2-a44d-99f26dbf7a0b&Filter.2.Value.4=9f1ab4c3-8413-495d-b5c8-48afca723dd4&Filter.2.Value.5=f0be7556-effc-471e-af89-c706d799e403&Filter.2.Value.6=95ffad39-5a58-420b-bf8c-81ce6f7b2a9f&MaxResults=1000&Version=2016-03-04

2)、返回实例状态为active,多个实例ID匹配成功后的实例信息。

Sort

  • 筛选器
  • 类型: 筛选器(Sort)列表
  • 有效值:支持如下筛选器名称
  • InstanceName –主机名称
  • CreationDate –创建时间
  • PrivateIpAddress - 主机内网IP(主网卡)
  • 是否可缺省:是

Search

  • 搜索条件,模糊匹配,可搜索字段如下:
  • 类型:string
  • 支持字段:实例名(InstanceName)、主网卡私有IP地址(PrivateIpAddress)
  • 是否可缺省:是

以模糊查询InstanceName-实例名称为例:

1)、Search=CNI模糊查询InstanceName-实例名称为"CNI"的实例信息。

输入:

http://kec.{{region}}.api.ksyun.com/?Action=DescribeInstances&Search=CNI&Version=2016-03-04

2)、返回模糊查询到的实例信息。

Response Elements(返回值)

RequestId

  • 请求ID
  • 类型: String
  • 是否可缺省: 否

Marker

  • 分页标识,如果调用未返回全部实例,标记下次调用的返回值的起点,如果已返回全部实例,则其值为0
  • 类型: Integer
  • 是否可缺省: 否

InstanceCount

  • 实例总数
  • 类型: Integer
  • 是否可缺省: 否

InstancesSet

  • 实例集合
  • 类型: 实例类型列表
  • 是否可缺省: 否

Examples(例子)

1)、描述cn-beijing-6这个region的实例信息,默认显示10个实例;如果想显示该Region下所有实例,需要增加输入参数MaxResults=1000,即单次调用最多可以显示1000个实例;增加输入参数Marker=0,即单次调用未返回全部实例时,标记下次调用的返回值的起点从0开始;

Sample Request(请求)
http://kec.{{region}}.api.ksyun.com/?Action=DescribeInstances&Version=2016-03-04&MaxResults=1000&Marker=0
Sample Response(返回)
{
    "Marker": 0,
    "InstanceCount": 5,
    "RequestId": "e971a15b-b59a-4477-a655-97c60e35d101",
    "InstancesSet": [
        {
            "InstanceId": "19c61e7e-c604-43ec-b225-3677f4f2eaf6",
            "ProjectId": 0,
            "InstanceName": "SOHO_A",
            "InstanceType": "I1.1A",
            "InstanceConfigure": {
                "VCPU": 1,
                "GPU": 0,
                "MemoryGb": 1,
                "DataDiskGb": 0,
                "RootDiskGb": 20,
                "DataDiskType": "SSD"
            },
            "ImageId": "d6725701-bf67-49a0-90cd-ff9ed0ec3a41",
            "SubnetId": "6c296896-b72a-40fe-8854-4c7673d172fd",
            "PrivateIpAddress": "172.17.11.9",
            "InstanceState": {
                "Name": "active"
            },
            "Monitoring": {
                "State": "enabled"
            },
            "DataDisks": {
                "DiskId": "a31bfds3-914c-485e-a8b4-42grt4g65c84",
                "DiskType": "SSD3.0",
                "DiskSize": 50,
                "DeleteWithInstance": false
            },
            "DataGuard": {
                "DataGuardId": "1dd16h2f-2gt4-4d40-9997-3033b4f7ie22",
                "DataGuardName": "test1019" 
            }
            "NetworkInterfaceSet": [
                {
                    "NetworkInterfaceId": "1b199937-542e-45a5-990f-bff22b4ac82b",
                    "NetworkInterfaceType": "primary",
                    "VpcId": "6a2459b0-6555-4f55-9179-79b7c119631a",
                    "SubnetId": "6c296896-b72a-40fe-8854-4c7673d172fd",
                    "MacAddress": "fa:16:3e:4d:ca:b3",
                    "PrivateIpAddress": "172.17.11.9",
                    "PublicIp": "120.92.50.132",
                    "Ipv6PublicIpAddressSet": [
                        {
                            "Ipv6PublicIpAddress": "24d1:1d50:f21:43ba::379"
                        }
                    ],
                    "GroupSet": [
                        {
                            "GroupId": "93d913fe-b6c0-43f6-a4b7-2c9b4f1a5174"
                        }
                    ],
                    "AllocationId": "ea9aa168-c45e-4ed3-bb5b-f58f4769d920",
                    "SecurityGroupSet": [
                        {
                            "SecurityGroupId": "93d913fe-b6c0-43f6-a4b7-2c9b4f1a5174"
                        }
                    ]
                }
            ],
            "SriovNetSupport": "false",
            "IsShowSriovNetSupport": false,
            "CreationDate": "2018-08-22T17:56:52Z",
            "AvailabilityZone": "cn-beijing-6a",
            "AvailabilityZoneName": "可用区A",
            "AutoScalingType": "Auto",
            "ProductType": 41,
            "ProductWhat": 1,
            "ChargeType": "PostPaidByHour"
            "SystemDisk": {
                "DiskType": "Local_SSD",
                "DiskSize": 50
        },
        {
            "InstanceId": "30414a24-18c7-4b2d-b808-b2020855b804",
            "ProjectId": 0,
            "InstanceName": "docker_no_delete",
            "InstanceType": "I2.2C",
            "InstanceConfigure": {
                "VCPU": 2,
                "GPU": 0,
                "MemoryGb": 8,
                "DataDiskGb": 50,
                "RootDiskGb": 20,
                "DataDiskType": "SSD"
            },
            "ImageId": "e6c6c90b-ac7e-427f-a3d5-7c27fc1bec17",
            "SubnetId": "7e23b980-11c2-4bb0-9388-9215ac09c539",
            "PrivateIpAddress": "10.0.22.14",
            "InstanceState": {
                "Name": "active"
            },
            "Monitoring": {
                "State": "enabled"
            },
            "NetworkInterfaceSet": [
                {
                    "NetworkInterfaceId": "1aa3c101-03d8-4a20-8478-809d10d592ac",
                    "NetworkInterfaceType": "primary",
                    "VpcId": "31e21dca-c92e-4b06-a8ce-3560afa63462",
                    "SubnetId": "7e23b980-11c2-4bb0-9388-9215ac09c539",
                    "MacAddress": "fa:16:3e:1a:05:fa",
                    "PrivateIpAddress": "10.0.22.14",
                    "GroupSet": [
                        {
                            "GroupId": "d46c7672-7ca9-4f51-bbd9-0e28ccdf3fac"
                        }
                    ],
                    "SecurityGroupSet": [
                        {
                            "SecurityGroupId": "d46c7672-7ca9-4f51-bbd9-0e28ccdf3fac"
                        }
                    ]
                }
            ],
            "SriovNetSupport": "false",
            "IsShowSriovNetSupport": false,
            "CreationDate": "2018-08-02T10:18:49Z",
            "AvailabilityZone": "cn-beijing-6b",
            "AvailabilityZoneName": "可用区B",
            "ProductType": 78,
            "ProductWhat": 1,
            "ChargeType": "Daily",
            "KeySet": [
                "2186e15f-476a-41b6-adc9-dd255a4bcb36"
            ]
        },
        {
            "InstanceId": "4374b3ac-3f0e-44d8-96b9-400291eb31e5",
            "ProjectId": 0,
            "InstanceName": "TestVM-N2",
            "InstanceType": "N2.1A",
            "InstanceConfigure": {
                "VCPU": 1,
                "GPU": 0,
                "MemoryGb": 2,
                "DataDiskGb": 0,
                "RootDiskGb": 20,
                "DataDiskType": "SSD"
            },
            "ImageId": "f7753569-f788-4e59-8f69-348f29a3b4cb",
            "SubnetId": "03f70c27-b567-43fc-8b8b-c789b6cf9b48",
            "PrivateIpAddress": "172.31.20.7",
            "InstanceState": {
                "Name": "active"
            },
            "Monitoring": {
                "State": "enabled"
            },
            "NetworkInterfaceSet": [
                {
                    "NetworkInterfaceId": "79a723d6-12e6-4d8f-9ad8-51606822e2c5",
                    "NetworkInterfaceType": "primary",
                    "VpcId": "571b3641-022c-43d6-9544-828d19cdbb91",
                    "SubnetId": "03f70c27-b567-43fc-8b8b-c789b6cf9b48",
                    "MacAddress": "fa:16:3e:6e:a1:ce",
                    "PrivateIpAddress": "172.31.20.7",
                    "PublicIp": "120.92.50.138",
                    "GroupSet": [
                        {
                            "GroupId": "cfbcc927-eafc-4c54-b8c3-4a344fee66dd"
                        }
                    ],
                    "SecurityGroupSet": [
                        {
                            "SecurityGroupId": "cfbcc927-eafc-4c54-b8c3-4a344fee66dd"
                        }
                    ]
                }
            ],
            "SriovNetSupport": "false",
            "IsShowSriovNetSupport": false,
            "CreationDate": "2018-08-29T19:25:53Z",
            "AvailabilityZone": "cn-beijing-6b",
            "AvailabilityZoneName": "可用区B",
            "ProductType": 137,
            "ProductWhat": 1,
            "ChargeType": "Daily",
            "KeySet": [
                "6ba2161e-ee9a-40b8-96b2-8f1b0801d301"
            ]
        },
        {
            "InstanceId": "4e8b5d26-34dd-4a2e-a1e8-93e66f9174db",
            "ProjectId": 0,
            "InstanceName": "docker_no_delete",
            "InstanceType": "I2.2B",
            "InstanceConfigure": {
                "VCPU": 2,
                "GPU": 0,
                "MemoryGb": 4,
                "DataDiskGb": 0,
                "RootDiskGb": 20,
                "DataDiskType": "SSD"
            },
            "ImageId": "e6c6c90b-ac7e-427f-a3d5-7c27fc1bec17",
            "SubnetId": "7e23b980-11c2-4bb0-9388-9215ac09c539",
            "PrivateIpAddress": "10.0.22.10",
            "InstanceState": {
                "Name": "active"
            },
            "Monitoring": {
                "State": "enabled"
            },
            "NetworkInterfaceSet": [
                {
                    "NetworkInterfaceId": "3f5ca8c2-29e0-4eb4-9a9f-f795a8943e46",
                    "NetworkInterfaceType": "primary",
                    "VpcId": "31e21dca-c92e-4b06-a8ce-3560afa63462",
                    "SubnetId": "7e23b980-11c2-4bb0-9388-9215ac09c539",
                    "MacAddress": "fa:16:3e:6a:e5:ff",
                    "PrivateIpAddress": "10.0.22.10",
                    "PublicIp": "120.92.52.138",
                    "GroupSet": [
                        {
                            "GroupId": "d46c7672-7ca9-4f51-bbd9-0e28ccdf3fac"
                        }
                    ],
                    "SecurityGroupSet": [
                        {
                            "SecurityGroupId": "d46c7672-7ca9-4f51-bbd9-0e28ccdf3fac"
                        }
                    ]
                }
            ],
            "SriovNetSupport": "false",
            "IsShowSriovNetSupport": false,
            "CreationDate": "2018-08-01T11:44:14Z",
            "AvailabilityZone": "cn-beijing-6b",
            "AvailabilityZoneName": "可用区B",
            "ProductType": 78,
            "ProductWhat": 1,
            "ChargeType": "Daily"
        },
        {
            "InstanceId": "dbef9d6d-a501-40b7-9518-508c7d3bcde3",
            "ProjectId": 0,
            "InstanceName": "SOHO_B",
            "InstanceType": "I1.1A",
            "InstanceConfigure": {
                "VCPU": 1,
                "GPU": 0,
                "MemoryGb": 1,
                "DataDiskGb": 0,
                "RootDiskGb": 20,
                "DataDiskType": "SSD"
            },
            "ImageId": "d3410864-1cf1-418f-9afe-c70aa3fa9cd4",
            "SubnetId": "950a7b88-f072-4d35-a302-975aaa170ad1",
            "PrivateIpAddress": "172.17.12.12",
            "InstanceState": {
                "Name": "active"
            },
            "Monitoring": {
                "State": "enabled"
            },
            "NetworkInterfaceSet": [
                {
                    "NetworkInterfaceId": "da34df08-03cc-4098-a143-64406a0eda50",
                    "NetworkInterfaceType": "primary",
                    "VpcId": "6a2459b0-6555-4f55-9179-79b7c119631a",
                    "SubnetId": "950a7b88-f072-4d35-a302-975aaa170ad1",
                    "MacAddress": "fa:16:3e:29:5c:eb",
                    "PrivateIpAddress": "172.17.12.12",
                    "GroupSet": [
                        {
                            "GroupId": "93d913fe-b6c0-43f6-a4b7-2c9b4f1a5174"
                        }
                    ],
                    "SecurityGroupSet": [
                        {
                            "SecurityGroupId": "93d913fe-b6c0-43f6-a4b7-2c9b4f1a5174"
                        }
                    ]
                }
            ],
            "SriovNetSupport": "false",
            "IsShowSriovNetSupport": false,
            "CreationDate": "2018-08-22T17:51:07Z",
            "AvailabilityZone": "cn-beijing-6b",
            "AvailabilityZoneName": "可用区B",
            "ProductType": 41,
            "ProductWhat": 1,
            "ChargeType": "PostPaidByHour"
        }
    ]
}

2)、通过Filter.N过滤器来描述CNI-1这个instance-name的实例信息;Filter.1.Name=instance-name表示有效值为instance-name-实例名称,Filter.1.Value.1=CNI-1表示instance-name-实例名称为“CNI-1”。

Sample Request(请求)
http://kec.{{region}}.api.ksyun.com/?Action=DescribeInstances&Filter.1.Name=instance-name&Filter.1.Value.1=CNI-1&Version=2016-03-04
Sample Response(返回)
{
  "DescribeInstancesResponse": {
    "-xmlns": "http://vm.ksyun.com/doc/2016-3-09/",
    "Marker": "0",
    "InstanceCount": "1",
    "RequestId": "a86a8445-2c40-4ab3-bdce-42f66a806435",
    "InstancesSet": {
      "Item": {
        "LiveUpgradeSupport": "false",
        "ChargeType": "HourlyInstantSettlement",
        "HostName": "vm10-0-3-76",
        "CabinetName": "cn-beijing-6c-1810",
        "RackName": "cn-beijing-6c-1810-1",
        "CrossMigrateAccess": "true",
        "AvailabilityZone": "cn-beijing-6c",
        "AvailabilityZoneName": "可用区C",
        "CreationDate": "2021-01-18T21:28:25Z",
        "ImageId": "ecd80c91-928b-4e42-831f-1b63c4fbfa29",
        "InstanceConfigure": {
          "DataDiskType": "SSD",
          "DataDiskGb": "0",
          "GPU": "0",
          "MemoryGb": "8",
          "RootDiskGb": "20",
          "VCPU": "4"
        },
        "InstanceId": "89ab170b-0bf0-44b2-a44d-99f26dbf7a0b",
        "InstanceName": "CNI-1",
        "InstanceState": {
          "CostTime": "42.559375",
          "TimeStamp": "1611577449933",
          "Name": "active",
          "timeStamp": "1611577449933"
        },
        "InstanceType": "C4.4B",
        "IsShowSriovNetSupport": "false",
        "Migration": "1",
        "Monitoring": { "State": "enabled" },
        "NetworkInterfaceSet": {
          "Item": [
            {
              "GroupSet": {
                "Item": { "GroupId": "a9ba4864-db20-4927-a848-32cdf748997b" }
              },
              "MacAddress": "fa:16:3e:32:73:b1",
              "NetworkInterfaceId": "8e24c93c-166a-44e9-a47f-be5bb1e9b4c0",
              "NetworkInterfaceType": "primary",
              "PrivateIpAddress": "10.0.3.76",
              "SecurityGroupSet": {
                "Item": { "SecurityGroupId": "a9ba4864-db20-4927-a848-32cdf748997b" }
              },
              "SubnetId": "13237c50-acb1-4436-8975-82e29df1564b",
              "VpcId": "a68e692c-8272-40d4-be45-1388a27318cf"
            },
            {
              "GroupSet": {
                "Item": { "GroupId": "a5c6078a-5863-47e2-8a4b-faf09686afbc" }
              },
              "MacAddress": "fa:16:3e:22:f9:65",
              "NetworkInterfaceId": "d21a2f32-2182-43d1-bc63-5f44a4e6b258",
              "NetworkInterfaceType": "extension",
              "PrivateIpAddress": "10.99.2.124",
              "SecurityGroupSet": {
                "Item": { "SecurityGroupId": "a5c6078a-5863-47e2-8a4b-faf09686afbc" }
              },
              "SubnetId": "34cac34c-fc21-410b-94e4-cf97fbf045e5",
              "VpcId": "2b6e5995-0047-4d2c-b7cf-446357e775d2"
            },
            {
              "GroupSet": {
                "Item": { "GroupId": "fcce7e32-d7d4-470e-929e-2baf6413c47b" }
              },
              "MacAddress": "fa:16:3e:25:eb:e2",
              "NetworkInterfaceId": "708561a7-2ac5-48ab-8822-438ec6b83dbd",
              "NetworkInterfaceType": "extension",
              "PrivateIpAddress": "10.0.2.185",
              "SecurityGroupSet": {
                "Item": { "SecurityGroupId": "fcce7e32-d7d4-470e-929e-2baf6413c47b" }
              },
              "SubnetId": "700e202b-94e1-422b-a2ab-e653823ed649",
              "VpcId": "36411d72-3d6d-4680-9815-c9ab8251a7ac"
            }
          ]
        },
        "PrivateIpAddress": "10.0.3.76",
        "ProductType": "347",
        "ProductWhat": "1",
        "projectId": "0",
        "SriovNetSupport": "false",
        "SubnetId": "13237c50-acb1-4436-8975-82e29df1564b",
        "SystemDisk": {
          "DiskType": "SSD3.0",
          "DiskSize": "20"
        }
      }
    }
  }
}

文档内容是否对您有帮助?

根本没帮助
文档较差
文档一般
文档不错
文档很好

在文档使用中是否遇到以下问题

  • 内容不全,不深入
  • 内容更新不及时
  • 描述不清晰,比较混乱
  • 系统或功能太复杂,缺乏足够的引导
  • 内容冗长

更多建议

0/200

评价建议不能为空

提交成功!

非常感谢您的反馈,我们会继续努力做到更好!

问题反馈