June 05, 2020 / 2 minutes / #AWS #Golang #Lambda #CDK
Over 500 programmers expressed the interest, however, it's not there yet. Don't get me wrong, I'm not mad, CDK team is doing amazing job and just I suppose that's because of the fact that their team is rather small and has a lot of other issues to tackle (there are over 1120 of them as I'm writing this article).
As I believe in Open Source, I decided to solve this issue. I pulled the source of aws-cdk and decided to replicate the functionality of NodejsFunction but for Go.
The result of my work is here: aws-lambda-golang-cdk on Github What does it do? It compiles Golang based Lambda functions as a part of CDK synth process.
Usage of Lambda Golang construct in CDK is very simple:
First, we define a very simple CDK-powered Stack - a Rest API using API Gateway.
aws-lambda-golang construct, define a new function using it and plug to API Gateway. And that's it!
If you don't like this animation, head to project Readme
Now, all you need to do is define your Golang function inside
Special kudos go to Matthew Bonig. He not onlt wrote an article about creating CDK constructs which helped me to figure out the JSII part, which made this module compatible with Python, .NET and Java stacks, but also provided a lot of feedback personally.