Use ListTags with a CLI - AWS Lambda

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).

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