All Products
Search
Document Center

:TagResources

Last Updated:May 26, 2026

Membuat dan menambahkan tag ke resource Elastic Compute Service (ECS) yang ditentukan.

Catatan penggunaan

Sebelum menambahkan tag ke resource, Alibaba Cloud memeriksa jumlah tag yang sudah ada pada resource tersebut. Jika jumlah maksimum tag telah tercapai, sistem akan mengembalikan pesan kesalahan. Untuk informasi selengkapnya, lihat bagian "Batas Tag" dalam Batas.

Debugging

OpenAPI Explorer secara otomatis menghitung nilai signature. Untuk kemudahan Anda, kami menyarankan agar Anda memanggil operasi ini di OpenAPI Explorer. OpenAPI Explorer secara dinamis menghasilkan contoh kode operasi untuk berbagai SDK.

Parameter permintaan

Parameter

Type

Required

Example

Description

Action String Yes TagResources

Operasi yang ingin Anda lakukan. Tetapkan nilainya ke TagResources.

RegionId String Yes cn-hangzhou

ID wilayah dari resource tersebut. Anda dapat memanggil operasi DescribeRegions untuk menanyakan daftar wilayah terbaru.

ResourceType String Yes instance

Jenis resource. Nilai yang valid:

  • 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 or file delivery result
  • activation: activation code for the Cloud Assistant managed instance
  • managedinstance: Cloud Assistant managed instance
ResourceId.N String Yes r-XXX

ID resource N. Nilai N yang valid: 1 hingga 50.

Tag.N.Key String Yes TestKey

Kunci tag N yang akan ditambahkan ke resource. Nilai N yang valid: 1 hingga 20. Kunci tag tidak boleh berupa string kosong. Panjang kunci tag maksimal 128 karakter dan tidak boleh mengandung http:// atau https://. Kunci tag tidak boleh diawali dengan acs: atau aliyun.

Tag.N.Value String Yes TestValue

Nilai tag N yang akan ditambahkan ke resource. Nilai N yang valid: 1 hingga 20. Nilai tag boleh berupa string kosong. Panjang nilai tag maksimal 128 karakter dan tidak boleh mengandung http:// atau https://. Nilai tag tidak boleh diawali dengan acs:.

Parameter respons

Parameter

Type

Example

Description

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

ID permintaan.

Contoh

Contoh permintaan

https://ecs.aliyuncs.com/?Action=TagResources
&RegionId=cn-hangzhou
&ResourceId.1=i-bp1j6qtvdm8w0z1o0****
&ResourceId.2=i-bp1j6qtvdm8w0z1oP****
&ResourceType=instance
&Tag.1.Key=TestKey
&<Common request parameters>

Contoh respons sukses

XML format

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

<TagResourcesResponse>
  <RequestId>C46FF5A8-C5F0-4024-8262-B16B639225A0</RequestId>
</TagResourcesResponse>

JSON format

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

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

Kode kesalahan

Kode status HTTP

Kode kesalahan

Pesan kesalahan

Deskripsi

400 Duplicate.TagKey The Tag.N.Key contain duplicate key. Kunci tag sudah ada. Kunci tag harus unik.
400 InvalidTagKey.Malformed The specified Tag.n.Key is not valid. Nilai Tag.N.Key tidak valid.
400 InvalidTagValue.Malformed The specified Tag.n.Value is not valid. Nilai Tag.N.Value tidak valid.
400 OperationDenied.QuotaExceed The quota of tags on resource is beyond permitted range. Jumlah maksimum tag telah terlampaui.
400 InvalidTag.Mismatch The specified Tag.n.Key and Tag.n.Value are not match. Parameter Tag.N.Key dan Tag.N.Value yang ditentukan tidak saling sesuai.
400 InvalidTagCount The specified tags are beyond the permitted range. Jumlah maksimum tag telah terlampaui.
400 Invalid.Scope The specified scope is invalid. Nilai Scope tidak valid.
403 PermissionDenied.TagOwnerUid The specified operator not have permission to set TagOwnerUid value. Anda tidak memiliki otorisasi untuk menentukan parameter TagOwnerUid.
403 PermissionDenied.Scope The specified operator not have permission to set Scope value. Anda tidak memiliki otorisasi untuk menentukan parameter Scope.
403 InvalidResourceId.NotSupported The specified ResourceId does not support tagging. Resource yang ditentukan tidak mendukung penambahan tag.
403 NoPermission.Tag The operator is not permission for the tag. Anda tidak memiliki otorisasi untuk mengelola tag tersebut.
403 QuotaExceed.Tags %s Jumlah maksimum tag telah terlampaui. %s adalah variabel. Pesan kesalahan dikembalikan secara dinamis berdasarkan kondisi pemanggilan.
404 InvalidRegionId.NotFound %s ID wilayah yang ditentukan tidak ada.
404 MissingParameter.ResourceType The parameter - ResourceType should not be null. ResourceType wajib diisi.
404 InvalidResourceId.NotFound The specified ResourceIds are not found in our records. Resource yang ditentukan tidak ada. Periksa apakah parameter ResourceId sudah benar.
404 InvalidResourceType.NotFound The ResourceType provided does not exist in our records. Jenis resource yang ditentukan tidak ditemukan.
404 InvalidRegionId.NotFound The specified RegionId does not exist. ID wilayah yang ditentukan tidak ada.
500 ServiceUnavailable The service is unavailable, please try again later. Layanan sementara tidak tersedia. Coba lagi nanti.

Untuk daftar kode kesalahan, lihat Service error codes.