aws-lambda

AWS Lambda & SNS: Invoke Lambda cross-region

∥☆過路亽.° 提交于 2019-12-19 08:07:35
问题 I have a Lambda function deployed to several regions. I would like to publish a message to SNS that will invoke these functions. Using aws-cli I've created the topics, given Lambda permission to talk to SNS, and create the subscriptions. The subscription appears to be created successfully, and I can see it in the AWS console. But, it doesn't work. The lambda function does not get invoked. 回答1: This is CloudFormation based example. You have to add invoke permission for SNS to the Lambda

Unable to import grequests for AWS Lambda

*爱你&永不变心* 提交于 2019-12-19 06:31:44
问题 I'm running an AWS Lambda script with a Python 2.7 runtime. However, whenever it initializes it begins to import the grequests library but fails because of it's dependency on gevent: Gevent is required for grequests. It seems it is successfully finding the grequests library (since it knows it needs gevent) but fails. What I've tried so far: pip install --ignore-installed grequests -t . pip install --ignore-installed grequests -t ./lib pip install --ignore-installed gevent -t . pip install -

Unable to import grequests for AWS Lambda

ぐ巨炮叔叔 提交于 2019-12-19 06:31:06
问题 I'm running an AWS Lambda script with a Python 2.7 runtime. However, whenever it initializes it begins to import the grequests library but fails because of it's dependency on gevent: Gevent is required for grequests. It seems it is successfully finding the grequests library (since it knows it needs gevent) but fails. What I've tried so far: pip install --ignore-installed grequests -t . pip install --ignore-installed grequests -t ./lib pip install --ignore-installed gevent -t . pip install -

How to pass cognito user information to lambda?

空扰寡人 提交于 2019-12-19 06:03:22
问题 I'm developing application based on API Gateway and Lambda. I configured POST /subscribe as "AWS_IAM". So now it cannot accessible directly, but I can access to API with Cognito authentication. Now problem is my Lambda doesn't know who is the API caller. How to know that? I have 2 users: "Bob" and "John". My Lambda need to know that caller is Bob or John. Thanks, 回答1: You can get the Cognito Identity ID from the identity property of the context parameter ( context.identity ) as explained in

Can't run binary from within python aws lambda function

梦想与她 提交于 2019-12-19 06:02:14
问题 I am trying to run this tool within a lambda function: https://github.com/nicolas-f/7DTD-leaflet The tool depends on Pillow which depends on imaging libraries not available in the AWS lambda container. To try and get round this I've ran pyinstaller to create a binary that I can hopefully execute. This file is named map_reader and sits at the top level of the lambda zip package. Below is the code I am using to try and run the tool: command = 'chmod 755 map_reader' args = shlex.split(command)

Build custom AWS Lambda layer for Scikit-image

痞子三分冷 提交于 2019-12-19 04:23:40
问题 Outline: I need to use scikit-image inside some AWS lambda functions, so I'm looking to build a custom AWS lambda layer containing scikit-image . My questions in general should apply to any python module, notably scikit-learn, or any custom layer in general I think. Background: After much googling and reading it seems the best way to do that is to use docker to run the AWS lambda runtime locally, and then inside there install/compile scikit-image (or whichever module you're looking for).

Build custom AWS Lambda layer for Scikit-image

笑着哭i 提交于 2019-12-19 04:21:28
问题 Outline: I need to use scikit-image inside some AWS lambda functions, so I'm looking to build a custom AWS lambda layer containing scikit-image . My questions in general should apply to any python module, notably scikit-learn, or any custom layer in general I think. Background: After much googling and reading it seems the best way to do that is to use docker to run the AWS lambda runtime locally, and then inside there install/compile scikit-image (or whichever module you're looking for).

How to know event souce of lambda function in itself

五迷三道 提交于 2019-12-19 04:14:34
问题 I want to know the event source of lambda function in the function. What I want to do is to use one lambda function from some AWS service(CloudWatch, S3, Step functions, etc...) and to change its behavior depending on the service. A context object (one of arguments of the function) has information about the lambda function but not about event source. Is there the way to know that? 回答1: If you have identified a Kinesis or DynamoDB stream as an event source for a Lambda function with the API

Send Post request to an external API using AWS Lambda in python

China☆狼群 提交于 2019-12-19 04:12:42
问题 I want to send a post request to an external API (https://example.com/api/jobs/test) every hour. The Lambda Function that I used is as follows: Handler: index.lambda_handler python: 3.6 index.py import requests def lambda_handler(event, context): url="https://example.com/api/jobs/test" response = requests.post(url) print(response.text) #TEXT/HTML print(response.status_code, response.reason) #HTTP Test Event: { "url": "https://example.com/api/jobs/test" } Error: START RequestId: 370eecb5-bfda

Invoke AWS Lambda and return response to API Gateway asyncronously

时光怂恿深爱的人放手 提交于 2019-12-19 03:44:14
问题 My use case is such that I'll have an AWS Lambda front ended with API Gateway. My requirement is that once the Lambda is invoked it should return a 200 OK response back to API Gateway which get forwards this to the caller. And then the Lambda should start its actual processing of the payload. The reason for this is that the API Gateway caller service expects a response within 10 seconds else it times out. So I want to give the response before I start with the processing. Is this possible? 回答1