AWS 文档 SDK 示例
将 Untag 与 CLI 配合使用
以下代码示例演示如何使用 Untag。
- CLI
-
- AWS CLI
-
从资源中删除标签
以下
untags示例从资源组(而非其成员)中删除具有指定键的所有标签。aws resource-groups untag \ --arnarn:aws:resource-groups:us-west-2:123456789012:group/tbq-WebServer\ --keysQueryType输出:
{ "Arn": "arn:aws:resource-groups:us-west-2:123456789012:group/tbq-WebServer", "Keys": [ "QueryType" ] }有关更多信息,请参阅《AWS 资源组用户指南》中的管理标签。
-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 Untag
。
-
- PowerShell
-
- Tools for PowerShell V4
-
示例 1:此示例从资源组中移除提到的标签
Remove-RGResourceTag -Arn arn:aws:resource-groups:eu-west-1:123456789012:group/workboxes -Key Instances输出:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-RGResourceTag (Untag)" on target "arn:aws:resource-groups:eu-west-1:933303704102:group/workboxes". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Arn Keys --- ---- arn:aws:resource-groups:eu-west-1:123456789012:group/workboxes {Instances}-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V4)》中的 Untag。
-
- Tools for PowerShell V5
-
示例 1:此示例从资源组中移除提到的标签
Remove-RGResourceTag -Arn arn:aws:resource-groups:eu-west-1:123456789012:group/workboxes -Key Instances输出:
Confirm Are you sure you want to perform this action? Performing the operation "Remove-RGResourceTag (Untag)" on target "arn:aws:resource-groups:eu-west-1:933303704102:group/workboxes". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y Arn Keys --- ---- arn:aws:resource-groups:eu-west-1:123456789012:group/workboxes {Instances}-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V5)》中的 Untag。
-
Tag
UpdateGroup