API 文档

获取实例相关信息

最近更新时间:2020-06-16 08:02:35

1. 接口描述

接口请求域名: ecm.tencentcloudapi.com 。

获取实例的相关信息。

默认接口请求频率限制:20次/秒。

推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数

参数名称 必选 类型 描述
Action String 公共参数,本接口取值:DescribeInstances。
Version String 公共参数,本接口取值:2019-07-19。
Region String 公共参数,本接口不需要传递此参数。
Filters.N Array of Filter 过滤条件。
zone String 是否必填:否 (过滤条件)按照可用区英文标识符过滤。
zone-name String 是否必填:否 (过滤条件)按照可用区中文名过滤,支持模糊匹配。
module-id String 是否必填:否 (过滤条件)按照模块ID过滤。
instance-id String 是否必填:否 (过滤条件)按照实例ID过滤。
instance-name String 是否必填:否 (过滤条件)按照实例名称过滤,支持模糊匹配。
ip-address String 是否必填:否 (过滤条件)按照实例的内网/公网IP过滤。
instance-uuid string 是否必填:否 (过滤条件)按照uuid过滤实例列表。
instance-state string 是否必填:否 (过滤条件)按照实例状态更新实例列表。
internet-service-provider String 是否必填:否 (过滤条件)按照实例公网IP所属的运营商进行过滤。
tag-key String 是否必填:否 (过滤条件)按照标签键进行过滤。
tag:tag-key String 是否必填:否 (过滤条件)按照标签键值对进行过滤。 tag-key使用具体的标签键进行替换。
instance-family String 是否必填:否 (过滤条件)按照机型family过滤。
module-name String 是否必填:否 (过滤条件)按照模块名称过滤,支持模糊匹配。
image-id String 是否必填:否 (过滤条件)按照实例的镜像ID过滤。

若不传Filters参数则表示查询所有相关的实例信息。
单次请求的Filter.Values的上限为5。
Offset Integer 偏移量,默认为0。
Limit Integer 返回数量,默认为20(如果查询结果数目大于等于20),最大值为100。
OrderByField String 指定排序字段。目前支持的可选值如下
timestamp 按实例创建时间排序。
注意:目前仅支持按创建时间排序,后续可能会有扩展。
如果不传,默认按实例创建时间排序
OrderDirection Integer 指定排序是降序还是升序。0表示降序; 1表示升序。如果不传默认为降序

3. 输出参数

参数名称 类型 描述
TotalCount Integer 返回的实例相关信息列表的长度。
InstanceSet Array of Instance 返回的实例相关信息列表。
注意:此字段可能返回 null,表示取不到有效值。
RequestId String 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。

4. 示例

示例1 通过过滤条件获取实例信息

通过指定过滤条件来获取实例的信息。

输入示例

https://ecm.tencentcloudapi.com/?Action=DescribeInstances
&<公共请求参数>

输出示例

