Grafana CPU dashboard promql required

I’m seeing a discrepancy between AWS CloudWatch CPUUtilization (%) and Grafana CPU usage (%) for the same EC2 instance, and I’m trying to understand why the percentages don’t match.

Context:

  • AWS service: EC2

  • Metrics source in Grafana: Prometheus

  • CloudWatch metric: CPUUtilization (percentage)

  • Grafana metric: CPU usage calculated from node exporter metrics

Issue:
Even when observing the same time range, the CPU percentage shown in CloudWatch differs significantly from the CPU percentage displayed in Grafana.

Questions:

  1. How does CloudWatch calculate CPUUtilization, and how does that differ from Prometheus/Grafana CPU calculations?
    promql we use for grafana -
    100 *

    (

    1 -

    avg by (node)(

    rate(node_cpu_seconds_total{mode="idle",cluster="lk_prod", node=\~"$node"}\[$interval\])
    

    )

    )

Use CloudWatch datasource for aws instance
or try below query

100 * (1 - avg(rate(node_cpu_seconds_total{instance=“$node”, job=“$job”, mode=“idle”}[5m])) by (instance))

100 - (avg by (instance) (irate(node_cpu_seconds_total{instance=“$node”, mode=“idle”}[5m])) * 100)