根据 API key 监控 API Gateway API [英] Monitor API Gateway APIs based on API key
问题描述
我如何才能明智地监控我的 Amazon API Gateway APIs API 密钥?
How can I monitor my Amazon API Gateway APIs API key wise?
目前它显示所有 API 密钥的数据,但我想显示特定 API 密钥的 API 调用、5xx 错误、4xx 错误等.
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.
推荐答案
如果您希望在 X-Api-Key
标头级别监视 API,目前看来这是不可能的.我猜你必须在应用层自己做,如果你使用 Lambda
,这应该相对容易.您的问题引出了另一个问题:当错误与特定 API 部署/版本相关联时,监控各个 API 密钥真的有意义吗?
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?
如果您想监控每个用户的使用情况,您需要使用带有 API 的 IAM
凭据和 CloudTrail
来监控使用特定凭据发出的请求.您可以在 API Gateway CloudTrail 集成页面上找到更多信息.
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.
这篇关于根据 API key 监控 API Gateway API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!