Optimally I’d want to use my one Flask app and separate routes so that some route, or method, accepts certain API keys and others accept other API keys.
I view this as a simple way to separate admin routes from user routes.
But as far as I can tell API Gateway does not let me do that, am I wrong?
It seems that I’d have to deploy two different stages, which with my zappa config means deploying two different APIs.
That way I can have one usage plan for admins on the adminapi, with its own API keys. And other usage plans for users on the userapi with their own API keys.
Alternatively, you can create 2 different API Gateways, one “read-only” and one “admin” or “read-write”. Using separate stages is not sufficient since resources and methods are defined outside the stages and merely deployed into a stage. Stages are meant to be used for versioning and dtap like pipelines.
Thanks for confirming. I’ve been looking at a lambda authorizer for this purpose. I’ve used Cognito user pools from a Vue JS frontend before and I feel like it was a huge hassle and only suitable for GUI apps.
I’m making a CLI based app so I believe a lambda authorizer with its own store of JWT tokens will be simpler and faster.
In terms of design, wouldn’t it be better to have separate services for admin and client? This way, the different routes can be configured with different microservice and hence attaching separate API keys would be simpler. I am a newbie and I am not sure what is the right way, just want to gain more insights regarding this.