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
63
votes
6 answers

AWS Lambda Error: Unzipped size must be smaller than 262144000 bytes

I am developing one lambda function, which use the ResumeParser library made in the python 2.7. But when I deploy this function including the library on the AWS it's throwing me following error: Unzipped size must be smaller than 262144000 bytes
vijaya
  • 631
  • 1
  • 5
  • 3
63
votes
2 answers

When Lambda is invoked by SNS, will there always be just 1 record?

When receiving events in Lambda from SNS the outer structure of the event will look somewhat like: { "Records": [...] } In all the tutorials I have seen there has only ever been 1 record in the records field. Is it safe to make the assumption that…
RckMrkr
  • 985
  • 1
  • 10
  • 14
63
votes
6 answers

Invoke a AWS Lambda function by a http request

Is it possible to invoke a AWS Lambda function directly by a http request (either GET or POST)? If not, is there a workaround going through SNS or S3? Because I can't think of one... Specifically, I would like to create a small API using JSON
Moshe Shaham
  • 15,448
  • 22
  • 74
  • 114
62
votes
6 answers

Sharp image library rotates image when resizing?

When using the sharp image resize library https://github.com/lovell/sharp for node.js, the image is being rotated. I have no code thats says .rotate(), so why is it being rotated and how can I stop it from rotating? I'm using the…
JK.
  • 21,477
  • 35
  • 135
  • 214
62
votes
5 answers

aws-sam-local environment variables

I am following the readme here: https://github.com/awslabs/aws-sam-local I have a lambda written in python 3.6 and its similar to the helloworld example here :…
gotjava2012
  • 661
  • 1
  • 6
  • 7
62
votes
3 answers

How does AWS Lambda serve multiple requests?

How does AWS Lambda serve multiple requests? I want to know is it a multi-thread kind of a model here as well? If I am calling a Lambda from an API gateway. And there are 1000 requests in 10 secs to the API. How many containers will be created and…
62
votes
22 answers

Pandas in AWS lambda gives numpy error

I've been trying to run my code in AWS Lambda which imports pandas. So here is what I've done. I have a python file which contains a simple code as follows(This file has the lambda handler) import json print('Loading function') import pandas as…
Kingz
  • 1,657
  • 3
  • 18
  • 29
62
votes
11 answers

MongoDB connections from AWS Lambda

I'm looking to create a RESTful API using AWS Lambda/API Gateway connected to a MongoDB database. I've read that connections to MongoDB are relatively expensive so it's best practice to retain a connection for reuse once its been established rather…
Beesknees
  • 769
  • 1
  • 6
  • 8
61
votes
5 answers

AWS Cognito: Best practice to handle same user (with same email address) signing in from different identity providers (Google, Facebook)

When signing in a user with the same email address through the Google and Facebook identity providers, AWS Cognito creates multiple entries in the user pool, one entry per identity provider used: I have used the example code provided in this…
61
votes
3 answers

N+1 queries in AWS AppSync

When using AWS AppSync with lambda data sources you can encounter N+1 query problem. Basically when you have individual field resolver on your type and your query returns an array of those types you field resolver lambda will be called N times. AWS…
61
votes
3 answers

AWS lambda and Java concurrency

It is known that AWS lambda may reuse early created objects of handlers, and it really does it (see FAQ): Q: Will AWS Lambda reuse function instances? To improve performance, AWS Lambda may choose to retain an instance of your function and reuse…
Andremoniy
  • 34,031
  • 20
  • 135
  • 241
61
votes
8 answers

How to process SQS queue with lambda function (not via scheduled events)?

Here is the simplified scheme I am trying to make work: http requests --> (Gateway API + lambda A) --> SQS --> (lambda B ?????) --> DynamoDB So it should work as shown: data coming from many http requests (up to 500 per second, for example) is…
xtx
  • 4,306
  • 4
  • 28
  • 30
60
votes
6 answers

AWS security group inbound rule. allow lambda function

I run a service on my EC2 instance and I want to setup an inbound rule that only allows my lambda function to access it. The security group allows me to restrict access by a specific IP, but I don't think that lambda functions have a specific IP…
Chris
  • 13,100
  • 23
  • 79
  • 162
60
votes
8 answers

Call aws-cli from AWS Lambda

is there ANY way to execute aws-cli inside AWS Lambda? It doesn't seem to be pre-installed. (I've checked with "which aws" via Node.js child-process, and it didn't exist.)
59
votes
4 answers

How to query cloudwatch logs using boto3 in python

I have a lambda function that writes metrics to Cloudwatch. While, it writes metrics, It generates some logs in a log-group. INFO:: username: simran+test@example.com ClinicID: 7667 nodename: MacBook-Pro-2.local INFO:: username:…
systemdebt
  • 4,589
  • 10
  • 55
  • 116