Tüm Ürünler
Search
Belge Merkezi

:TagResources

Son Güncelleme:Oct 02, 2026

Belirtilen ECS kaynaklarına tek bir işlemde etiketler oluşturur ve bağlar.

Operation description

İşlem açıklaması

Etiketleri eklemeden önce Alibaba Cloud, kaynaklardaki mevcut etiket sayısını kontrol eder. Sayı sınırı aşarsa bir hata mesajı döndürülür. Daha fazla bilgi için Sınırlar bölümüne bakın.

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:TagResources

create

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}

LaunchTemplate

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

ReservedInstance

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

SecurityGroup

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

Snapshot

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

AutoSnapshotPolicy

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

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

Kaynakların bölge kimliği. En son bölge listesini sorgulamak için DescribeRegions API'sini çağırabilirsiniz.

cn-hangzhou

ResourceType

string

Yes

Kaynağın türü. Geçerli değerler:

  • instance: ECS örneği.

  • disk: bulut diski.

  • snapshot: anlık görüntü.

  • image: görüntü.

  • securitygroup: güvenlik grubu.

  • volume: depolama birimi.

  • eni: Esnek Ağ Arabirimi (ENI).

  • ddh: adanmış ana bilgisayar.

  • ddhcluster: adanmış ana bilgisayar kümesi.

  • keypair: SSH anahtar çifti.

  • launchtemplate: başlatma şablonu.

  • reservedinstance: ayrılmış örnek.

  • snapshotpolicy: otomatik anlık görüntü politikası.

  • elasticityassurance: esneklik garantisi.

  • capacityreservation: kapasite rezervasyonu.

  • command: Cloud Assistant komutu.

  • invocation: Cloud Assistant komut çalıştırma veya dosya gönderme sonucu.

  • activation: Cloud Assistant yönetilen örnek etkinleştirme kodu.

  • managedinstance: Cloud Assistant yönetilen örneği.

instance

ResourceId

array

Yes

Kaynak kimliklerinin listesi. Dizi uzunluğu: 1 ile 50 arası.

i-bp67acfmxazb4ph****

string

No

Kaynak kimliği.

r-XXX

Tag

array<object>

Yes

Etiketler. Dizi uzunluğu: 1 ile 20 arası. Dizi birden fazla etiket nesnesi içeriyorsa, Key etiket anahtarı benzersiz olmalıdır.

object

No

Etiket nesnesi.

Key

string

Yes

Etiket anahtarı. Etiket anahtarı boş bir dize olamaz. Etiket anahtarı en fazla 128 karakter uzunluğunda olabilir ve aliyun veya acs: ile başlayamaz. Etiket anahtarı http:// veya https:// içeremez.

TestKey

Value

string

Yes

Etiket değeri. Etiket değeri null olamaz ancak boş bir dize olabilir. Etiket değeri en fazla 128 karakter uzunluğunda olabilir ve http:// veya https:// içeremez.

TestValue

Response elements

Element

Type

Description

Example

object

RequestId

string

İstek kimliği.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Success response

JSON format

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

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.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid.
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.
400 InvalidTagCount The specified tags are beyond the permitted range.
400 Invalid.Scope The specified scope is invalid.
500 ServiceUnavailable The service is unavailable, please try again later.
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.
403 PermissionDenied.Scope The specified operator not have permission to set Scope value.
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.
403 QuotaExceed.Tags %s
403 TagKey.Duplication The TagKey has duplication with others, case-insensitive.
404 InvalidRegionId.NotFound The RegionId provided does not exist in our records.
404 MissingParameter.ResourceIds The parameter - ResourceIds.N should not be null.
404 MissingParameter.TagOwnerUid The parameter - TagOwnerUid should not be null.
404 MissingParameter.TagOwnerBid The parameter - TagOwnerBid should not be null.
404 MissingParameter.ResourceType The parameter - ResourceType should not be null.
404 MissingParameter.Tags The parameter - Tags should not be null.
404 MissingParameter.RegionId The parameter - RegionId should not be null.
404 InvalidResourceId.NotFound The specified ResourceIds are not found in our records.
404 InvalidResourceType.NotFound The ResourceType provided does not exist in our records.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.