UntagResources

更新时间:
复制 MD 格式

Removes tags from Elastic Compute Service (ECS) resources. After a tag is removed from a resource, the tag is automatically deleted if it is not added to other resources.

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

ecs:UntagResources

delete

DedicatedHost

acs:ecs:{#regionId}:{#accountId}:ddh/{#ddhId}

Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

NetworkInterface

acs:ecs:{#regionId}:{#accountId}:eni/{#eniId}

Image

acs:ecs:{#regionId}:{#accountId}:image/{#imageId}

Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

KeyPair

acs:ecs:{#regionId}:{#accountId}:keypair/{#keypairId}

ReservedInstance

acs:ecs:{#regionId}:{#accountId}:reservedinstance/{#reservedinstanceId}

SecurityGroup

acs:ecs:{#regionId}:{#accountId}:securitygroup/{#securitygroupId}

Snapshot

acs:ecs:{#regionId}:{#accountId}:snapshot/{#snapshotId}

LaunchTemplate

acs:ecs:{#regionId}:{#accountId}:launchtemplate/{#launchtemplateId}

AutoSnapshotPolicy

acs:ecs:{#regionId}:{#accountId}:snapshotpolicy/{#SnapshotPolicyId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

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

cn-hangzhou

RegionId

string

Yes

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

cn-hangzhou

ResourceType

string

Yes

The type of the resource. Valid values:

  • instance: ECS instance

  • disk: disk

  • snapshot: snapshot

  • image: image

  • securitygroup: security group

  • volume: storage volume

  • eni: elastic network interface (ENI)

  • ddh: dedicated host

  • ddhcluster: dedicated host cluster

  • keypair: SSH key pair

  • launchtemplate: launch template

  • reservedinstance: reserved instance

  • snapshotpolicy: automatic snapshot policy

  • elasticityassurance: elasticity assurance

  • capacityreservation: capacity reservation

  • command: Cloud Assistant command

  • invocation: Cloud Assistant command execution result

instance

All

boolean

No

Specifies whether to remove all tags from the resource. This parameter takes effect only if you do not specify TagKey.N. Valid values:

  • true

  • false

Default value: false.

false

ResourceId

array

Yes

The resource IDs. Valid values of N: 1 to 50.

i-bp67acfmxazb4ph****

string

No

The ID of resource N.

i-bp67acfmxazb4ph****

TagKey

array

No

The tag keys. Valid values of N: 1 to 20.

TestKey

string

No

The key of tag N.

TestKey

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

C46FF5A8-C5F0-4024-8262-B16B639225A0

Examples

Success response

JSON format

{
  "RequestId": "C46FF5A8-C5F0-4024-8262-B16B639225A0"
}

Error codes

HTTP status code

Error code

Error message

Description

400 NumberExceed.ResourceIds The ResourceIds parameter's number is exceed , Valid : 50
400 NumberExceed.Tags The Tags parameter's number is exceed , Valid : 20
400 Duplicate.TagKey The Tag.N.Key contain duplicate key. The specified tag key already exists. Tag keys must be unique.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. The specified Tag.N.Key parameter is invalid.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. The specified tag value is invalid.
400 OperationDenied.QuotaExceed The quota of tags on resource is beyond permitted range.
400 InvalidTag.Mismatch The specified Tag.n.Key and Tag.n.Value are not match. The specified Tag.N.Key and Tag.N.Value parameters do not correspond to each other.
400 InvalidTagCount The specified tags are beyond the permitted range. The number of specified tags exceeds the upper limit.
400 Invalid.Scope The specified scope is invalid.
403 PermissionDenied.TagOwnerBid The specified operator not have permission to set TagOwnerBid value.
403 PermissionDenied.TagOwnerUid The specified operator not have permission to set TagOwnerUid value. You are not authorized to specify the TagOwnerUid parameter.
403 PermissionDenied.Scope The specified operator not have permission to set Scope value. You are not authorized to specify the Scope parameter.
403 InvalidResourceId.NotSupported The specified ResourceId does not support tagging.
403 NoPermissionKey.Scope %s
403 NoPermission.Tag The operator is not permission for the tag. You are not authorized to manage the tag.
403 Param.Conflict The specified all is true, but the specified TagKey.N is not empty.
404 InvalidRegionId.NotFound The RegionId provided does not exist in our records. Region information error
404 MissingParameter.ResourceIds The parameter - ResourceIds.N should not be null
404 MissingParameter.TagOwnerUid The parameter - TagOwnerUid should not be null The TagOwnerUid parameter is required.
404 MissingParameter.TagOwnerBid The parameter - TagOwnerBid should not be null The TagOwnerBid parameter is required.
404 MissingParameter.ResourceType The parameter - ResourceType should not be null
404 MissingParameter.Tags The parameter - Tags should not be null The tag-related parameters are required.
404 MissingParameter.RegionId The parameter - RegionId should not be null The RegionId parameter is required.
404 InvalidResourceId.NotFound The specified ResourceIds are not found in our records. The specified resource does not exist. Check whether the ResourceId parameter is correct.
404 InvalidResourceType.NotFound The ResourceType provided does not exist in our records. The specified resource type does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.