There are more AWS SDK examples available in the AWS Doc SDK Examples
Use GetTagValues
with a CLI
The following code examples show how to use GetTagValues
.
- CLI
-
- AWS CLI
-
To get a list of all tag values
The following
get-tag-values
example displays all of the values used for the specified key for all resources in theaws resourcegroupstaggingapi get-tag-values \ --key=Environment
Output:
{ "TagValues": [ "Alpha", "Gamma", "Production" ] }
For more information, see GetTagValues in the Resource Groups Tagging API Reference.
-
For API details, see GetTagValues
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell
-
Example 1: Returns the value for the specified tag in a region. If the -Region parameter is not specified the cmdlet will attempt to infer the region from the default shell region or EC2 instance metadata.
Get-RGTTagValue -Key "stage" -Region us-west-2
Output:
beta
-
For API details, see GetTagValues in AWS Tools for PowerShell Cmdlet Reference.
-