DEV Community

Discussion on: Lambda Extension with Golang

Collapse
 
dorneanu profile image
Victor Dorneanu AWS Community Builders

Now think of the extension as a sidecar to your Lambda. It's running in an external process but in the same shared space as your primary Lambda code. This code is simply then exposed over an HTTP API of your choosing. Pretty cool isn't it?

yes, indeed!

I'm not really familiar with extensions and I do see the benefits. An extension feels like microservice at the moment (where you can fetch data from). What is the advantage of using extensions instead of deploying another lambda (in whatever language) and calling it in your (Go) code?

Collapse
 
benbpyle profile image
Benjamen Pyle AWS Community Builders

So it's very much like another Microservice but it gives you access into the Lambda runtime in order to handle events in the lifecycle. Such as Init, Invoke and Shutdown. The caching sample could easily just be the API call, but what I like about doing it this way is that I've wrapped all of the API processing logic up so that the Lambda doesn't need to know about the implementation. And you don't end up writing that same code over and over in different Lambdas. And if you have different languages, you could have 2 or 3 versions of it.

Datadog uses it heavily for observability and it's really nice. You could also implement some logging as well.

It's 100% not a "use all the time" thing, but it's just another tool in your toolbox that you can use if you need it.