Questions tagged [aws-lambda]

AWS Lambda is a compute service that lets you run code without the overhead of managing servers. (Not to be confused with the [lambda] tag, which instead refers to a type of function).

AWS Lambda is a cloud offering from Amazon Web Services (AWS). AWS Lambda is a serverless compute service that runs code in response to events and automatically manages the underlying infrastructure for you.

Resources

Tutorial

30649 questions
114
votes
10 answers

Why is this HTTP request not working on AWS Lambda?

I'm getting started with AWS Lambda and I'm trying to request an external service from my handler function. According to this answer, HTTP requests should work just fine, and I haven't found any documentation that says otherwise. (In fact, people…
awendt
  • 13,195
  • 5
  • 48
  • 66
113
votes
9 answers

AWS Lambda: Task timed out

We have been asked for my school project to write a Java code that runs in AWS Lambda. It is supposed to get the source code of the specific URLs and then upload it to an S3 bucket. The Java code should be running on AWS Lambda. I get the source…
jansv
  • 1,163
  • 2
  • 7
  • 9
113
votes
5 answers

Nodejs - Invoke an AWS.Lambda function from within another lambda function

I have the following function which I use to invoke a Lambda function from within my code. However when I try to use it within a Lambda function, I get the following error: AWS lambda undefined 0.27s 3 retries] invoke({ FunctionName:…
hyprstack
  • 4,043
  • 6
  • 46
  • 89
109
votes
3 answers

What is the difference between a Serverless Function, and a Lambda Function

I am playing around with the Cloudformation Serverless Transformation, and am trying to figure out how and when to use AWS::Serverless::Function or AWS::Lambda::Function. For some reason the Lambda version is used for SAM examples in AWS. This is…
Derrops
  • 7,651
  • 5
  • 30
  • 60
107
votes
5 answers

Can I limit concurrent invocations of an AWS Lambda?

I have a Lambda function that’s triggered by a PUT to an S3 bucket. I want to limit this Lambda function so that it’s only running one instance at a time – I don’t want two instances running concurrently. I’ve had a look through the Lambda…
alexwlchan
  • 5,699
  • 7
  • 38
  • 49
107
votes
17 answers

Can't get AWS Lambda function to log (text output) to CloudWatch

I'm trying to set up a Lambda function that will process a file when it's uploaded to an S3 bucket. I need a way to see the output of console.log when I upload a file, but I can't figure out how to link my Lambda function to CloudWatch. I figured…
ffxsam
  • 26,428
  • 32
  • 94
  • 144
103
votes
9 answers

AWS Lambda Error: "Cannot find module '/var/task/index'"

Node.js Alexa Task Issue I'm currently coding a Node.js Alexa Task via AWS Lambda, and I have been trying to code a function that receives information from the OpenWeather API and parses it into a variable called weather. The relevant code is as…
98
votes
9 answers

Cannot use Requests-Module on AWS Lambda

I need to do a rest-call within a python script, that runs once per day. I can't pack the "requests" package into my python-package using the AWS Lambdas. I get the error: "Unable to import module 'lambda_function': No module named…
codepleb
  • 10,086
  • 14
  • 69
  • 111
97
votes
7 answers

What would be the AWS equivalent to Firebase Realtime Database?

I'm working on a new game project at the moment that will consist of a React Native front-end and a Lambda-based back-end. The app requires some real time features such as active user records, geofencing, etc. I was looking at Firebase's Realtime…
97
votes
9 answers

Formatting DynamoDB data to normal JSON in AWS Lambda

I'm using AWS Lambda to scan data from a DynamoDB table. This is what I get in return: { "videos": [ { "file": { "S": "file1.mp4" }, "id": { "S": "1" }, "canvas": { "S": "This is Canvas1" …
Chaitanya
  • 1,440
  • 1
  • 14
  • 26
95
votes
11 answers

The role defined for the function cannot be assumed by Lambda

I'm getting the error "The role defined for the function cannot be assumed by Lambda" when I'm trying to create a lambda function with create-function command. aws lambda create-function --region us-west-2 --function-name HelloPython …
Midhun Sudhakar
  • 1,238
  • 2
  • 10
  • 14
93
votes
7 answers

aws lambda: Error: Runtime exited with error: signal: killed

I'm trying to pull a large file from S3 and write it to RDS using pandas dataframes. I've been googling this error and haven't seen it anywhere, does anyone know what this extremely generic sounding error could mean? I've encountered memory issues…
Matt Takao
  • 2,406
  • 3
  • 16
  • 30
90
votes
3 answers

Can you publish a message to an SNS topic using an AWS Lambda function backed by node.js?

Can you publish a message to an SNS topic using an AWS Lambda function backed by node.js?
Gary Sharpe
  • 2,369
  • 8
  • 30
  • 51
89
votes
7 answers

aws api gateway & lambda: multiple endpoint/functions vs single endpoint

I have an AWS api that proxies lamba functions. I currently use different endpoints with separate lambda functions: api.com/getData --> getData api.com/addData --> addData api.com/signUp --> signUp The process to manage all the endpoints and…
Chris
  • 13,100
  • 23
  • 79
  • 162
89
votes
3 answers

Parameter ScheduleExpression is not valid

I'm trying to setup a Cloudwatch Scheduled Event and my cron expression seems to be invalid, though I can't figure out why. My cron expression is: cron(5,15,25,35,45,55 * * * *) I want it to run on the 5th, 15th, 25th, 35th, 45th and 55th minute of…
Brooks
  • 7,099
  • 6
  • 51
  • 82