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-keysexample retrieves the list of all tag key names used by resources in the account.aws resourcegroupstaggingapi get-tag-keysOutput:
{ "TagKeys": [ "Environment", "CostCenter", "Department" ] }For more information, see What is Tag Editor? in the Tagging AWS Resources and Tag Editor User Guide.
-
For API details, see GetTagKeys
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell V4
-
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-2Output:
version stage-
For API details, see GetTagKeys in AWS Tools for PowerShell Cmdlet Reference (V4).
-
- Tools for PowerShell V5
-
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-2Output:
version stage-
For API details, see GetTagKeys in AWS Tools for PowerShell Cmdlet Reference (V5).
-