All Products
Search
Document Center

:JoinResourceGroup

更新時間:Dec 20, 2023

Adds an Elastic Compute Service (ECS) resource or service to a resource group.

Usage notes

A resource is a cloud service entity that you create in Alibaba Cloud, such as an ECS instance, elastic network interface (ENI), or image. A resource group is a collection of infrastructure for projects, environments, or stacks. In a resource group, you can manage resources and monitor and run tasks in a centralized manner without switching between Alibaba Cloud services.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes JoinResourceGroup

The operation that you want to perform. Set the value to JoinResourceGroup.

ResourceType String No securitygroup

The type of the ECS resource. Valid values:

  • instance: instance
  • disk: Elastic Block Storage (EBS)
  • snapshot: snapshot
  • image: image
  • securitygroup: security group
  • ddh: dedicated host
  • ddhcluster: dedicated host cluster
  • eni: ENI
  • keypair: SSH key pair
  • launchtemplate: launch template
  • command: Cloud Assistant command
  • activation: activation code of the Cloud Assistant managed instance

The values are case-sensitive.

ResourceId String No sg-bp67acfmxazb4p****

The ID of the resource. This parameter depends on the ResourceType value. For example, if you set ResourceType to instance, ResourceId can be interpreted as InstanceId.

RegionId String No cn-hangzhou

The region ID of the resource. You can call the DescribeRegions operation to query the most recent region list.

ResourceGroupId String No rg-bp67acfmxazb4p****

The ID of the resource group to which to add the resource.

Response parameters

Parameter

Type

Example

Description

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=JoinResourceGroup
&RegionId=cn-hangzhou
&RsourceType=securitygroup
&ResourceId=sg-bp67acfmxazb4p****
&ResourceGroupId=rg-bp67acfmxazb4p****
&<Common request parameters>

Sample success responses

XML format

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

<JoinResourceGroupResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</JoinResourceGroupResponse>

JSON format

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

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status code

Error code

Error message

Description

400 EntityExists.AssociatedTransferTasks An associated transfer task is in progress. Try again later. A transfer task is being performed. Try again later.
403 InvalidResourceGroup.Duplicate The ResourceId provided has a ResourceGroup in our records. The resource has been added to other resource groups.
403 InvalidStatus.ResourceGroup You cannot perform an operation on a resource group that is being created or deleted. You cannot perform this operation on a resource group that is being created or deleted.
404 InvalidResourceType.NotFound The ResourceType provided does not exist in our records. The specified resource type is not found.
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. The resource group is not found.
404 InvalidResourceId.NotFound The ResourceId provided does not exist in our records. The specified resource is not found.

For a list of error codes, see Service error codes.