r/awslambda • u/appychip • Oct 30 '17
r/awslambda • u/[deleted] • Oct 27 '17
Going Serverless | AWS Lambda and Kinesis streams at busuu
r/awslambda • u/lambrospetrou • Oct 11 '17
AWS Lambda meets Racket (or any compiled language)
r/awslambda • u/rsh210m • Sep 28 '17
New dev environment for AWS Lambda
It's a new open-source project focusing on development involving AWS Lambda. It enables development of Lambda functions in a dev-friendly environment (local development experience), yet running in full context of a real life AWS Lambda environment. More details can be found in GitHub https://github.com/minutelab/mless. We hope you find it handy and valuable, as always - any feedback (let alone contributors) are more than welcome!
r/awslambda • u/Reggie3 • Jul 05 '17
Building Lambda Test Configurations the Easy W
Quick blog post on creating Lambda test configurations
“Testing AWS Lambda Functions the Easy Way” @reginald3 https://medium.com/@reginald.johnson/testing-aws-lambda-functions-the-easy-way-41cf1ed8c090
r/awslambda • u/MattiasAndersson • May 17 '17
AWS X-Ray Makes AWS Lambda Request Tracing Generally Available
r/awslambda • u/mavi888 • Feb 07 '17
CODE WITH ME | SERVERLESS SLACK APP | PART 1 | FooBar
r/awslambda • u/YifatDanieli • Nov 10 '16
AWS Lambda: Features, Limitations and A Few Practical Examples
stratoscale.comr/awslambda • u/ayuuuss • May 10 '26
Unable to load .pkl ML model for AWS Lambda (dependency/version issues) – tried EC2 also
Hi, I’m trying to deploy a machine learning model on AWS Lambda.
I have:
a .pkl file (saved using joblib)
a lambda_function.py file to load and run predictions
My goal is to deploy this on Lambda, but I was getting dependency issues, so I tried setting it up on an EC2 instance first to debug.
However, I’m facing multiple errors while loading the model, and I don’t have access to the original environment or requirements.txt (my friend trained the model and hasn’t shared it yet).
Errors I’ve encountered:
ModuleNotFoundError: No module named '_loss'
ModuleNotFoundError: No module named 'numpy._core'
ValueError: MT19937 is not a known BitGenerator module
What I’ve tried:
Creating virtual environment on EC2 (Ubuntu)
Installing different versions of numpy, scipy, scikit-learn, joblib, xgboost
Matching sklearn version (1.7.2 from warning)
Re-downloading the .pkl file
Trying Docker build for Lambda image
Still not working.
Current setup:
AWS Lambda (target)
EC2 Ubuntu instance (for testing)
Python 3.10
joblib for loading model
Code:
import joblib
data = joblib.load("clinical_trial_pipeline_v1.pkl")
model1 = data['model1'] scaler1 = data['scaler1']
X = [[1,2,3,4]] X_scaled = scaler1.transform(X) prediction = model1.predict(X_scaled)
print(prediction)
My questions:
Is it possible to recover or infer the correct environment from a .pkl file?
Is this likely due to version mismatch between numpy/sklearn?
What’s the best way to make this work for AWS Lambda without original requirements.txt?
Any help would be really appreciated I’ve been stuck for 2 days trying to fix this.
r/awslambda • u/Dangerous_Word_1608 • May 16 '24
text to speech and speech to text response time
dealing with aws lex bot, I figure out that each time I call the bot through amazon connect / genesys cloud or simply by testing the bot through aws console voice input, the response time for the transition between slots take some time (2-3) seconds witch is a little bit annoying when dealing with many slots....
my direct question is there a way to minimize the time for the TTS and STT ?
r/awslambda • u/MrxR3d • May 07 '24
Migrating AWS Lambda functions from the Go1.x runtime
I have been working on Migrating AWS Lambda functions from the Go1.x runtime to the custom runtime on Amazon Linux 2, Created the sprint script to list lambda func in all region
https://github.com/muhammedabdelkader/Micro-Sprint/blob/main/reports/list_lambda.sh
Don't forgot the filter command
r/awslambda • u/derkrampus • Apr 29 '24
In a lambda triggered by an sqs queue, what is the default behavior for message deletion?
In a lambda triggered by a traditional sqs queue, what is the default behavior for message deletion?
If no explicit action is taken, and the lambda execution succeeds, will the lambda delete the sqs incoming sqs messages?
By default, ReportBatchItemFailures is disabled.
Does the behavior change if the lambda deletes any of the incoming messages explicitly?
IMO this page isn't the clearest https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
Thank you in advance!
r/awslambda • u/No-Ganache4424 • Apr 26 '24
Deploying pretrained model on a server for Realtime image processing [D] [R] [P]
I have a flask application, which uses a pretrained ml model ,whose main task is to find embeddings of an image, at a time there may be 100s of images for processing, lets suppose that the 100 image processing takes 80sec to complete, how should i deploy the application on AWS or any other cloud service, such that it takes only 4-5 seconds to process 100 images.
r/awslambda • u/TobalOW • Apr 23 '24
[Java Lambda - Help] Running a Simulation Model
My client has requested the execution of a simulation model (model.jar) exported from AnyLogic. The export provides everything needed to run the model, including a "lib" folder containing all required files.
Considering the model execution takes less than 15 minutes and utilizes 5GB of RAM, running it on an AWS Lambda function is a good solution for me. I was thinking that the solution could have these steps:
Store all exported AnyLogic files in an Amazon S3 bucket.
Download the necessary files within the Lambda function.
Execute the simulation model using Process Builder.
Save the execution results back to the S3 bucket.
Would that be a good solution? Here is an SS of the files that I have.

