Reputation: 19
I want to monitoring "How many api call on AWS API GATEWAY".
I can monitoring API call using "Usage Plans" on AWS console. Usage Plans => Select Plans => API Keys => Select API Key => Click Usage.
How implement it using node.js?
Upvotes: 0
Views: 302
Reputation: 19
Solved. This is the code for get API call count.
var AWS = require('aws-sdk');
var apigateway = new AWS.APIGateway({
apigateway: '2015-07-09',
accessKeyId: '',
secretAccessKey: '',
region: '',
});
var params = {
endDate: '', /* required */
startDate: '', /* required */
usagePlanId: '', /* required */
keyId: '',
};
apigateway.getUsage(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
Source : AWSJavaScriptSDK
Upvotes: 0
Reputation: 269550
From Amazon API Gateway Dimensions and Metrics - Amazon API Gateway:
Count
: The total number API requests in a given period.
So, you can obtain this information directly out of Amazon CloudWatch.
Upvotes: 1