Search code examples
amazon-web-servicesamazon-kms

AWS: How to get AWS KMS Key ID based on Tags


I want to fetch the AWS KMS Keys ID based on tags assigned to them. I gone through AWS documentation but no luck.

Could someone help me out to get this thing resolved using AWS CLI?


Solution

  • Finally after checking multiple documentation, I came to know that there is an api called resourcegroupstaggingapi in AWS to filter the resources based on tags if no native solution available . Below CLI command works well for my requirement.

    Solution:

    aws resourcegroupstaggingapi get-resources --region us-west-2 --resource-type-filters kms --tag-filters Key=Environment,Values=Dev