Search code examples
amazon-web-servicesaws-cliamazon-cloudwatch-metrics

Nested Namespace in aws cloudwatch put-metric-data API


I am sending memory metrics of our EC2 instances to cloudwatch using put-metric-data API call. I am giving a custom namespace for these metrics. But is there a way for these namespaces to be nested so that I will be able to consolidate all my metric data?

For example, if we look into AWS service namespaces EC2, the metrics inside these namespaces will be aggregated ImageID, InstanceType, Per Instance Metrics etc. This can further be filtered using dimensions.

Is there any way to aggregate custom metrics like this?


Solution

  • Adding another dimenstion for the same namespace should work

    Example

    aws cloudwatch put-metric-data --metric-name memory-usage --dimensions sampleDimension=value --namespace "The-Namespace" --unit Percent
    
    aws cloudwatch put-metric-data --metric-name memory-usage --dimensions sampleDimension2=value --namespace "The-Namespace" --unit Percent
    

    I see no reason that this shouldn't work. Anyways, let us know