Monitor API Gateway APIs based on API key

99封情书 提交于 2019-12-02 10:31:32

问题


How can I monitor my Amazon API Gateway APIs API key wise?

Currently it is showing data for all API keys, but I want to display API calls, 5xx errors, 4xx errors etc for particular API key.


回答1:


If you're looking at monitoring the API on X-Api-Key header level, it looks like this is currently not possible. I'm guessing you'd have to do it yourself on the application layer, which should be relatively easy if you're using Lambda. Your question brings up another question: Does it really make sense to monitor individual API keys when errors are associated with particular API deployment/version?

If you'd like to monitor per-user use, you need to make use of IAM credentials with your API and CloudTrail to monitor requests made with specific credentials. You can find more info on the API Gateway CloudTrail integration page.




回答2:


API Gateway doesn't (yet) offer first-class support for API Key metrics. As @kixorz mentioned, you could implement this in the application layer for the time being (for example using Lambda and CloudWatch).



来源:https://stackoverflow.com/questions/32313393/monitor-api-gateway-apis-based-on-api-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!