Testing AWS Lambda locally

别来无恙 提交于 2019-12-25 09:50:00

问题


I am about to write a server component targeting AWS lambda. How do I develop this locally without having to deploy this every time I make a change?


回答1:


Without knowing more about your project, the only thing I can recommend is for you to build a minimal web server application that will create your event object based on the request that you send.

In NodeJS, you can do this by writing a minimal express server that invokes your lambda handler in its route handler.

If you use serverless framework, you can use a plugin called serverless-offline.




回答2:


You can use Sam Local.

Main features

  • Develop and test your Lambda functions locally with sam local and Docker
  • Invoke functions from known event sources such as Amazon S3, Amazon DynamoDB, Amazon Kinesis, etc.
  • Start local API Gateway from a SAM template, and quickly iterate over your functions hot-reloading
  • Validate SAM templates


来源:https://stackoverflow.com/questions/46763130/testing-aws-lambda-locally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!