getting getmetrics data api calls under the account

0

How to find getmetrics data API call count per asset?

When checking my account cost I noticed a quite large number of Getmetrics Data API calls and i need to spend more money. How i can find to which or for which assets those getmetrics data API call is triggering?

asked 9 months ago317 views
2 Answers
0
Accepted Answer

{ "metrics": [ [ { "expression": "SELECT COUNT(CallCount)\nFROM SCHEMA("AWS/Usage", Class, Resource, Service, Type)\nWHERE Type = 'API'\nGROUP BY Service, Resource\nORDER BY COUNT() DESC\nLIMIT 20", "label": "${LABEL} [avg: ${AVG}]", "id": "q1" } ], [ "AWS/Usage", "CallCount", "Type", "API", "Resource", "GetMetricData", "Service", "CloudWatch", "Class", "None", { "yAxis": "left", "id": "m1" } ] ], "sparkline": true, "region": "eu-west-1", "view": "timeSeries", "stacked": false, "stat": "Sum", "period": 86400, "yAxis": { "left": { "label": "Count", "showUnits": false } }, "title": "Top 20 AWS APIs by the number of calls in your account" }

answered 9 months ago
0

When we access GetMetricData through AWS console, like using CloudWatch's dashboard to view graphs, it doesn’t charge Anything. AutoScaling service EC2 detailed monitoring also don’t affect GetMetricData API cost.

If an AWS console is calling GetMetricData on the public CloudWatch endpoint then it will trigger charges, but AWS console should not be doing this.

Can you check if there is any external log monitoring tool such as Grafana or any monitoring company(DataDog/New Relic), which might be using GetMetricData API to fetch the logs and this would be external to AWS and would incur charges. Any external company would be accessing this API through IAM role, so CloudTrail would be a good starting point for you to look assumeRole events events.

Hope you find this helpful.

Comment here if you have additional questions, happy to help.

Abhishek

profile pictureAWS
EXPERT
answered 9 months ago
  • Yes, an external monitoring tool is there. But how can this be tracked with in aws portal about the request count to each asset like ec2,rds etc...

  • I have been in this situation, like I mentioned, you should follow the cloudtrail route and look up for ** assumeRole** event for the user which is being used by external tool. Most of the GetMetricData API calls within AWS won't be charging you, substantial amount of cost would be coming from external calls. So please proceed with the cloudtrail analysis as I mentioned, you'll have the answer most likely.

    Comment here if you have additional questions, glad to help.

  • Actually, i know it is from an external provider but I am trying to figure out the request counts corresponding to each asset (EC2,RDS etc ...).

    I will get the total count via,

    { "metrics": [ [ "AWS/Usage", "CallCount", "Type", "API", "Resource", "GetMetricData", "Service", "CloudWatch", "Class", "None", { "yAxis": "left" } ]

    ],
    "sparkline": true,
    "timezone": "UTC",
    "region": "eu-west-1",
    "view": "timeSeries",
    "stacked": false,
    "stat": "Sum",
    "period": 86400,
    "yAxis": {
        "left": {
            "showUnits": true
        }
    }
    

    }

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions