Queries the resources that are associated with a specified resource.
Prerequisites
Resource Meta Center (RMC) is enabled. For more information, see Query resources that belong to different resource groups.
Usage notes
This section provides the types of resources that can be queried. Two-way queries are supported. For example, you can query the disks (ACS::ECS::Disk) that are associated with a specific Elastic Compute Service (ECS) instance (ACS::ECS::Instance) or query the ECS instance that is associated with a specific disk.
- For ECS instances, the following types of resources can be queried:
- ACS::ECS::Disk
- ACS::EIP::EipAddress
- ACS::VPC::VPC
- ACS::ECS::KeyPair
- ACS::ECS::SecurityGroup
- ACS::ECS::NetworkInterface
- ACS::ECS::Image
- For virtual private clouds (VPCs), which are indicated by ACS::VPC::VPC, the following
types of resources can be queried:
- ACS::ECS::Instance
- ACS::RDS::DBInstance
- ACS::SLB::LoadBalancer
- ACS::ALB::LoadBalancer
- ACS::Elasticsearch::Instance
- ACS::Redis::DBInstance
- ACS::PolarDB::DBCluster
- ACS::MongoDB::DBInstance
- ACS::DRDS::PolarDBXInstance
- ACS::EDAS::Cluster
- ACS::ECI::ContainerGroup
- ACS::ADB::DBCluster
- ACS::DRDS::DBInstance
- ACS::HBase::Cluster
- ACS::EMR::Cluster
This topic provides an example on how to call the API operation to query the resources
that are associated with the ECS instance i-uf6imlgyr1nudhud****
in the China (Shanghai) region.
QPS limits
You can call this API operation up to 20 times per second per account. Requests that exceed this limit will fail, and you may experience service interruptions. We recommend that you take note of this limit when you call this operation.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ListResourceRelationships |
The operation that you want to perform. Set the value to ListResourceRelationships. |
NextToken | String | No | eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd**** |
The token that is used to initiate the next request. If the total number of entries returned for the current request exceeds the value
of the |
MaxResults | Integer | No | 20 |
The maximum number of entries to return on each page. Valid values: 1 to 100. Default value: 20. |
SourceRegionId | String | Yes | cn-shanghai |
The region ID of the resource whose associated resources you want to query. |
SourceResourceType | String | Yes | ACS::ECS::Instance |
The type of the resource whose associated resources you want to query. |
SourceResourceId.N | String | Yes | i-uf6imlgyr1nudhud**** |
The ID of the resource whose associated resources you want to query. You can specify a maximum of 10 resource IDs. |
TargetResourceType.N | String | No | ACS::VPC::VPC |
The type of the associated resources that you want to query. You can specify a maximum of 10 resource types. |
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
NextToken | String | eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd**** |
The token that is used to initiate the next request. |
RequestId | String | 97765772-7E65-5D5E-BBB7-0CAF4D6260AA |
The ID of the request. |
MaxResults | Integer | 20 |
The maximum number of entries returned per page. |
ResourceRelationships | Array of ResourceRelationship |
The information of the associated resources. |
|
AccountId | String | 154035569884**** |
The ID of the Alibaba Cloud account. |
SourceRegionId | String | cn-shanghai |
The region ID of the specified resource. |
SourceResourceType | String | ACS::ECS::Instance |
The type of the specified resource. |
SourceResourceId | String | i-uf6imlgyr1nudhud**** |
The ID of the specified resource. |
TargetRegionId | String | cn-shanghai |
The region ID of the associated resource. |
TargetResourceType | String | ACS::VPC::VPC |
The type of the associated resource. |
TargetResourceId | String | vpc-uf6gvyids4utxhxe1**** |
The ID of the associated resource. |
Examples
Sample requests
https://rmc.aliyuncs.com/?Action=ListResourceRelationships
&SourceRegionId=cn-shanghai
&SourceResourceType=ACS::ECS::Instance
&SourceResourceId.1=i-uf6imlgyr1nudhud****
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ListResourceRelationshipsResponse>
<ResourceRelationships>
<ResourceRelationship>
<TargetResourceType>ACS::ECS::NetworkInterface</TargetResourceType>
<SourceRegionId>cn-shanghai</SourceRegionId>
<AccountId>154035569884****</AccountId>
<TargetResourceId>eni-uf68v6tepfijeia5****</TargetResourceId>
<SourceResourceId>i-uf6imlgyr1nudhud****</SourceResourceId>
<TargetRegionId>cn-shanghai</TargetRegionId>
<SourceResourceType>ACS::ECS::Instance</SourceResourceType>
</ResourceRelationship>
<ResourceRelationship>
<TargetResourceType>ACS::VPC::VPC</TargetResourceType>
<SourceRegionId>cn-shanghai</SourceRegionId>
<AccountId>154035569884****</AccountId>
<TargetResourceId>vpc-uf6gvyids4utxhxe1****</TargetResourceId>
<SourceResourceId>i-uf6imlgyr1nudhud****</SourceResourceId>
<TargetRegionId>cn-shanghai</TargetRegionId>
<SourceResourceType>ACS::ECS::Instance</SourceResourceType>
</ResourceRelationship>
<ResourceRelationship>
<TargetResourceType>ACS::ECS::SecurityGroup</TargetResourceType>
<SourceRegionId>cn-shanghai</SourceRegionId>
<AccountId>154035569884****</AccountId>
<TargetResourceId>sg-uf62urehb0clpmvu****</TargetResourceId>
<SourceResourceId>i-uf6imlgyr1nudhud****</SourceResourceId>
<TargetRegionId>cn-shanghai</TargetRegionId>
<SourceResourceType>ACS::ECS::Instance</SourceResourceType>
</ResourceRelationship>
<ResourceRelationship>
<TargetResourceType>ACS::ECS::Disk</TargetResourceType>
<SourceRegionId>cn-shanghai</SourceRegionId>
<AccountId>154035569884****</AccountId>
<TargetResourceId>d-uf624ee9ow9seg0l****</TargetResourceId>
<SourceResourceId>i-uf6imlgyr1nudhud****</SourceResourceId>
<TargetRegionId>cn-shanghai</TargetRegionId>
<SourceResourceType>ACS::ECS::Instance</SourceResourceType>
</ResourceRelationship>
</ResourceRelationships>
<RequestId>97765772-7E65-5D5E-BBB7-0CAF4D6260AA</RequestId>
<MaxResults>20</MaxResults>
</ListResourceRelationshipsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"ResourceRelationships" : [ {
"TargetResourceType" : "ACS::ECS::NetworkInterface",
"SourceRegionId" : "cn-shanghai",
"AccountId" : "154035569884****",
"TargetResourceId" : "eni-uf68v6tepfijeia5****",
"SourceResourceId" : "i-uf6imlgyr1nudhud****",
"TargetRegionId" : "cn-shanghai",
"SourceResourceType" : "ACS::ECS::Instance"
}, {
"TargetResourceType" : "ACS::VPC::VPC",
"SourceRegionId" : "cn-shanghai",
"AccountId" : "154035569884****",
"TargetResourceId" : "vpc-uf6gvyids4utxhxe1****",
"SourceResourceId" : "i-uf6imlgyr1nudhud****",
"TargetRegionId" : "cn-shanghai",
"SourceResourceType" : "ACS::ECS::Instance"
}, {
"TargetResourceType" : "ACS::ECS::SecurityGroup",
"SourceRegionId" : "cn-shanghai",
"AccountId" : "154035569884****",
"TargetResourceId" : "sg-uf62urehb0clpmvu****",
"SourceResourceId" : "i-uf6imlgyr1nudhud****",
"TargetRegionId" : "cn-shanghai",
"SourceResourceType" : "ACS::ECS::Instance"
}, {
"TargetResourceType" : "ACS::ECS::Disk",
"SourceRegionId" : "cn-shanghai",
"AccountId" : "154035569884****",
"TargetResourceId" : "d-uf624ee9ow9seg0l****",
"SourceResourceId" : "i-uf6imlgyr1nudhud****",
"TargetRegionId" : "cn-shanghai",
"SourceResourceType" : "ACS::ECS::Instance"
} ],
"RequestId" : "97765772-7E65-5D5E-BBB7-0CAF4D6260AA",
"MaxResults" : 20
}
Error codes
For a list of error codes, visit the API Error Center.