{
  "Response": {
    "RequestId": "187c16d5-1f53-4e88-b684-077f0c7369b2",
    "TotalCount": 5,
    "InstanceSet": [
      {
        "InstanceId": "ein-23rec1ee",
        "InstanceName": "",
        "InstanceState": "RUNNING",
        "CreateTime": "2020-03-16 21:16:41",
        "SimpleModule": {
          "ModuleId": "em-eedttqfb",
          "ModuleName": "test1"
        },
        "Internet": {
          "PrivateIPAddressSet": [
            {
              "PrivateIPAddress": "10.212.0.5"
            }
          ],
          "PublicIPAddressSet": [
            {
              "ChargeMode": "",
              "MaxBandwidthOut": 106,
              "PublicIPAddress": "220.181.91.200",
              "ISP": {
                "ISPId": "CTCC",
                "ISPName": "电信"
              }
            }
          ]
        },
        "RestrictState": "NORMAL",
        "Image": {
          "ImageId": "img-oikl1tzv",
          "ImageName": "CentOS 7.5 64位",
          "ImageState": "NORMAL",
          "ImageType": "PUBLIC_IMAGE",
          "ImageOwner": 0,
          "ImageOsName": "CentOS 7.5 64位",
          "ImageDescription": "CentOS 7.5 64位",
          "Architecture": "x86_64",
          "OsType": "linux",
          "Platform": "CentOS",
          "OsVersion": "7.5.0",
          "ImageCreateTime": "",
          "ImageSize": 50
        },
        "Position": {
          "ZoneInfo": {
            "ZoneId": 10150001,
            "ZoneName": "北京三区(电信)",
            "Zone": "ap-beijing-ecm-ct-1"
          },
          "Country": {
            "CountryId": "china",
            "CountryName": "中国"
          },
          "Area": {
            "AreaId": "china-north",
            "AreaName": "华北"
          },
          "Province": {
            "ProvinceId": "china-north-beijing",
            "ProvinceName": "北京"
          },
          "City": {
            "CityId": "china-north-beijing-beijing",
            "CityName": "北京"
          },
          "RegionInfo": {
            "RegionId": 0,
            "Region": "ap-beijing-ecm-ct",
            "RegionName": "北京电信"
          }
        },
        "InstanceTypeConfig": {
          "InstanceFamilyConfig": {
            "InstanceFamilyName": "标准网络优化型",
            "InstanceFamily": "SN3ne"
          },
          "InstanceFamilyTypeConfig": {
            "InstanceFamilyType": "S",
            "InstanceFamilyTypeName": "标准型"
          },
          "InstanceType": "SN3ne.2XLARGE16",
          "Vcpu": 8,
          "Memory": 16,
          "Frequency": "2.5 GHz",
          "CpuModelName": "Intel Xeon Skylake 6133",
          "ExtInfo": ""
        },
        "SystemDiskSize": 50,
        "DataDiskSize": 48,
        "LatestOperation": "",
        "LatestOperationState": "",
        "TagSet": null,
        "UUID": "4ef19d31-3117-455c-ae8e-2029a07d8999",
        "PayMode": 0,
        "ExpireTime": "2020-03-16 21:16:41",
        "IsolatedTime": "2020-03-16 21:16:41",
        "RenewFlag": 0,
        "ExpireState": "NORMAL",
        "SystemDisk": {
          "DiskType": "LOCAL_BASIC",
          "DiskId": "ldisk-jdlx2ql1",
          "DiskSize": 50
        },
        "DataDisks": [
          {
            "DiskType": "LOCAL_BASIC",
            "DiskId": "ldisk-i1aw1prp",
            "DiskSize": 48
          }
        ]
      },
      {
        "InstanceId": "ein-9fvddj0y",
        "InstanceName": "",
        "InstanceState": "RUNNING",
        "CreateTime": "2020-03-16 11:29:21",
        "SimpleModule": {
          "ModuleId": "em-eedttqfb",
          "ModuleName": "test1"
        },
        "Internet": {
          "PrivateIPAddressSet": [
            {
              "PrivateIPAddress": "10.212.0.14"
            }
          ],
          "PublicIPAddressSet": [
            {
              "ChargeMode": "",
              "MaxBandwidthOut": 106,
              "PublicIPAddress": "112.19.6.224",
              "ISP": {
                "ISPId": "CMCC",
                "ISPName": "移动"
              }
            }
          ]
        },
        "RestrictState": "NORMAL",
        "Image": {
          "ImageId": "img-oikl1tzv",
          "ImageName": "CentOS 7.5 64位",
          "ImageState": "NORMAL",
          "ImageType": "PUBLIC_IMAGE",
          "ImageOwner": 0,
          "ImageOsName": "CentOS 7.5 64位",
          "ImageDescription": "CentOS 7.5 64位",
          "Architecture": "x86_64",
          "OsType": "linux",
          "Platform": "CentOS",
          "OsVersion": "7.5.0",
          "ImageCreateTime": "",
          "ImageSize": 50
        },
        "Position": {
          "ZoneInfo": {
            "ZoneId": 10300001,
            "ZoneName": "成都二区(移动)",
            "Zone": "ap-chengdu-ecm-cm-1"
          },
          "Country": {
            "CountryId": "china",
            "CountryName": "中国"
          },
          "Area": {
            "AreaId": "china-southwest",
            "AreaName": "西南"
          },
          "Province": {
            "ProvinceId": "china-southwest-sichuan",
            "ProvinceName": "四川"
          },
          "City": {
            "CityId": "china-southwest-sichuan-chengdu",
            "CityName": "成都"
          },
          "RegionInfo": {
            "RegionId": 0,
            "Region": "ap-chengdu-ecm-cm",
            "RegionName": "成都移动"
          }
        },
        "InstanceTypeConfig": {
          "InstanceFamilyConfig": {
            "InstanceFamilyName": "标准网络优化型",
            "InstanceFamily": "SN3ne"
          },
          "InstanceFamilyTypeConfig": {
            "InstanceFamilyType": "S",
            "InstanceFamilyTypeName": "标准型"
          },
          "InstanceType": "SN3ne.2XLARGE16",
          "Vcpu": 8,
          "Memory": 16,
          "Frequency": "2.5 GHz",
          "CpuModelName": "Intel Xeon Skylake 6133",
          "ExtInfo": ""
        },
        "SystemDiskSize": 50,
        "DataDiskSize": 48,
        "LatestOperation": "",
        "LatestOperationState": "",
        "TagSet": null,
        "UUID": "78cdd9df-1a70-4c30-aa1d-3fabd9f5391a",
        "PayMode": 0,
        "ExpireTime": "2020-03-16 11:29:21",
        "IsolatedTime": "2020-03-16 11:29:21",
        "RenewFlag": 0,
        "ExpireState": "NORMAL",
        "SystemDisk": {
          "DiskType": "LOCAL_BASIC",
          "DiskId": "ldisk-eoqr81g1",
          "DiskSize": 50
        },
        "DataDisks": [
          {
            "DiskType": "LOCAL_BASIC",
            "DiskId": "ldisk-b1qxd0fz",
            "DiskSize": 48
          }
        ]
      },
      {
        "InstanceId": "ein-6xxfmraq",
        "InstanceName": "aaa1",
        "InstanceState": "RUNNING",
        "CreateTime": "2020-03-13 01:32:33",
        "SimpleModule": {
          "ModuleId": "em-eedttqfb",
          "ModuleName": "test1"
        },
        "Internet": {
          "PrivateIPAddressSet": [
            {
              "PrivateIPAddress": "10.212.0.3"
            }
          ],
          "PublicIPAddressSet": [
            {
              "ChargeMode": "",
              "MaxBandwidthOut": 106,
              "PublicIPAddress": "111.13.71.94",
              "ISP": {
                "ISPId": "CMCC",
                "ISPName": "移动"
              }
            }
          ]
        },
        "RestrictState": "NORMAL",
        "Image": {
          "ImageId": "img-oikl1tzv",
          "ImageName": "CentOS 7.5 64位",
          "ImageState": "NORMAL",
          "ImageType": "PUBLIC_IMAGE",
          "ImageOwner": 0,
          "ImageOsName": "CentOS 7.5 64位",
          "ImageDescription": "CentOS 7.5 64位",
          "Architecture": "x86_64",
          "OsType": "linux",
          "Platform": "CentOS",
          "OsVersion": "7.5.0",
          "ImageCreateTime": "",
          "ImageSize": 50
        },
        "Position": {
          "ZoneInfo": {
            "ZoneId": 10170001,
            "ZoneName": "北京一区(移动)",
            "Zone": "ap-beijing-ecm-cm-1"
          },
          "Country": {
            "CountryId": "china",
            "CountryName": "中国"
          },
          "Area": {
            "AreaId": "china-north",
            "AreaName": "华北"
          },
          "Province": {
            "ProvinceId": "china-north-beijing",
            "ProvinceName": "北京"
          },
          "City": {
            "CityId": "china-north-beijing-beijing",
            "CityName": "北京"
          },
          "RegionInfo": {
            "RegionId": 0,
            "Region": "ap-beijing-ecm-cm",
            "RegionName": "北京移动"
          }
        },
        "InstanceTypeConfig": {
          "InstanceFamilyConfig": {
            "InstanceFamilyName": "标准网络优化型",
            "InstanceFamily": "SN3ne"
          },
          "InstanceFamilyTypeConfig": {
            "InstanceFamilyType": "S",
            "InstanceFamilyTypeName": "标准型"
          },
          "InstanceType": "SN3ne.2XLARGE16",
          "Vcpu": 8,
          "Memory": 16,
          "Frequency": "2.5 GHz",
          "CpuModelName": "Intel Xeon Skylake 6133",
          "ExtInfo": ""
        },
        "SystemDiskSize": 50,
        "DataDiskSize": 48,
        "LatestOperation": "",
        "LatestOperationState": "",
        "TagSet": null,
        "UUID": "a3e19561-92a4-4143-abfa-1ad71991cb58",
        "PayMode": 0,
        "ExpireTime": "2020-03-13 01:32:33",
        "IsolatedTime": "2020-03-13 01:32:33",
        "RenewFlag": 0,
        "ExpireState": "NORMAL",
        "SystemDisk": {
          "DiskType": "LOCAL_BASIC",
          "DiskId": "ldisk-qifk2cqb",
          "DiskSize": 50
        },
        "DataDisks": [
          {
            "DiskType": "LOCAL_BASIC",
            "DiskId": "ldisk-d49f594v",
            "DiskSize": 48
          }
        ]
      },
      {
        "InstanceId": "ein-6d6lnouo",
        "InstanceName": "test1",
        "InstanceState": "RUNNING",
        "CreateTime": "2020-03-10 17:47:47",
        "SimpleModule": {
          "ModuleId": "em-w32agsp5",
          "ModuleName": "test2"
        },
        "Internet": {
          "PrivateIPAddressSet": [
            {
              "PrivateIPAddress": "10.212.0.15"
            }
          ],
          "PublicIPAddressSet": [
            {
              "ChargeMode": "",
              "MaxBandwidthOut": 100,
              "PublicIPAddress": "183.232.83.98",
              "ISP": {
                "ISPId": "CMCC",
                "ISPName": "移动"
              }
            }
          ]
        },
        "RestrictState": "NORMAL",
        "Image": {
          "ImageId": "img-9qabwvbn",
          "ImageName": "CentOS 7.6 64位",
          "ImageState": "NORMAL",
          "ImageType": "PUBLIC_IMAGE",
          "ImageOwner": 0,
          "ImageOsName": "CentOS 7.6 64位",
          "ImageDescription": "CentOS 7.6 64位",
          "Architecture": "x86_64",
          "OsType": "linux",
          "Platform": "CentOS",
          "OsVersion": "7.6.0",
          "ImageCreateTime": "",
          "ImageSize": 50
        },
        "Position": {
          "ZoneInfo": {
            "ZoneId": 10270001,
            "ZoneName": "深圳二区(移动)",
            "Zone": "ap-shenzhen-ecm-cm-1"
          },
          "Country": {
            "CountryId": "china",
            "CountryName": "中国"
          },
          "Area": {
            "AreaId": "china-south",
            "AreaName": "华南"
          },
          "Province": {
            "ProvinceId": "china-south-guangdong",
            "ProvinceName": "广东"
          },
          "City": {
            "CityId": "china-south-guangdong-shenzhen",
            "CityName": "深圳"
          },
          "RegionInfo": {
            "RegionId": 0,
            "Region": "ap-shenzhen-ecm-cm",
            "RegionName": "深圳移动"
          }
        },
        "InstanceTypeConfig": {
          "InstanceFamilyConfig": {
            "InstanceFamilyName": "标准网络优化型",
            "InstanceFamily": "SN3ne"
          },
          "InstanceFamilyTypeConfig": {
            "InstanceFamilyType": "S",
            "InstanceFamilyTypeName": "标准型"
          },
          "InstanceType": "SN3ne.LARGE8",
          "Vcpu": 4,
          "Memory": 8,
          "Frequency": "2.5 GHz",
          "CpuModelName": "Intel Xeon Skylake 6133",
          "ExtInfo": ""
        },
        "SystemDiskSize": 50,
        "DataDiskSize": 50,
        "LatestOperation": "",
        "LatestOperationState": "",
        "TagSet": null,
        "UUID": "1c769bf4-97c4-4790-9d81-45f1fc5a53f7",
        "PayMode": 0,
        "ExpireTime": "2020-03-10 17:47:47",
        "IsolatedTime": "2020-03-10 17:47:47",
        "RenewFlag": 0,
        "ExpireState": "NORMAL",
        "SystemDisk": {
          "DiskType": "LOCAL_BASIC",
          "DiskId": "ldisk-53vdxv15",
          "DiskSize": 50
        },
        "DataDisks": [
          {
            "DiskType": "LOCAL_BASIC",
            "DiskId": "ldisk-39dapvnj",
            "DiskSize": 50
          }
        ]
      },
      {
        "InstanceId": "ein-1r8a5msw",
        "InstanceName": "",
        "InstanceState": "RUNNING",
        "CreateTime": "2020-02-14 04:32:10",
        "SimpleModule": {
          "ModuleId": "em-317xx08p",
          "ModuleName": "test3"
        },
        "Internet": {
          "PrivateIPAddressSet": [
            {
              "PrivateIPAddress": "10.212.0.13"
            }
          ],
          "PublicIPAddressSet": [
            {
              "ChargeMode": "",
              "MaxBandwidthOut": 534,
              "PublicIPAddress": "183.60.23.126",
              "ISP": {
                "ISPId": "CTCC",
                "ISPName": "电信"
              }
            }
          ]
        },
        "RestrictState": "NORMAL",
        "Image": {
          "ImageId": "img-9qabwvbn",
          "ImageName": "CentOS 7.6 64位",
          "ImageState": "NORMAL",
          "ImageType": "PUBLIC_IMAGE",
          "ImageOwner": 0,
          "ImageOsName": "CentOS 7.6 64位",
          "ImageDescription": "CentOS 7.6 64位",
          "Architecture": "x86_64",
          "OsType": "linux",
          "Platform": "CentOS",
          "OsVersion": "7.6.0",
          "ImageCreateTime": "",
          "ImageSize": 50
        },
        "Position": {
          "ZoneInfo": {
            "ZoneId": 10250001,
            "ZoneName": "深圳一区(电信)",
            "Zone": "ap-shenzhen-ecm-ct-1"
          },
          "Country": {
            "CountryId": "china",
            "CountryName": "中国"
          },
          "Area": {
            "AreaId": "china-south",
            "AreaName": "华南"
          },
          "Province": {
            "ProvinceId": "china-south-guangdong",
            "ProvinceName": "广东"
          },
          "City": {
            "CityId": "china-south-guangdong-shenzhen",
            "CityName": "深圳"
          },
          "RegionInfo": {
            "RegionId": 0,
            "Region": "ap-shenzhen-ecm-ct",
            "RegionName": "深圳电信"
          }
        },
        "InstanceTypeConfig": {
          "InstanceFamilyConfig": {
            "InstanceFamilyName": "标准型S3",
            "InstanceFamily": "S3"
          },
          "InstanceFamilyTypeConfig": {
            "InstanceFamilyType": "S",
            "InstanceFamilyTypeName": "标准型"
          },
          "InstanceType": "S3.2XLARGE16",
          "Vcpu": 8,
          "Memory": 16,
          "Frequency": "2.5 GHz",
          "CpuModelName": "Intel Xeon Skylake 6133",
          "ExtInfo": ""
        },
        "SystemDiskSize": 50,
        "DataDiskSize": 49,
        "LatestOperation": "RebootInstances",
        "LatestOperationState": "SUCCESS",
        "TagSet": null,
        "UUID": "fa7eae71-8226-4487-bd1b-0b603e0fddac",
        "PayMode": 0,
        "ExpireTime": "2020-02-14 04:32:10",
        "IsolatedTime": "2020-02-14 04:32:10",
        "RenewFlag": 0,
        "ExpireState": "NORMAL",
        "SystemDisk": {
          "DiskType": "LOCAL_BASIC",
          "DiskId": "ldisk-4ho5ndqp",
          "DiskSize": 50
        },
        "DataDisks": [
          {
            "DiskType": "LOCAL_BASIC",
            "DiskId": "ldisk-4grf00np",
            "DiskSize": 49
          }
        ]
      }
    ]
  }
}

5. 开发者资源

API Explorer

该工具提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力,能显著降低使用云 API 的难度,推荐使用。

SDK

云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。

命令行工具

6. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码

错误码 描述
FailedOperation.InternalOperationFailure 内部操作错误。
InvalidParameter.InvalidDataFormat 数据格式不正确。
InvalidParameterValue.InvaildDescribeInstance 您的输入有误或无相应的操作权限。
InvalidParameterValue.InvaildPageParam 分页参数不合法。
InvalidParameterValue.InvalidFilter 无效过滤器。
InvalidParameterValue.InvalidInstanceID 实例ID不合法
InvalidParameterValue.ParameterValueTooLarge 参数值超出限制。
ResourceNotFound.InstanceNotExist 实例不合法。
UnauthorizedOperation.ForbiddenOperation 没有权限进行该操作。
目录