There are more AWS SDK examples available in the AWS Doc SDK Examples
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-tagsexample displays the tags attached to themy-functionLambda function.aws lambda list-tags \ --resourcearn:aws:lambda:us-west-2:123456789012:function:my-functionOutput:
{ "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).
-