All Products
Search
Document Center

Function Compute (2.0):ListInstances

Last Updated:Dec 27, 2023

Queries available instances of a function.

Usage notes

The ListInstances operation allows you to query the real-time status of instances. Instances returned by this operation are the available instances that are allocated when the function in the service with the same alias or version is invoked.

Available instances are instances that are processing requests or can be scheduled to process requests. Instances to be returned by the ListInstances operation are the same as those allocated when the InvokeFunction operation is called.

Request headers

This operation uses only common request headers. For more information, see Common parameters.

Request syntax

GET /services/{serviceName[.qualifier]}/functions/{function_name}/instances HTTP/1.1

Request parameters

Parameter

Type

Position

Required

Example

Description

serviceName

String

Path

Yes

service_name

The name of the service to which the instance belongs.

functionName

String

Path

Yes

function_name

The name of the function.

qualifier

String

Path

No

test

The version or alias of the service to which the instance belongs. Default value: LATEST.

The meaning of the qualifier parameter is the same as that of the qualifier parameter in the InvokeFunction operation. For example, if you specify qualifier=test when you call the ListInstances operation, the system returns the same instances that are returned when you called the InvokeFunction operation by specifying qualifier=test.

Important

Set the qualifier parameter to an alias instead of a version to query provisioned instances. Provisioned resources are bound to aliases, and provisioned instances are managed by using aliases.

instanceIds

Array of String

Query

No

["1ef6b6ff-7f7b-485e-ab49-501ac681****", "04db0821-c6d2-4c10-970b-93e36f1a****"]

The IDs of the instances.

limit

Long

Query

No

20

The upper limit of the number of resources to be returned. Valid values: 0 to 1,000.

The number of returned resources is less than or equal to the specified limit.

Response parameters

Parameter

Type

Example

Description

Array

The information about returned instances.

instanceId

String

["1ef6b6ff-7f7b-485e-ab49-501ac681****", "04db0821-c6d2-4c10-970b-93e36f1a****"]

The ID of the instance.

versionId

Long

1

The version of the service to which the instance belongs. If the instance belongs to the LATEST alias, 0 is returned as the version.

Examples

Sample requests

GET /services/{serviceName[.qualifier]}/functions/{function_name}/instances?instanceIds=["[\"1ef6b6ff-7f7b-485e-ab49-501ac681****\", \"04db0821-c6d2-4c10-970b-93e36f1a****\"]"]&limit=20 HTTP/1.1
Host:fc-ram.aliyuncs.com
Content-Type:application/json

Sample success responses

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

[ {
  "instanceId" : "[\"1ef6b6ff-7f7b-485e-ab49-501ac681****\", \"04db0821-c6d2-4c10-970b-93e36f1a****\"]",
  "versionId" : 1
} ]