

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 中使用標籤 AWS IoT SiteWise
<a name="tag-basics"></a>

使用標籤依用途、擁有者、環境或任何其他使用案例的分類來分類您的 AWS IoT SiteWise 資源。當您有許多相同類型的資源時，您可以依據先前指派的標籤來快速識別特定資源。

每個標籤都由您指定的索引鍵和選用值組成。例如，您可以為您的資產模型建立一系列標籤，以根據它們支援的工業程序來追蹤它們。建議您為您管理的每種資源類型開發一組量身打造的標籤金鑰。使用一組一致的標籤金鑰可以更輕鬆地管理資源。

## 使用 標記 AWS 管理主控台
<a name="tags-console"></a>

中的**標籤編輯器** AWS 管理主控台 提供集中、統一的方式，讓您為來自所有 AWS 服務的資源建立和管理標籤。如需詳細資訊，請參閱 *標記 AWS 資源和*[標籤編輯器使用者指南中的標籤編輯器入門](https://docs.aws.amazon.com/tag-editor/latest/userguide/gettingstarted.html)。

## 使用 AWS IoT SiteWise API 標記
<a name="tags-api"></a>

 AWS IoT SiteWise API 也會使用標籤。在建立標籤之前，請注意下列標籤限制。如需詳細資訊，請參閱《》中的[標籤命名和使用慣例](https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html#tag-conventions)*AWS 一般參考*。
+ 若要在建立資源時新增標籤，請在資源的 `tags` 屬性中定義標籤。
+ 若要將標籤新增至現有資源或更新標籤值，請使用 [TagResource](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_TagResource.html) 操作。
+ 若要從資源移除標籤，請使用 [UntagResource](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UntagResource.html) 操作。
+ 若要擷取與資源建立關聯的標籤，請使用 [ListTagsForResource](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_ListTagsForResource.html) 操作，或描述資源並檢查其 `tags` 屬性。

下表列出您可以使用 AWS IoT SiteWise API 及其對應 `Create` 和 `Describe`操作來標記的資源。


**可標記 AWS IoT SiteWise 的資源**  

| 資源 | 建立操作 | 描述操作 | 
| --- | --- | --- | 
| 資產模型或元件模型 | [CreateAssetModel](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAssetModel.html) | [DescribeAssetModel](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeAssetModel.html) | 
| 資產 | [CreateAsset](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAsset.html) | [DescribeAsset](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeAsset.html) | 
| SiteWise Edge 閘道 | [CreateGateway](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateGateway.html) | [DescribeGateway](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeGateway.html) | 
| Portal | [CreatePortal](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreatePortal.html) | [DescribePortal](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribePortal.html) | 
| 專案 | [CreateProject](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateProject.html) | [DescribeProject](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeProject.html) | 
| 儀表板 | [CreateDashboard](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateDashboard.html) | [DescribeDashboard](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeDashboard.html) | 
| 存取政策 | [CreateAccessPolicy](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_CreateAccessPolicy.html) | [DescribeAccessPolicy](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeAccessPolicy.html) | 
| 時間序列 | [BatchPutAssetPropertyValue](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchPutAssetPropertyValue.html) | [DescribeTimeSeries](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_DescribeTimeSeries.html) | 

對於 `[BatchPutAssetPropertyValue](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_BatchPutAssetPropertyValue.html)`，您可以將資料來源設定為在建立資產模型和資產 AWS IoT SiteWise 之前將工業資料傳送至 。 AWS IoT SiteWise 會自動建立資料串流，以從設備接收原始資料串流。如需詳細資訊，請參閱[管理資料擷取](https://docs.aws.amazon.com//iot-sitewise/latest/userguide/data-streams.html)。

使用下列操作檢視並管理支援標記之資源的標籤：
+ [TagResource](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_TagResource.html) – 將標籤新增至資源，或更新現有標籤的值。
+ [ListTagsForResource](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_ListTagsForResource.html) – 列出資源的標籤。
+ [UntagResource](https://docs.aws.amazon.com/iot-sitewise/latest/APIReference/API_UntagResource.html) – 從資源移除標籤。

隨時從資源新增或移除標籤。若要更新現有標籤索引鍵的值，請將具有相同索引鍵和所需新值的新標籤新增至資源。此動作會將舊值取代為新的值。雖然可以將空字串指派為標籤值，但您無法指派 null 值。

刪除資源也會移除與其連結的任何標籤。