Is it possible to filter by tags when using search expression in cloudwatch?

0

I've recently learned about search expressions in cloudwatch which are a great way of automating the update of dashboards but I've only been able to get all the resources in the account with a desired metric, is there a way to filter the search expression to only show resources with a specific tag e.g. "environment = dev"?

Here's a sample search metric source code I'd like to filter:

{ "expression": "SEARCH('{AWS/Lambda,FunctionName} lambda invocations', 'Average', 300)", "id": "e3", "period": 300, "yAxis": "right", "region": "us-east-1" }

In summary I'm trying to create a dashboard that shows lambda invocations for all functions containing the "environment = dev" tag and gets updated with new lambdas when they're created.

I know about Metrics Explorer but that doesn't update the graphs automatically when new resources are created AFAIK.

1개 답변
0
수락된 답변

Filtering by tags directly within a CloudWatch search expression for metrics isn't directly supported in the syntax you've provided. The SEARCH function in CloudWatch allows you to search across metrics based on namespace, metric name, and dimensions such as FunctionName in the case of AWS Lambda, but it does not natively support filtering by resource tags in the search expression itself.

Another approach is to use AWS resource groups to organize resources based on tags, and then use the CloudWatch integration with these groups to focus on the metrics for these grouped resources. However, this doesn’t directly change the search expression but could help in narrowing down the metrics you're interested in through the AWS Management Console or through automated scripts that leverage AWS SDKs.

profile picture
전문가
답변함 2달 전
  • Thanks for the quick answer! This is a huge oversight on AWS part IMO. Having a way to automatically update dashboards without resorting to a user created updating function should be a focus, search expressions should be more proeminently displayed for that and not integrating it with user tags is a big missed opportunity.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