Let's assume I want to have 2 stage environments for some REST API - prod and staging, and I'm using lambda+api gateway. How to set it up correctly?
As of my point of view, both environments should use the same Lambda function, but different versions of them. Each environment should use a different configuration (pointing to the different databases, or providing a different set of features flags etc), and the best way to provide a configuration is env variables.
But stages in API gateway do not support that, the only what is there, is stage variables, and I cannot figure out, how can I use them to "feed" different configs to the same lambda.
So how is it supposed to be done?