AWS Lambda Deployment using Terraform

Posted on
aws lambda news terraform

AWS Lambda Deployment using Terraform

Recently a question got asked on Hacker News that grabbed my attention. I wanted to know how others’ experience has been. At ACL, we have multiple Lambda functions that we heavily rely on, and we use Terraform to deploy them.

It’s been working well for us, so I was curious to know how others have approached Lambda. However, it seemed that others were struggling: In short, I was left wondering “why don’t people simply use Terraform?” That’s why I’m writing this post.

I want to share with you how you can overcome almost all of the concerns raised in Hacker News when you use Terraform in its full capacity. Don’t beFooledYou may be thinking that all it takes to deploy Lambda with Terraform is to:Create a JavaScript file. Create a Terraform configuration file that references that JavaScript file.

Apply Terraform. Celebrate!Wrong. Those four steps would technically deploy Lambda, yes.

But, by those standards, we’d also be “deploying” if we SSH’d onto servers and copy-and-pasted our source code onto it. It’s not enough to just create an AWS Lambda resource. There’s much more to it than that.

The Misunderstanding around AWSLambdaIf you’ve ever watched an AWS Lambda related presentation, you’ve probably noticed that the presenter quickly glosses over the diligence required around Lambda because of it being “just a function”. That’s unfortunately a gross simplification of Lambda and the architecture underlying it. Just because a codebase is small, does not mean the codebase does not require the same diligence as other codebases.