Manage tags using the CLI or API - Amazon Batch
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Manage tags using the CLI or API

Use the following Amazon CLI commands or Amazon Batch API operations to add, update, list, and delete the tags for your resources.

Tag support for Amazon Batch resources
Task API action Amazon CLI Amazon Tools for Windows PowerShell

Add or overwrite one or more tags.

TagResource

tag-resource

Add-BATResourceTag

Delete one or more tags.

UntagResource

untag-resource

Remove-BATResourceTag

List tags for a resource

ListTagsForResource

list-tags-for-resource

Get-BATResourceTag

The following examples show how to tag or untag resources using the Amazon CLI.

Example 1: Tag an existing resource

The following command tags an existing resource.

aws batch tag-resource --resource-arn resource_ARN --tags team=devs
Example 2: Untag an existing resource

The following command deletes a tag from an existing resource.

aws batch untag-resource --resource-arn resource_ARN --tag-keys tag_key
Example 3: List tags for a resource

The following command lists the tags associated with an existing resource.

aws batch list-tags-for-resource --resource-arn resource_ARN

Some resource-creating actions enable you to specify tags when you create the resource. The following actions support tagging on creation.