How to configure different APIGateway endpoints for lambda versions $LATEST and live AutoPublishAlias
I'm using SAM with AutoPublishAlias safe lambda deployments. However, in the Pre-traffic hook, I'd like to run some initial validation tests by invoking the latest [unvalidated] lambda version through an AWS API Gateway endpoint that's different from the endpoint that points to stable lambda version.
In my case, it's quite challenging to call the lambda function directly by by-passing APIGateway in the pre-traffic hook because the lambda function includes whitelisting and other logic that requires values set by API Gateway proxy integration. Ideally, I'd like to have 2 API gateway endpoints that always point to the live & latest versions of the lambda function as follows:
/api/resource -> lambdaFunction:live
/api/latest_resource -> lambdaFunction:$LATEST
This way, the pre-traffic hook can always use /api/latest_resource while customers use /api/resource. So far, I've not been able to figure out a way to configure this in SAM AWS::Serverless::Function or AWS::Severless::Api.
Does anyone have an example or idea of how to configure this?
+1, Being able to test the canary lambda through an API Gateway as a consumer would do seems essential to being able to get full value out canary deployments.