- Mais recentes
- Mais votos
- Mais comentários
That's incorrect, tags are not available for filtering CloudWatch metrics insights queries. Currently the only way to filter CloudWatch metrics insights queries is to use the WHERE clause with metrics dimensions and the = or != operator.
The only way I know is by setting up extra infrastructure. But AWS has something prepared for you: https://aws.amazon.com/blogs/mt/use-tags-to-create-and-maintain-amazon-cloudwatch-alarms-for-amazon-ec2-instances-part-1/
Yes, you can modify your CloudWatch metric query to select only instances belonging to a specific environment by adding a filter based on tags. Here's an example of how you can modify your query to achieve this:
SELECT MAX(CPUUtilization) FROM "AWS/EC2" WHERE Tag.Environment = 'YourEnvironment' GROUP BY InstanceId ORDER BY MAX() ASC LIMIT 10
In the above query, replace 'YourEnvironment' with the specific value of the tag key-value pair that represents your environment. By adding the WHERE clause with the appropriate tag filter, you can narrow down the instances to only those with the specified tag value.
Make sure you have applied the appropriate tags to your instances with the desired environment value. You can use the AWS Management Console, AWS CLI, or SDKs to add tags to your instances.
By adding the tag filter to your query, you'll limit the results to instances that match the specified environment, allowing you to create alarms specific to that environment.
Conteúdo relevante
- AWS OFICIALAtualizada há 5 anos
- AWS OFICIALAtualizada há 3 anos
Hi Good Afternoon Himanshu, Thanks for answaaring...
I tried to run the above query but It say syntax error.
Hey, ChatGPT answers in the exactly same wrong way. Good job.