Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to point ApiGateway to a specific Lambda alias

I created a resource in Amazon's ApiGateway. It is pointing to a Lambda function. This is being hit by a native mobile application (android and ios) which is already in the wild.

I now want to modify the Lambda function, but I see no way to change my ApiGateway resource to point to an alias of the lambda. This is my first time playing with any of these technologies and I see no easy mechanism to manage this in the aws console.

How can I modify my ApiGateway resource to point to my lambda alias so I can edit trunk without affecting existing clients?

like image 910
digitaljoel Avatar asked Feb 18 '16 04:02

digitaljoel


People also ask

How do I point API gateway to a specific Lambda version?

Update Lambda function code, deploy and publish a new version. Go to API Gateway > stages > stage variables and update the “lambda_function_version” value with the new version number. Run the Lambda add-permissions command for this new version. Deploy the API on the required stage.

Can API gateway trigger Lambda?

In this blog, we'll write an AWS lambda function which will be triggered by Amazon API Gateway. According to API gateway documentation, AWS API gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor and secure APIs.


1 Answers

Under Integration Type -> Lambda Function you need to add a reference to the stage variable MyLambdaFuntionName:${stageVariables.lambdaAlias} and then for each stage set the lambdaAlias in the Stage Variables tab accordingly(lambdaAlias=dev, lambdaAlias=prod, etc.)

There is an example with screenshots here: https://aws.amazon.com/blogs/compute/using-api-gateway-stage-variables-to-manage-lambda-functions/

Its kind of hidden towards the very bottom of the page starting with "Alternatively, you can mix and match static names"

like image 186
Ryan Avatar answered Oct 28 '22 08:10

Ryan