There are more AWS SDK examples available in the AWS Doc SDK Examples
Use GetTagKeys
with a CLI
The following code examples show how to use GetTagKeys
.
- CLI
-
- AWS CLI
-
To get a list of all tag keys
The following
get-tag-keys
example retrieves the list of all tag key names used by resources in the account.aws resourcegroupstaggingapi get-tag-keys
Output:
{ "TagKeys": [ "Environment", "CostCenter", "Department" ] }
For more information, see GetTagKeys in the Resource Groups Tagging API Reference.
-
For API details, see GetTagKeys
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell
-
Example 1: Returns all tag keys in the specified 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. Note that the tag keys are not returned in any specific order.
Get-RGTTagKey -region us-west-2
Output:
version stage
-
For API details, see GetTagKeys in AWS Tools for PowerShell Cmdlet Reference.
-