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 fo
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).
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.