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
74
votes
9 answers

How do I add python libraries to an AWS lambda function for Alexa?

I was following the tutorial to create an Alexa app using Python: Python Alexa Tutorial I was able to successfully follow all the steps and get the app to work.I now want to modify the python code and use external libraries such as import requests …
73
votes
8 answers

How to pass parameters to serverless invoke local

I'm working on a aws serverless project and need to test the lambda functions locally. I am using serverless invoke local -f {function_name} command to test the API calls that does not request any path or query parameters. My question is how can I…
Lasitha Yapa
  • 4,309
  • 8
  • 38
  • 57
73
votes
4 answers

Difference between SAM template and Cloudformation template

I'm finding it hard to understand the difference between SAM template and Cloudformation template. I know that SAM template can be used to define Serverless Applications like Lambda, but how does that make it different from Cloudformation template?…
73
votes
4 answers

How to access an AWS Lambda environment variable from Python

Using the new environment variable support in AWS Lambda, I've added an env var via the webui for my function. How do I access this from Python? I tried: import os MY_ENV_VAR = os.environ['MY_ENV_VAR'] but my function stopped working (if I hard…
keybits
  • 4,383
  • 2
  • 20
  • 18
70
votes
4 answers

how to put an Item in aws DynamoDb using aws Lambda with python

Using python in AWS Lambda, how do I put/get an item from a DynamoDB table? In Node.js this would be something like: dynamodb.getItem({ "Key": {"fruitName" : 'banana'}, "TableName": "fruitSalad" }, function(err, data) { if (err) { …
Jordan
  • 1,564
  • 2
  • 13
  • 32
70
votes
4 answers

How to get contents of a text file from AWS s3 using a lambda function?

I was wondering if I could set up a lambda function for AWS, triggered whenever a new text file is uploaded into an s3 bucket. In the function, I would like to get the contents of the text file and process it somehow. I was wondering if this was…
jstnchng
  • 2,161
  • 4
  • 18
  • 31
69
votes
11 answers

Using moviepy, scipy and numpy in amazon lambda

I'd like to generate video using AWS Lambda feature. I've followed instructions found here and here. And I now have the following process to build my Lambda function: Step 1 Fire a Amazon Linux EC2 instance and run this as root on it: #!…
rouk1
  • 1,186
  • 1
  • 9
  • 13
68
votes
4 answers

Accessing AWS Lambda environment variables in Java code

The AWS has introduced Environment variables for accessing in the Lambda function. I could not find any documentation which shows how to access the environment variables from the Lambda function using Java. Can anyone help me?
Java Programmer
  • 1,347
  • 3
  • 12
  • 31
68
votes
7 answers

How to wait for async actions inside AWS Lambda?

I am trying to process uploaded file in S3. Since getObject is asyncronous main function ends before processing is done, and AWS kills lambda in 3-4 seconds. Even worse, processing method also has async operations in it - it makes http calls. On…
st78
  • 8,028
  • 11
  • 49
  • 68
67
votes
14 answers

How to create a new version of a Lambda function using CloudFormation?

I'm trying to create a new version of a Lambda function using CloudFormation. I want to have multiple versions of the same Lambda function so that I can (a) point aliases at different versions - like DEV and PROD - and (b) be able to roll back to an…
boris
  • 1,525
  • 3
  • 13
  • 18
66
votes
12 answers

The policy failed legacy parsing

I am trying to create IAM Role in AWS, but while I am creating I am facing error "We encountered the following errors while processing your request: Problem in attaching permission to role. Role will be created without permission. The policy…
Mani Teja
  • 669
  • 1
  • 5
  • 9
66
votes
5 answers

AWS Lambda function write to S3

I have a Node 4.3 Lambda function in AWS. I want to be able to write a text file to S3 and have read many tutorials about how to integrate with S3. However, all of them are about how to call Lambda functions after writing to S3. How can I create a…
KVISH
  • 12,923
  • 17
  • 86
  • 162
65
votes
8 answers

How can one determine the current region within an AWS Lambda function?

Regions.getCurrentRegion() returns null from within an AWS Lambda function. It seems that Regions.getCurrentRegion() is not supported from within an AWS Lambda function. Is there an alternative way to determine which region the lambda function is…
Richard Crane
  • 1,110
  • 3
  • 9
  • 17
64
votes
7 answers

No integration defined for method - Choose a stage where your API will be deployed

I'm working with AWS API Gateway and AWS Lambda. Often I face this type of error message when attempt to deploy API. The error message says to select a deployment stage. But I still selecting and trying to deploy! but same error occur! In this API…
Hasan Abdullah
  • 2,498
  • 1
  • 19
  • 34
64
votes
6 answers

AWS Lambda "Process exited before completing request"

I am trying to call a DynamoDB client method and get one item from the DynamoDB table. I am using AWS Lambda. However, I keep getting the message: "Process exited before completing request." I have increased the timeout just to make sure, but the…
Rupert
  • 4,209
  • 7
  • 31
  • 36