Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

creating development and production versions of lambda functions

What's the best practice for having different environments for lambda functions, i.e. dev/prod

Should I just have two lambda functions one called myFunction-prod and myFunction-dev or is there a better way to create environments.

I saw that Amazon API Gateway has a notion of "Stages" which accommodates separation of dev, staging and production versions of code.

Is there a similar notion with Amazon Lambda?

like image 525
MonkeyBonkey Avatar asked Jul 23 '15 17:07

MonkeyBonkey


1 Answers

You can use AWS Gateway API. Once you created the lamdba functions, create a gateway which points to your lambda function. This can be done easily selecting using a dropdown.

As you mentioned, you can create 2 stages(live and staging) and map the appropriate gateway URLs to the stages. Then by selecting the appropriate method in stages, you can get the REST URL to access the stage. For example, someurl/live and someurl/staging.

Also, while deploying the lamda function changes, choose the appropriate stage to deploy and test it out using the staging URL. Once its done, deploy the function to your live stage.

like image 60
Shyam Prasad Avatar answered Sep 28 '22 04:09

Shyam Prasad