amazon-web-servicesamazon-cloudwatch

How to show only unique rows in CloudWatch output?


I have a CloudWatch query that creates a table of output that looks something like:

id    | name   | age
1313  | Sam    | 24 
1313  | Sam    | 24 
1313  | Sam    | 24 
1481  | David  | 62
1481  | David  | 62
3748  | Sarah  | 37
3748  | Sarah  | 37
3748  | Sarah  | 37
1481  | David  | 62

Is there a way to have CloudWatch automatically deduplicate its output, so I just see:

id    | name   | age
1313  | Sam    | 24 
1481  | David  | 62
3748  | Sarah  | 37

Solution

  • You can calculate an aggregated value across these 3 fields and then drop it (keep just these 3). Like this for example:

    YOUR CURRENT QUERY | count(*) by id, name, age | display id, name, age