r/awslambda • u/redd-dev • Apr 22 '24
How to set the LLM temperature, model ARN and AWS Knowledge Base for an AI chatbot built using AWS Bedrock + invoke_agent function + AWS Lambda
Hey guys, so I am referring to this documentation below on AWS Bedrock's "invoke_agent" function:
In the "responses" variable, how do I specify the LLM temperature, model ARN and AWS Knowledge Base?
Would really appreciate any help on this. Many thanks!
r/awslambda • u/thebackendmonk • Apr 14 '24
struggling with structuring my lambda python 3 application
Hey AWS lambda experts
I am a Lambda Python newbie and I am struggling with structuring my application to run correctly on AWS Lambda. So, I am reaching out to the experts as my last resort.
My application is structured (as below) and packaged into a zip file.
app.py
folder_name
├── configs
│ └── mysql_db_configs.py
├── db
│ └── query_executor.py
├── enums
│ └── mysql_config_prop.py
My questions are:
How should I import my dependencies into my app.py file?
If I have an external 3rd-party dependency, how should I include them?
If my handler is located in app.py, what handler value be?
r/awslambda • u/Halvv • Apr 14 '24
Trying to read and write file from S3 in node.js on Lambda
Hello,
my simple test code reading from and writing to S3 is:
import * as AWS from 'aws-sdk';
const s3 = new AWS.S3();
exports.handler = async (event) => {
const bucket = process.env.BUCKET_NAME || 'seriestestbucket';
const key = process.env.FILE_KEY || 'timeseries.csv';
const numbers = [1, 2, 3, 4, 5]; // Example data for manual testing
const mean = numbers.length ? numbers.reduce((a, b) => a + b) / numbers.length : 0;
const meanKey = key.replace('.csv', '_mean.txt');
await s3.putObject({
Bucket: bucket,
Key: meanKey,
Body: mean.toString(),
}).promise();
};Unfortunately I get the following error even though I have seen on several sites that this should work
{
"errorType": "Error",
"errorMessage": "Cannot find package 'aws-sdk' imported from /var/task/index.mjs",
"trace": [
"Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'aws-sdk' imported from /var/task/index.mjs",Thanks for every help
r/awslambda • u/redd-dev • Apr 07 '24
How to deploy a RAG-tuned AI chatbot/LLM using AWS Bedrock
Hey guys, so I am building a chatbot which uses a RAG-tuned LLM in AWS Bedrock (and deployed using AWS Lambda endpoints).
How do I avoid my LLM from being having to be RAG-tuned every single time a user asks his/her first question? I am thinking of storing the RAG-tuned LLM in an AWS S3 bucket. If I do this, I believe I will have to store the LLM model parameters and the vector store index in the S3 bucket. Doing this would mean every single time a user asks his/her first question (and subsequent questions), I will just be loading the the RAG-tuned LLM from the S3 bucket (rather than having to run RAG-tuning every single time when a user asks his/her first question, which will save me RAG-tuning costs and latency).
Would this design work? I have a sample of my script below:
import os
import json
import boto3
from langchain.document_loaders import PyPDFLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.embeddings import BedrockEmbeddings
from langchain.vectorstores import FAISS
from langchain.indexes import VectorstoreIndexCreator
from langchain.llms.bedrock import Bedrock
def save_to_s3(model_params, vector_store_index, bucket_name, model_key, index_key):
s3 = boto3.client('s3')
# Save model parameters to S3
s3.put_object(Body=model_params, Bucket=bucket_name, Key=model_key)
# Save vector store index to S3
s3.put_object(Body=vector_store_index, Bucket=bucket_name, Key=index_key)
def load_from_s3(bucket_name, model_key, index_key):
s3 = boto3.client('s3')
# Load model parameters from S3
model_params = s3.get_object(Bucket=bucket_name, Key=model_key)['Body'].read()
# Load vector store index from S3
vector_store_index = s3.get_object(Bucket=bucket_name, Key=index_key)['Body'].read()
return model_params, vector_store_index
def initialize_hr_system(bucket_name, model_key, index_key):
s3 = boto3.client('s3')
try:
# Check if model parameters and vector store index exist in S3
s3.head_object(Bucket=bucket_name, Key=model_key)
s3.head_object(Bucket=bucket_name, Key=index_key)
# Load model parameters and vector store index from S3
model_params, vector_store_index = load_from_s3(bucket_name, model_key, index_key)
# Deserialize and reconstruct the RAG-tuned LLM and vector store index
llm = Bedrock.deserialize(json.loads(model_params))
index = VectorstoreIndexCreator.deserialize(json.loads(vector_store_index))
except s3.exceptions.ClientError:
# Model parameters and vector store index don't exist in S3
# Create them and save to S3
data_load = PyPDFLoader('Glossary_of_Terms.pdf')
data_split = RecursiveCharacterTextSplitter(separators=["\n\n", "\n", " ", ""], chunk_size=100, chunk_overlap=10)
data_embeddings = BedrockEmbeddings(credentials_profile_name='default', model_id='amazon.titan-embed-text-v1')
data_index = VectorstoreIndexCreator(text_splitter=data_split, embedding=data_embeddings, vectorstore_cls=FAISS)
index = data_index.from_loaders([data_load])
llm = Bedrock(
credentials_profile_name='default',
model_id='mistral.mixtral-8x7b-instruct-v0:1',
model_kwargs={
"max_tokens_to_sample": 3000,
"temperature": 0.1,
"top_p": 0.9
}
)
# Serialize model parameters and vector store index
serialized_model_params = json.dumps(llm.serialize())
serialized_vector_store_index = json.dumps(index.serialize())
# Save model parameters and vector store index to S3
save_to_s3(serialized_model_params, serialized_vector_store_index, bucket_name, model_key, index_key)
return index, llm
def hr_rag_response(index, llm, question):
hr_rag_query = index.query(question=question, llm=llm)
return hr_rag_query
# S3 bucket configuration
bucket_name = 'your-bucket-name'
model_key = 'models/chatbot_model.json'
index_key = 'indexes/chatbot_index.json'
# Initialize the system
index, llm = initialize_hr_system(bucket_name, model_key, index_key)
# Serve user requests
while True:
user_question = input("User: ")
response = hr_rag_response(index, llm, user_question)
print("Chatbot:", response)r/awslambda • u/subhavignesh • Mar 26 '24
Using class not able to fetch the data inside the s3 buckt
Hi guys
The below boto3 python code needs to retrieve the files inside the s3 bucket, but it's only giving output for one bucket which is "test-draft-s3".not getting the output for "test-draft2-s3".please tell what I need to do in my code to get the output for both the s3 buckets.
r/awslambda • u/SkipThatShitPlz • Mar 23 '24
How to embed marshalled protobuf message in data field of test kinesis event?
r/awslambda • u/WayNo6737 • Mar 17 '24
HTML contact form to email
Hi, I need help to setup lambda function to send email that trigger by a html contact form,
r/awslambda • u/smartcoding • Feb 11 '24
AWS Lambda Tutorial For Beginners | What is AWS Lambda? | AWS Lambda For Beginners
r/awslambda • u/Halvv • Feb 10 '24
Request Body missing in Lambda and no idea why
Hello,
lambda function code is
"import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { PutItemCommand } from "@aws-sdk/client-dynamodb";
const dynamodb = new DynamoDBClient({});
const handler = async (event) => {
try {
// Check if event.body is undefined
if (!event.body) {
throw new Error("Request body is missing");
}
....."
this error is now always thrown. I tried this curl request:
curl -X POST -H "Content-Type: application/json" -d "{\"value\": 123}" APILINK
and also have an app trying a call so I don't think both of the calls are wrong as I also checked them with chatgpt.
ty for any help
r/awslambda • u/Halvv • Feb 09 '24
Trying to access DynamoDB in node.js (fails to download aws-sdk)
Pretty much all described in title; I tried "require" and "import" to get the aws-sdk into my node.js code.
Any common pitfalls/tipps?
