For a while I was looking for an easy we to test my lambda functions written in golang locally. We have awesome tools like LocalStack but this is not what I was looking for. I wanted to test my lambda function locally, without any dependencies. Something lighter without Docker . I will show you how to do that.
I have been avoiding Amazon DynamoDB for a long time. Each time I tried to use it, either with PHP or GoLang always gave up very quickly. A while ago, I built up a solution storing a lot of JSON files on S3 buckets, and the costs of this solution (number of GET requests) started to escalate very quickly. I decided to try to migrate data to DynamoDB, and this time I was successful. I will try to explain how I did it and what I learned along the way.
Postman, it’s a great tool for debuging, testing and other activities performed by us - developers. It has a build in option to sign requestes with AWS Signature . We do have AWS SDK for Go v2 , but I couldn’t find any good examples except a test file . The other useful file will be const.go where we can find a couple of interesting variables.
I wanted to implement a timeout in go routines. There are a couple o ways doing that. We could use
context.WithTimeout() or we go with classical
sync.WaitGroup group with a trick.
Let’s start with the first one.