🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with python
Building Lambda functions with Python - AWS Lambda
It relays any logs that your function outputs during invocation. If your function returns an error, Lambda formats the error and returns it to the invoker. ... The version of the AWS SDK included in the Python runtime depends on the runtime version and your AWS Region.
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › create your first lambda function
Create your first Lambda function - AWS Lambda
For Runtime, choose either Node.js 24 or Python 3.14. Leave architecture set to x86_64, and then choose Create function. In addition to a simple function that returns the message Hello from Lambda!, Lambda also creates an execution role for your function. An execution role is an AWS Identity ...
Discussions

AWS Lambda functions using the Python 3.8 runtime
Go into your personal health dashboard. The notification should show the impacted functions. Once you find the function(s) you need to update to a newer python runtime. That could be as easy as just changing the runtime version in the console, but you also may need to make code changes More on reddit.com
🌐 r/aws
12
4
April 24, 2024
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.com
🌐 r/aws
5
1
November 18, 2022
Why or why not use AWS Lambda instead of a web framework for your REST APIs? (Business projects)
To clarify a couple of things: AWS Lambda is one of many ways to deploy code on AWS. AWS Lambda ECS EC2 EKS etc... You can deploy almost any type of code on all of these including a python API. What makes AWS Lambda special is: You can deploy docker containers, or .zip files. LINK It is 100% "serverless", AKA AWS manages the server for you, and you just tell AWS how many instances you want to run. This is done with Firecracker LINK It can scale from 0-10,000+ instances really quickly It can be very cheap vs a EC2 instance if you have a bursty load You can string together multiple Lambda functions using AWS Step Functions LINK You can trigger the lambda functions with a wide range of things. LINK You can run numerous functions in parallel. Stateless (ish, you can have state, but don't do that) This is both positive and negative. Most modern code should be stateless. IE, you should be able to kill it at any point, and run it again. The state should be stored in a database, not locally with the code. AWS Lambda has some downsides: It can be expensive if you have a constant load Data processing, 5+ minute loads, etc. Most light/fast APIs will be much cheaper on Lambda than a tradition ECS + EC2 setup. Testing locally is annoying LINK Lambda does some weird things with requests. You need to add some middleware to handle it. LINK Cold starts! If you haven't called your Lambda in ~15 minutes, the next call can take much longer to start. LINK You don't have control, so if something goes wrong with AWS Lambda, you can't do anything about it. 15 minute max You can only keep a lambda up for a max of 15 minutes. For an API this is more than enough, but for a larger job you should look somewhere else (ECS Fargate, AWS Batch) Other limits (CPU, Time, RAM, etc.) LINK Other, more “traditional” ways to deploy a web API would be AWS ECS or AWS EC2. ECS offers something called Fargate. It is built on the same serverless framework (Firecracker) and will let you deploy code without dealing with the underlying hardware. This has a lot of the same advantages as AWS Lambda without most of the disadvantages. Now to the question I suspect you are really asking. "When should I use a Web API vs another processing method like a queue consumer, map reduce job, ETL pipeline, batch job, etc?" That is a very hard question to answer, and it depends on exactly what you are trying to do. Based on your post history, I assume you are trying to move a monolithic ERP system to microservices? EDIT: Sorry about the spam edits, I decided to move to my computer and give a better answer. More on reddit.com
🌐 r/Python
29
83
January 11, 2023
So what does a well-made AWS Lambda in Python actually look like?
I've written probably 50 lambdas in Python at this point and to be honest keeping it simple is the best way. Follow PIP standards to keep your code readability high, use the paginator objects boto3 provides where possible and try to keep the execution time down.15 minutes is pretty high for something serverless so I tend to design my lambdas to perform a single task and then use something like AWS Step Functions to orchestrate several in a flow or in Map states (loops). I also make use of environment variables where possible and template a lot of functions for common things like assuming roles. I also make use of comprehension but don't go too overboard with that because it can reduce readability if you've got a fat one defined haha. No need to add comments every other line, just a single line docstring at the top of the function should be enough to describe it. There's also some neat docker commands out there to build all your packages into a single lambda layer using a requirements.txt, using the lambda image, and this should be possible to do with Terraform, or if you've only got one or two packages just prepare it in a CI/CD and use terraform to build and apply the layer. More on reddit.com
🌐 r/aws
18
24
September 22, 2023
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with python › define lambda function handler in python
Define Lambda function handler in Python - AWS Lambda
January 31, 2026 - The most common way to declare a handler function in Python is as follows: ... from typing import Dict, Any def lambda_handler(event: Dict[str, Any], context: Any) -> Dict[str, Any]: To use specific AWS typing for events generated by other AWS services and for the context object, add the aws-lambda-typing package to your function's deployment package.
🌐
Code Python
codepython.in › home › aws lambda and python: a beginner’s guide
AWS Lambda and Python: A Beginner's Guide
March 16, 2023 - In this post, we will be using the AWS Management Console to create a Lambda function. To create a Lambda function using the AWS Management Console: Go to the AWS Management Console. Click on the Services dropdown menu and select Lambda.
🌐
TutorialsPoint
tutorialspoint.com › aws_lambda › aws_lambda_function_in_python.htm
AWS Lambda Function in Python
Login to AWS console and create Lambda function and select the language as Python.
🌐
AWS
docs.aws.amazon.com › cdk › api › v2 › python › aws_cdk.aws_lambda.html
aws_cdk.aws_lambda — AWS Cloud Development Kit 2.241.0 documentation
API Reference · aws_cdk.aws_lambda · aws_cdk.aws_lambda · Package Overview · Previous Next · © Copyright 2026, Amazon Web Services · Built with Sphinx using a theme provided by Read the Docs
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with python › working with layers for python lambda functions
Working with layers for Python Lambda functions - AWS Lambda
(Optional) For Compatible runtimes, choose the Python runtime that corresponds to the Python version you used to build your layer. Choose Create. ... AWS CLI command. For the --layers parameter, use the layer ARN. The ARN must specify the version (for example, arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1). For more information, see Layers and layer versions. aws lambda update-function-configuration --function-name my-function --cli-binary-format raw-in-base64-out --layers "arn:aws:lambda:us-east-1:123456789012:layer:my-layer:1"
Find elsewhere
🌐
ECR Public Gallery
gallery.ecr.aws › lambda › python
AWS Lambda/python - Amazon ECR Public Gallery
Amazon ECR Public Gallery is a website that allows anyone to browse and search for public container images, view developer-provided details, and see pull commands
🌐
AWS
docs.aws.amazon.com › cdk › api › v2 › docs › aws-lambda-python-alpha-readme.html
@aws-cdk/aws-lambda-python-alpha module · AWS CDK
new python.PythonFunction(this, 'MyFunction', { entry: '/path/to/my/function', // required runtime: Runtime.PYTHON_3_8, // required index: 'my_index.py', // optional, defaults to 'index.py' handler: 'my_exported_func', // optional, defaults to 'handler' }); ... All other properties of lambda.Function are supported, see also the AWS Lambda construct library.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-lambda-anonymous-functions-filter-map-reduce
Python Lambda Functions - GeeksforGeeks
Lambda keyword (lambda): Defines an anonymous (inline) function in Python.
Published   1 week ago
🌐
Full Stack Python
fullstackpython.com › blog › aws-lambda-python-3-6.html
How to Create Your First Python 3.6 AWS Lambda Function - Full Stack Python
Amazon Web Services (AWS) Lambda provides a usage-based compute service for running Python code in response to developer-defined events. For example, if an inbound HTTP POST comes in to API Gateway or a new file is uploaded to AWS S3 then AWS ...
🌐
Medium
medium.com › @a.naitabdallah › unleashing-the-power-of-aws-lambda-functions-with-python-04167dc1f042
Unleashing the Power of AWS Lambda Functions with Python | by Nait abdallah abdallah | Medium
December 11, 2023 - To begin, navigate to the AWS Management Console and create a new Lambda function. Select Python as the runtime, and you’re ready to start coding. ... Define a handler function in your Python script, specifying the entry point for the Lambda function.
🌐
YouTube
youtube.com › playlist
AWS Lambda Functions with Python - YouTube
Quick series on using AWS Lambda Functions with Python
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with python › using the lambda context object to retrieve python function information
Using the Lambda context object to retrieve Python function information - AWS Lambda
in the powertools-lambda-python repository on GitHub. The following example shows a handler function that logs context information. import time def lambda_handler(event, context): print("Lambda function ARN:", context.invoked_function_arn) print("CloudWatch log stream name:", context.log_stream_name) print("CloudWatch log group name:", context.log_group_name) print("Lambda Request ID:", context.aws_request_id) print("Lambda function memory limits in MB:", context.memory_limit_in_mb) # We have added a 1 second delay so you can see the time remaining in get_remaining_time_in_millis.
🌐
Amazon Web Services
docs.aws.amazon.com › aws lambda › developer guide › building lambda functions with python › aws lambda function testing in python
AWS Lambda function testing in Python - AWS Lambda
is a Python library for mocking AWS services and resources, so that you can test your functions with little or no modification using decorators to intercept and simulate responses. The validation feature of the Powertools for AWS Lambda (Python)
🌐
Medium
medium.com › @terminalsandcoffee › creating-my-first-lambda-function-with-python-in-aws-2f04bb895ac3
Creating my first Lambda Function with Python in AWS | by Terminals & Coffee | Medium
April 13, 2022 - Creating my first Lambda Function with Python in AWS What is Lambda? It’s a serverless compute service that lets you run code without managing servers. Allows one to manage code and not worry about …
🌐
Simon Willison
til.simonwillison.net › awslambda › asgi-mangum
Deploying Python web apps as AWS Lambda functions | Simon Willison’s TILs
The zip file needs to contain both the Python code AND all of its dependencies - more on that to come. Our first function doesn't have any dependencies, which makes things a lot easier. Here's how to turn it into a zip file ready to be deployed: ... You only have to do this the first time you deploy a Lambda function. You need an IAM role that you can use for the other steps. ... aws iam create-role \ --role-name lambda-ex \ --assume-role-policy-document '{ "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "Service": "lambda.amazonaws.com" }, "Action": "sts:AssumeRole"} ]}'
🌐
DEV Community
dev.to › andreafalzetti › combining-nodejs-and-python-in-a-single-aws-lambda-function-53bl
Combining Node.js and Python in a Single AWS Lambda Function - DEV Community
March 17, 2023 - If successful, once you open ECR in your AWS console, it should look something like the following: This is the final part, but it requires attention because it's very different from how you would usually define your Lambda and its handler in serverless.yml. First of all: make sure to remove the handler: property that you usually have. ... functions: yourLambdaName: image: name: node16-python3-runtime command: - lib/functions/index.handler entryPoint: - '/lambda-entrypoint.sh'
🌐
Real Python
realpython.com › python-lambda
How to Use Python Lambda Functions – Real Python
December 1, 2023 - In this step-by-step tutorial, you'll learn about Python lambda functions. You'll see how they compare with regular functions and how you can use them in accordance with best practices.