ListEcsInstances

Updated at:

Queries a list of ECS instances in the VPC and vSwitch of the current user.

Operation description

Important Before you call this API operation, you must create the AliyunElasticsearchAccessingOOSRole and AliyunOOSAccessingECS4ESRole system service roles. These roles allow the Elasticsearch service account to obtain ECS access permissions of the Alibaba Cloud account. For more information, see Collect ECS service logs.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

elasticsearch:ListCollectors

get

*All Resource

*

None None

Request syntax

GET /openapi/ecs HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

page

integer

No

The page number of the returned results. Maximum value: 500.

1

size

integer

No

The number of results per page. Default value: 10. Maximum value: 500.

10

ecsInstanceIds

string

No

The list of ECS instance IDs. The value can be a JSON array that consists of multiple instance IDs. You can specify up to 100 IDs. Separate multiple IDs with commas (,).

["i-bp13y63575oypr9d****","i-bp1gyhphjaj73jsr****"]

ecsInstanceName

string

No

The name of the ECS instance.

test

tags

string

No

Instance tags of the ECS instance. A tag must contain the following fields:

  • tagKey: instance tag key

  • tagValue: instance tag value

[{ "tagKey":"a","tagValue":"b"}]

vpcId

string

No

The ID of the VPC where the ECS instance resides.

vpc-bp16k1dvzxtmagcva****

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1D***

Headers

object

The response headers.

X-Total-Count

integer

The number of returned records.

11

Result

array<object>

The returned results.

array<object>

ecsInstanceId

string

The ECS instance ID.

i-bp14ncqge8wy3l3d****

collectors

array<object>

The list of collectors on the ECS instance.

array<object>

configs

array<object>

The configuration file information of the collector.

object

fileName

string

The name of the file.

fields.yml

content

string

The content of the file.

- key: log\n title: Log file content\n description: >\n Contains log file lines.\n ....

dryRun

boolean

Specifies whether to verify and create the collector. Valid values:

  • true: Verifies the collector but does not create it.

  • false: Verifies and creates the collector.

false

resType

string

The type of the collector. Valid values: fileBeat, metricBeat, heartBeat, and auditBeat.

fileBeat

ownerId

string

The ID of the account.

16852***488*****

resId

string

The collector instance ID.

ct-cn-0v3xj86085dvq****

collectorPaths

array

The list of Filebeat collection paths.

string

The Filebeat collection path.

["/var/log"]

gmtUpdateTime

string

The time when the collector was updated.

2020-06-20T07:26:47.000+0000

extendConfigs

array<object>

The extended parameter information.

array<object>

protocol

string

The transmission protocol, which must be consistent with the access protocol of the instance specified by the collector output. Valid values: HTTP and HTTPS. This parameter is displayed when configType is set to collectorTargetInstance.

HTTP

enableMonitoring

boolean

Specifies whether to enable monitoring. This parameter is displayed when configType is set to collectorTargetInstance and instanceType is set to elasticsearch. Valid values:

  • true: Enables monitoring.

  • false: Disables monitoring.

true

instanceId

string

Instance ID of the instance associated with the collector. When configType is set to collectorTargetInstance, this parameter indicates instance ID of the collector output instance. When configType is set to collectorDeployMachines and type is set to ACKCluster, this parameter indicates instance ID of the ACK cluster.

es-cn-nif1z89fz003i****

hosts

array

The list of host addresses of the collector target instance.

string

The list of access addresses of the instance specified by the collector output. This parameter is displayed when configType is set to collectorTargetInstance.

["es-cn-n6w1o1x*****.elasticsearch.aliyuncs.com:9200"]

groupId

string

The ID of the machine group. This parameter is displayed when configType is set to collectorDeployMachine.

default_ct-cn-5i2l75bz4776****

instanceType

string

The type of the instance specified by the collector output. Valid values: elasticsearch and logstash. This parameter is displayed when configType is set to collectorTargetInstance.

elasticsearch

machines

array<object>

The list of ECS instances on which the collector is deployed. This parameter is displayed when configType is set to collectorDeployMachines and type is set to ECSInstanceId.

object

instanceId

string

The list of ECS instance IDs.

i-bp13y63575oypr9d****

agentStatus

string

The status of each collector on the ECS instance. Valid values:

  • heartOk: normal heartbeat

  • heartLost: abnormal heartbeat

  • uninstalled: not installed

  • failed: installation failed

heartOk

configType

string

The configuration type. Valid values:

  • collectorTargetInstance: the collector output

  • collectorDeployMachine: the machine on which the collector is deployed

  • collectorElasticsearchForKibana: the information about the Elasticsearch instance that supports Kibana dashboards

collectorDeployMachine

userName

string

The username used to access the instance specified by the collector output. Default value: elastic. This parameter is displayed when configType is set to collectorTargetInstance or collectorElasticsearchForKibana.

elastic

type

string

The type of the machine on which the collector is deployed. This parameter is displayed when configType is set to collectorDeployMachine. Valid values:

  • ECSInstanceId: ECS instance

  • ACKCluster: ACK cluster

ECSInstanceId

resVersion

string

The version of the collector. When the machine type is ECS, only 6.8.5_with_community is supported.

6.8.5_with_community

vpcId

string

The ID of the VPC where the collector resides.

vpc-bp16k1dvzxtm******

name

string

The name of the collector.

ct-testAbc

gmtCreatedTime

string

The time when the collector was created.

2020-06-20T07:26:47.000+0000

status

string

The status of the collector. Valid values:

  • activing: taking effect

  • active: effective

activing

cloudAssistantStatus

string

The installation status of Cloud Assistant. Valid values:

  • true: installed

  • false: not installed

true

ecsInstanceName

string

The name of the ECS instance.

ecsTestName

osType

string

The operating system type of the ECS instance. Valid values:

  • windows: Windows operating system

  • linux: Linux operating system

linux

ipAddress

array<object>

The IP address information of the ECS instance.

object

host

string

The IP address.

172.16.xx.xx

ipType

string

The type of the IP address. Valid values:

  • public: public IP address

  • private: private network IP address

private

tags

string

The tag information of the ECS instance.

[ { "tagKey": "a", "tagValue": "b" } ]

status

string

The status of the ECS instance. Valid values:

  • running: running

  • starting: starting

  • stopping: stopping

  • stopped: stopped

running

Examples

Success response

JSON format

{
  "RequestId": "5FFD9ED4-C2EC-4E89-B22B-1ACB6FE1D***",
  "Headers": {
    "X-Total-Count": 11
  },
  "Result": [
    {
      "ecsInstanceId": "i-bp14ncqge8wy3l3d****",
      "collectors": [
        {
          "configs": [
            {
              "fileName": "fields.yml",
              "content": "- key: log\\n title: Log file content\\n description: >\\n Contains log file lines.\\n ...."
            }
          ],
          "dryRun": false,
          "resType": "fileBeat",
          "ownerId": "16852***488*****",
          "resId": "ct-cn-0v3xj86085dvq****",
          "collectorPaths": [
            "[\"/var/log\"]"
          ],
          "gmtUpdateTime": "2020-06-20T07:26:47.000+0000",
          "extendConfigs": [
            {
              "protocol": "HTTP",
              "enableMonitoring": true,
              "instanceId": "es-cn-nif1z89fz003i****",
              "hosts": [
                "[\"es-cn-n6w1o1x*****.elasticsearch.aliyuncs.com:9200\"]"
              ],
              "groupId": "default_ct-cn-5i2l75bz4776****",
              "instanceType": "elasticsearch",
              "machines": [
                {
                  "instanceId": "i-bp13y63575oypr9d****",
                  "agentStatus": "heartOk"
                }
              ],
              "configType": "collectorDeployMachine",
              "userName": "elastic",
              "type": "ECSInstanceId"
            }
          ],
          "resVersion": "6.8.5_with_community",
          "vpcId": "vpc-bp16k1dvzxtm******",
          "name": "ct-testAbc",
          "gmtCreatedTime": "2020-06-20T07:26:47.000+0000",
          "status": "activing"
        }
      ],
      "cloudAssistantStatus": "true",
      "ecsInstanceName": "ecsTestName",
      "osType": "linux",
      "ipAddress": [
        {
          "host": "172.16.xx.xx",
          "ipType": "private"
        }
      ],
      "tags": "[ { \"tagKey\": \"a\", \"tagValue\": \"b\" } ]",
      "status": "running"
    }
  ]
}

Error codes

HTTP status code

Error code

Error message

Description

400 ComponentCodeValueError component value is disable
401 UserNotOpen Aliyun account is not open elasticsearch
401 StsRoleAccountNoPermission Role account has no permission or expired
401 SubAccountNoPermission Aliyun sub account has no permission, please authorize your sub account in Aliyun RAM
401 UserUnauthorized Authentication required

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.