What would be the BEST way to accomplish this?
Use an X-Version header to denote which version is being called and pass that header to the Lambda function(s).
Create an API Gateway Lambda authorizer to route API clients to the correct API version.
Create an API Gateway resource policy to isolate versions and provide context to the Lambda function(s).
Deploy the API versions as unique stages with unique endpoints and use stage variables to provide further context.
Explanations:
While using an X-Version header to denote versions might seem like a viable solution, it requires additional logic within the Lambda function to interpret and switch between versions, which is not the best approach for versioning at the API Gateway level.
Lambda authorizers are used for authorization and access control, not for routing or versioning purposes. Using them for API version routing is not ideal.
API Gateway resource policies are designed for controlling access and security, not for version management. They do not help in routing requests to different Lambda versions.
Deploying the API versions as unique stages with unique endpoints and using stage variables is the best approach. This allows for proper versioning at the API Gateway level and offers the flexibility to manage different versions of the Lambda function with stage-specific configurations.