View a markdown version of this page

Use ListTags with a CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use ListTags with a CLI

The following code examples show how to use ListTags.

CLI
AWS CLI

To retrieve the list of tags for a Lambda function

The following list-tags example displays the tags attached to the my-function Lambda function.

aws lambda list-tags \ --resource arn:aws:lambda:us-west-2:123456789012:function:my-function

Output:

{ "Tags": { "Category": "Web Tools", "Department": "Sales" } }

For more information, see Tagging Lambda Functions in the AWS Lambda Developer Guide.

  • For API details, see ListTags in AWS CLI Command Reference.

PowerShell
Tools for PowerShell V4

Example 1: Retrieves the tags and their values currently set on the specified function.

Get-LMResourceTag -Resource "arn:aws:lambda:us-west-2:123456789012:function:MyFunction"

Output:

Key Value --- ----- California Sacramento Oregon Salem Washington Olympia
  • For API details, see ListTags in AWS Tools for PowerShell Cmdlet Reference (V4).

Tools for PowerShell V5

Example 1: Retrieves the tags and their values currently set on the specified function.

Get-LMResourceTag -Resource "arn:aws:lambda:us-west-2:123456789012:function:MyFunction"

Output:

Key Value --- ----- California Sacramento Oregon Salem Washington Olympia
  • For API details, see ListTags in AWS Tools for PowerShell Cmdlet Reference (V5).