Backend lambda(s) ?

Anyone have some good resources for managing infrastructure of a fuckton of lambdas. I am a daily terraform user but I’m tasked with using lambdas instead of a server. I have tried amplify but it doesn’t give me the same level of comfort as Terraform. My manager seems to think it’s okay to be clicking through everything, but if you ask me infrastructure as code is the way to go. Learning cloudformation also just feels like vendor lock in

Any lambda backend horror stories or good stories?

Edit: 100000 lambdas was an exaggeration

CDK is what we use at work to manage Lambdas and it’s been great.

You definitely don’t want to maintain this by hand. That’s a terrible idea and you’re right to find a way to codify and automate deployment. I don’t have any first-hand experience here though. I love terraform but it doesn’t seem like the right tool for the job, assuming this is for a web app.

If it’s for a web app I recommend checking out a framework built for that purpose like serverless if possible.

First of all WTF man! 100,000 Lambda?

I have not used Terraform myself, we use straight Cloudformation Templates deployed via Azure Devops->Code Pipeline->Code Build->Cloudformation Stack, but for your use case of 100,000 lambda’s to manage. You have to use Infrastrucutre as Code, I can’t imagine having to recreate that via the console even if you only had 50.

If you are familiar with Terraform I would continue to use that. You have so many Lambda’s to deploy I would think you need to create your own small application to just keep track of them. Can you interface Terraform with a dynamodb table (or a local db) to keep all of the parameters for deployments stored there? Then just loop thru the table to deploy your lambdas.

I am not sure if Terraform is able todo this, but it seems the cleanest. In most of the other deployment options you would me managing 100,000 deployment yaml files, ugh!

Okay guys I don’t actually have to deal with 100000 lambdas, it was an exaggeration, the app will probably need about 200 by the time it’s all done

Yooo you got me thinking :thought_balloon: I could potentially have a json that keeps track of all the lambdas and deploy them that way

Serverless is so ass compared to terraform though, I need more functionality

Yeah, that will work. It will be big damn json file, lol.

I’ve heard good things about Pulumi. It seems to support terraform providers in addition to its own, which is interesting. https://www.pulumi.com/docs/tutorials/aws/rest-api/

Hang on…you have a manager who thinks you should be clicking through the console in production?

What’s wrong with managing your lambdas with terraform?

What kind of functionality are you looking for that serverless doesn’t provide?

Spin up RDS and pass me the IP

You can define resources (like RDS instances) via cloud formation template syntax within your serverless configuration file.

AWS CDK is another option for a more programmatic approach if you don’t like cloud formation templates.

To the boss who likes the console: what if you mis-click? What if you need to make the same change to 10 or 100 resources? After you make a change to your staging environment, how do you make the same change to production?

IaC is the way to go. You get dev-level support for operations: testing, preview to the business, consistency, confidence. Version control!

(FYI CloudFormation is fine. It’s solidly supported by AWS. Many companies whine about “vendor lock in”, but they rarely actually move.)

Terraform is great. Build a module that wraps Lambda, making it easy for the devs to get their job done and the module will take care of the lower-level details.

CDK is also great, and it can do Terraform as a backend – you get the best of both worlds! CDK will create permissions for you, which is a tremendous help.

Source: DevOps consultant to enterprises. Learned CloudFormation this year when studying to get my Cloud Developer Associate certificate.

Good point about the different environments​:ok_hand:

Terraform IAM through CDK??

That sounds litty

Might not be exactly what you are looking for but if you go the CDK route, we created a framework with a local development environment specifically for Lambda — GitHub - anomalyco/sst: Build full-stack apps on your own infrastructure. · GitHub

It even allows you to debug and test them live in VS Code. Here’s a short clip of it in action —

Why not use terraform for managing and deploying the lambdas then?

Feel like I missed something here.

My team manages about 90 lambdas right now using terraform. It’s a standard pattern for them to get started. Then if they need to add other things, they can in the same set of terraform.

Learning cloudformation also just feels like vendor lock in

You are already using Lambda. You are already locked in. Embrace it.