Use ListTagsForResource with a CLI - Amazon Systems Manager
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).

Use ListTagsForResource with a CLI

The following code examples show how to use ListTagsForResource.

CLI
Amazon CLI

To list the tags applied to a patch baseline

The following list-tags-for-resource example lists the tags for a patch baseline.

aws ssm list-tags-for-resource \ --resource-type "PatchBaseline" \ --resource-id "pb-0123456789abcdef0"

Output:

{ "TagList": [ { "Key": "Environment", "Value": "Production" }, { "Key": "Region", "Value": "EMEA" } ] }

For more information, see Tagging Amazon Resources in the Amazon General Reference.

PowerShell
Tools for PowerShell V4

Example 1: This example lists the tags for a maintenance window.

Get-SSMResourceTag -ResourceId "mw-03eb9db42890fb82d" -ResourceType "MaintenanceWindow"

Output:

Key Value --- ----- Stack Production
  • For API details, see ListTagsForResource in Amazon Tools for PowerShell Cmdlet Reference (V4).

Tools for PowerShell V5

Example 1: This example lists the tags for a maintenance window.

Get-SSMResourceTag -ResourceId "mw-03eb9db42890fb82d" -ResourceType "MaintenanceWindow"

Output:

Key Value --- ----- Stack Production
  • For API details, see ListTagsForResource in Amazon Tools for PowerShell Cmdlet Reference (V5).

For a complete list of Amazon SDK developer guides and code examples, see Using this service with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.