Getting started with Python AWS Lamda function? - SST Guide Forums
Streaming Response from Lambda in Python
So what does a well-made AWS Lambda in Python actually look like?
Is Python a good choice for efficient Lambda functions?
the thing to keep in mind with lambda is you don't get a full vcpu of compute until your function memory is 1,769mb or higher (https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html). if your function would benefit from multiple cores, i.e. is multithreaded with parallel busy threads, you'll need to scale up multiples of that to get more vcpus.
other than that, lambda runs on ec2 so the premise of your question is a little weird. runtime choice affects cold start time and how much memory you'll need just for overhead. other than that it has nothing to do with efficiency.
More on reddit.comI've been losing myself in rewriting a bunch of lambda functions. I can't help but notice that there's a bunch of different opinions and philosophies that make up the bulk of the samples and documentation.
In my own team, one of the guys wrote his own test framework and schema validation library. Another wrote his own logging library and was a big fan of the Serverless framework. I've been using Lambda Power Tools and unittest myself but my lambdas are pretty vanilla. Three guys, three different development styles.
Everything feels so arbitrary and I'm not sure what actually constitutes a production-ready, well structured Python lambda.
FWIW We use terraform for initial project deployment with codebuild, and I have my own makefiles to deploy if I want to bother outside of it. Most of my lambdas are interfaced by AGW and interact with s3, dynamodb, and sagemaker.
Edit: to be clear - most of these are <200ms calls. I'm not trying to cram crazy things into a lambda. If anyone could share some code samples of some well-done Lambda's I'm happy.