I want to use Kong as an API gateway for all my upstream services. And I want to use API Keys so my customers can use that to use some APIs they are allowed to use.
There is a plugin for managing API Keys: https://docs.konghq.com/hub/kong-inc/key-auth/
But I'm wondering if I can add properties to some API key or link it to some configuration.
Let me explain with an example:
I have 3 apis
- API 1
- API 2
- API 3
On the Kong API Gateway I want to use rate limiting. So I want to generate API keys for 2 customers with some properties
- customer X: basic subscription which has a rate limit of 10 requests per minute for API 1 and 20 requests per minute for API 2
- customer Y: premium subscription on API 2 which has a rate limit of 5000 requests per minute and 1000 requests per minute for API 3
So in Kong I create 3 services for those 3 APIs and add the rate limit plugin to that. Is there any way to let the rate limit plugin know (based upon the API key that is sent in the request) what limit it should use for that request that just has been entered?
I seems to me that I need to create new services for the same APIs every time with a specific rate limit with a specific value. This feels a bit unmanageable when dealing with a lot of customers and apis.
Is it possible to fetch the rate limit value based upon the API key that is passed through?
Or is there any solution to do so? Or is this the actual behaviour we want in an API gateway, if yes, why?