- Newest
- Most votes
- Most comments
To create a Lambda function with Python code, you should follow these steps:
-
For Question 1: Yes, you should select "Author from scratch" when creating your Lambda function.
-
For Question 2: After creating the function with basic information, you'll be able to add your Python code. Here's the complete process:
a. Open the Lambda console and click "Create function" b. Select "Author from scratch" c. Fill in the basic information:
- Function name: Enter a name for your function (e.g., "DeleteSnapshots")
- Runtime: Choose Python 3.12 or Python 3.13 (depending on your preference)
- Architecture: Leave as x86_64 d. Click "Create function" e. After the function is created, you'll be taken to the function configuration page where you can add your Python code in the code editor that appears.
The code editor will be displayed after the function is created, not during the initial creation step. This is where you can paste the Python code from the post you referenced.
If you're working with dependencies like boto3 (which is included in the Lambda Python runtime), you can use it directly in your code by adding import boto3 at the beginning of your function.
Sources
Building Lambda functions with Python - AWS Lambda
Create your first Lambda function - AWS Lambda
Create a serverless file-processing app - AWS Lambda
Ahh of course, I should have realized the adding code part was after the Lambda function setup, "After creating the function with basic information, you'll be able to add your Python code. " Thanks!
answered a year ago
Relevant content
asked 3 years ago
