问题
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