调用DescribeContainerGroups批量查询ECI实例的信息。
接口说明
- 当 ECI 实例运行终止后,底层计算资源将会被回收。随实例一起创建的其它资源(例如 EIP 等)默认随实例一起释放。
- 终态(处于 Failed、Succeeded 或 Expired 状态)实例的元数据信息的保留情况如下:
- 1 小时内的实例信息全部保留。
- 超出 1 小时的实例仅保留最近的 100 条(单个地域分别计算)。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
下表是API对应的授权信息,可以在RAM权限策略语句的Action
元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:
- 操作:是指具体的权限点。
- 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
- 资源类型:是指操作中支持授权的资源类型。具体说明如下:
- 对于必选的资源类型,用背景高亮的方式表示。
- 对于不支持资源级授权的操作,用
全部资源
表示。
- 条件关键字:是指云产品自身定义的条件关键字。
- 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作 | 访问级别 | 资源类型 | 条件关键字 | 关联操作 |
---|---|---|---|---|
eci:DescribeContainerGroups | get | *ContainerGroup acs:eci:{#regionId}:{#accountId}:containergroup/* *ContainerGroup acs:eci:{#regionId}:{#accountId}:containergroup/{#containergroupId} |
| 无 |
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
RegionId | string | 是 | 实例所属的地域 ID。 | cn-hangzhou |
ZoneId | string | 否 | 实例所属的可用区。如果取值为空,则表示由系统选择。 默认值为空。 | cn-hangzhou-h |
VSwitchId | string | 否 | 实例所属的虚拟交换机 ID。 | vsw-bp1jrgfqqy54kg5hc**** |
NextToken | string | 否 | 下一个查询开始的 Token,NextToken 为空表示没有下一个。 说明
首次查询时无需设置该参数,后续查询的 Token 从返回结果中获取。
| d78f2dd8-5979-42fe-****-b16db43be5bc |
Limit | integer | 否 | 限定此次返回资源的数量。如果不设置,默认返回 20 个,最大不能超过 20 个。 说明
返回结果可能小于指定的数量,但不会多于指定的数量。
| 20 |
ContainerGroupIds | string | 否 | 实例 ID 序列。最多 20 个,字符串需按照 JSON 格式传入。 | ["eci-bp17gw49eu09yiwm****", "eci-bp19aq49du01abcm****", "eci-2zegym1qhbmdfr1s****"] |
ContainerGroupName | string | 否 | 实例名称,即容器组名称。 | test |
Status | string | 否 | 实例状态。取值范围:
| Running |
ResourceGroupId | string | 否 | 实例所属的资源组 ID。 | rg-aekzh43v***** |
WithEvent | boolean | 否 | 是否返回事件信息。 | true |
Tag | array<object> | 否 | 实例标签信息。 | |
object | 否 | 实例标签信息。 | ||
Key | string | 否 | 实例标签键。 | name |
Value | string | 否 | 实例标签值。 | test |
ComputeCategory | string | 否 | 指定算力类别。取值范围:
| economy |
SecurityGroupId | string | 否 | 实例所属的安全组 ID。 | sg-uf66jeqopgqa9hdn**** |
返回参数
示例
正常返回示例
JSON
格式
{
"TotalCount": 1,
"NextToken": "d78f2dd8-5979-42fe-****-b16db43be5bc",
"RequestId": "89945DD3-9072-47D0-A318-353284CFC7B3",
"ContainerGroups": [
{
"Status": "Running",
"CreationTime": "2018-08-02T15:00:00Z",
"VpcId": "vpc-1vzjjflab6wvjox****",
"InternetIp": "192.0.XX.XX",
"TenantSecurityGroupId": "sg-xxx",
"SecurityGroupId": "sg-bp12ujq5zpxuyjfo3o8r",
"HostAliases": [
{
"Hostnames": [
"['hehe.com', 'haha.com']"
],
"Ip": "192.0.XX.XX"
}
],
"Tags": [
{
"Key": "name",
"Value": "test-xh"
}
],
"Events": [
{
"Type": "Normal",
"LastTimestamp": "2018-08-02T15:00:00Z",
"Message": "Started container",
"Name": "test-xxx",
"Reason": "Created",
"Count": 20,
"FirstTimestamp": "2018-08-02T15:00:00Z"
}
],
"SucceededTime": "2019-12-11T04:33:42Z",
"SpotStrategy": "NoSpot",
"SpotPriceLimit": 0.025,
"EphemeralStorage": 20,
"TenantEniInstanceId": "i-xxx",
"Discount": 9,
"RestartPolicy": "Never",
"Memory": 4,
"TenantVSwitchId": "vsw-xxx",
"Containers": [
{
"LivenessProbe": {
"SuccessThreshold": 1,
"InitialDelaySeconds": 10,
"FailureThreshold": 3,
"TimeoutSeconds": 10,
"TcpSocket": {
"Host": "1.2.3.4",
"Port": 80
},
"Execs": [
"[\"/bin/sh\", \"-c\", \"echo Hello world > /usr/share/message\"]"
],
"HttpGet": {
"Scheme": "HTTP",
"Path": "/usr/nginx/",
"Port": 80
},
"PeriodSeconds": 5
},
"Commands": [
"[/bin/sh echo]"
],
"VolumeMounts": [
{
"MountPropagation": "None",
"MountPath": "/usr/share/",
"ReadOnly": false,
"Name": "test-empty",
"SubPath": "/usr/sub"
}
],
"Args": [
"[\"hello\"]"
],
"Image": "mysql",
"Ports": [
{
"Protocol": "TCP",
"Port": 8080
}
],
"RestartCount": 0,
"ImagePullPolicy": "Always",
"StdinOnce": true,
"Cpu": 2,
"PreviousState": {
"StartTime": "2021-12-02T15:00:00Z",
"FinishTime": "2021-12-02T15:01:00Z",
"DetailStatus": "working",
"State": "Terminated",
"Message": "Back-off 5m0s restarting failed container=test pod=test_eci-xxx(xxx)",
"Signal": 1,
"ExitCode": 0,
"Reason": "Completed"
},
"Tty": false,
"WorkingDir": "/usr/local/nginx",
"CurrentState": {
"StartTime": "2021-12-02T15:00:00Z",
"FinishTime": "2021-12-02T15:01:00Z",
"DetailStatus": "working",
"State": "Terminated",
"Message": "Back-off 5m0s restarting failed container=test pod=test_eci-xxx(xxx)",
"Signal": 1,
"ExitCode": 0,
"Reason": "Started"
},
"Ready": true,
"Gpu": 1,
"SecurityContext": {
"ReadOnlyRootFilesystem": true,
"RunAsUser": 1000,
"Capability": {
"Adds": [
"[NET_ADMIN]"
]
}
},
"Memory": 2,
"Stdin": true,
"Name": "nginx",
"EnvironmentVars": [
{
"Key": "PATH",
"Value": "/usr/bin/",
"ValueFrom": {
"FieldRef": {
"FieldPath": "status.podIP"
}
}
}
],
"ReadinessProbe": {
"SuccessThreshold": 1,
"InitialDelaySeconds": 5,
"FailureThreshold": 3,
"TimeoutSeconds": 1,
"TcpSocket": {
"Host": "1.2.3.4",
"Port": 8888
},
"Execs": [
"[\"/bin/sh\", \"-c\", \"echo Hello world > /usr/share/message\"]"
],
"HttpGet": {
"Scheme": "HTTP",
"Path": "/usr/local",
"Port": 8080
},
"PeriodSeconds": 1
}
}
],
"EniInstanceId": "eni-bp14rzqi6fd8satm****",
"InitContainers": [
{
"VolumeMounts": [
{
"MountPropagation": "None",
"MountPath": "/usr/share/",
"ReadOnly": false,
"Name": "test-empty"
}
],
"Args": [
"['hello world']"
],
"Image": "nginx",
"Ports": [
{
"Protocol": "TCP",
"Port": 8888
}
],
"RestartCount": 5,
"ImagePullPolicy": "Always",
"PreviousState": {
"StartTime": "2021-12-02T15:00:00Z",
"FinishTime": "2021-12-02T15:01:00Z",
"DetailStatus": "working",
"State": "Terminated",
"Message": "Started container",
"Signal": 1,
"ExitCode": 0,
"Reason": "completed"
},
"WorkingDir": "/usr/test",
"Cpu": 1,
"CurrentState": {
"StartTime": "2021-12-02T15:00:00Z",
"FinishTime": "2021-12-02T15:01:00Z",
"DetailStatus": "working",
"State": "Running",
"Message": "Created container",
"Signal": 1,
"ExitCode": 0,
"Reason": "Started"
},
"Command": [
"[/bin/sh echo]"
],
"Ready": true,
"Gpu": 1,
"SecurityContext": {
"ReadOnlyRootFilesystem": true,
"RunAsUser": 1557,
"Capability": {
"Adds": [
"NET_ADMIN"
]
}
},
"Memory": 2,
"Name": "Init-xxx",
"EnvironmentVars": [
{
"Key": "PATH",
"Value": "/usr/local/bin",
"ValueFrom": {
"FieldRef": {
"FieldPath": "status.podIP"
}
}
}
]
}
],
"ContainerGroupId": "eci-bp1jrgfqqy54kg5hc****",
"TenantEniIp": "10.10.XX.XX",
"InstanceType": "ecs.g5.large",
"IntranetIp": "172.16.XX.XX",
"Ipv6Address": "2001:XXXX:4:4:4:4:4:4",
"RegionId": "cn-hangzhou",
"DnsConfig": {
"Searches": [
"svc.local.kubenetes"
],
"Options": [
{
"Value": "value",
"Name": "name"
}
],
"NameServers": [
"[10.2.*.*]"
]
},
"Volumes": [
{
"Type": "EmptyDirVolume",
"DiskVolumeDiskId": "d-xxxx",
"NFSVolumeReadOnly": false,
"ConfigFileVolumeConfigFileToPaths": [
{
"Path": "/usr/bin/",
"Content": "hello world"
}
],
"FlexVolumeFsType": "ntfs",
"FlexVolumeDriver": "flexvolume",
"DiskVolumeFsType": "xfs",
"FlexVolumeOptions": "[nolock,tcp,noresvport]",
"NFSVolumeServer": "0eafxxxxx-xxxxx.cn-hangzhou.nas.aliyuncs.com",
"NFSVolumePath": "/eci",
"Name": "test-empty",
"EmptyDirVolumeMedium": "Memory",
"EmptyDirVolumeSizeLimit": "256Mi"
}
],
"RamRoleName": "ram:PassRole",
"VSwitchId": "vsw-bp1vzjjflab6wvjox****",
"Cpu": 2,
"ExpiredTime": "2018-08-02T15:00:00Z",
"ResourceGroupId": "rg-8db03793gfrz****",
"ZoneId": "cn-hangzhou-h",
"ContainerGroupName": "test",
"EciSecurityContext": {
"Sysctls": [
{
"Value": "65536",
"Name": "kernel.msgmax"
}
]
},
"FailedTime": "2018-08-02T15:00:00Z",
"ComputeCategory": "economy",
"DnsPolicy": "None"
}
]
}
错误码
HTTP status code | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InvalidParameter.MismatchInstanceType | The instanceId mismatch instance type. | 实例类型错误 |
访问错误中心查看更多错误码。
变更历史
变更时间 | 变更内容概要 | 操作 |
---|---|---|
2024-09-26 | OpenAPI 错误码发生变更、OpenAPI 返回结构发生变更 | 查看变更详情 |
2024-09-04 | OpenAPI 错误码发生变更 | 查看变更详情 |
2023-12-27 | OpenAPI 入参发生变更 | 查看变更详情 |
2023-12-25 | OpenAPI 入参发生变更、OpenAPI 返回结构发生变更 | 查看变更详情 |
2023-04-17 | OpenAPI 返回结构发生变更 | 查看变更详情 |
2023-04-04 | OpenAPI 返回结构发生变更 | 查看变更详情 |