Use DescribeTags with an AWS SDK or CLI - AWS SDK Code Examples

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

Use DescribeTags with an AWS SDK or CLI

The following code examples show how to use DescribeTags.

CLI
AWS CLI

To describe the tags assigned to a load balancer

This example describes the tags assigned to the specified load balancer.

Command:

<userinput>aws elb describe-tags --load-balancer-name <replaceable>my-load-balancer</replaceable></userinput>

Output:

{ "TagDescriptions": [ { "Tags": [ { "Value": "lima", "Key": "project" }, { "Value": "digital-media", "Key": "department" } ], "LoadBalancerName": "my-load-balancer" } ] }
  • For API details, see DescribeTags in AWS CLI Command Reference.

PowerShell
Tools for PowerShell

Example 1: This example lists the tags for the specified load balancers.

Get-ELBResourceTag -LoadBalancerName @("my-load-balancer","my-internal-load-balancer")

Output:

LoadBalancerName Tags ---------------- ---- my-load-balancer {project, department} my-internal-load-balancer {project, department}

Example 2: This example describes the tags for the specified load balancer.

(Get-ELBResourceTag -LoadBalancerName my-load-balancer).Tags

Output:

Key Value --- ----- project lima department digital-media
  • For API details, see DescribeTags in AWS Tools for PowerShell Cmdlet Reference.