简体   繁体   中英

Run golang lambda function locally

I'm trying to develop a lambda that has to work with S3 and dynamoDB. The thing is that because I am not familiar with the SDK of aws for go I will have lots of tests and tries. Each time I will change the code is another time I have to compile the project and upload it to aws. Is there any way to do it locally? pass some kind of configuration that lets me call the services of aws locally, from my computer? Thanks!

This has to do mostly with golang, other languages like python can run directly on the aws lambda function page, and node has cloud9 support.

You can use the lambci docker image(s) to execute your code locally using the same Lambda runtimes that are used on AWS.

https://github.com/lambci/docker-lambda

You can also run dynamo DB locally in another container as well

https://hub.docker.com/r/amazon/dynamodb-local/

To simulate credentials/roles that would be available on Lambda, just pass in your Api creds VIA environment variables. ( for s3 access )

Cheers -JH

You could use this aws-lambda-go-test module which can run lambda locally and can be used to test the actual response from lambda

full disclosure I forked and upgraded this module

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM