aws-lambda

Serverless Framework with custom packaging

本小妞迷上赌 提交于 2019-12-24 08:23:20
问题 I'm using the Serverless Framework and I can't seem to package my functions the way I want. My current folder directory looks like this: service/ serverless.yml function1/ package.json handler.js node_modules/ ... function2/ handler.py requirements.txt venv/ ... Is it possible to cherry pick which folder I want to include in the zip file and also specify the corresponding destination path inside the zip file? For example, I want to zip everything inside function1 folder but all of them should

Can I use WebWorkers in AWS Lambda (node 6.10)

爷,独闯天下 提交于 2019-12-24 08:09:40
问题 I've got a very simple node module that I want in AWS lambda, and its importing 'Natural' for some text processing. This line throws the error: var n = require('natural'); The error is this: { "errorMessage": "/var/task/node_modules/webworker-threads/build/Release/WebWorkerThreads.node: invalid ELF header", "errorType": "Error", "stackTrace": [ "Module.load (module.js:487:32)", "tryModuleLoad (module.js:446:12)", "Function.Module._load (module.js:438:3)", "Module.require (module.js:497:17)",

Import Python module into AWS Lambda

让人想犯罪 __ 提交于 2019-12-24 08:08:22
问题 I have followed all the steps in the documentation: https://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html create a directory. Save all of your Python source files (the .py files) at the root level of this directory. Install any libraries using pip at the root level of the directory. Zip the content of the project-dir directory) But after I uploaded the zip-file to lambda function, I got the error message when I test the script my code: import

How to make an asynchronous api call for Alexa Skill application with a Lambda function?

自闭症网瘾萝莉.ら 提交于 2019-12-24 08:00:07
问题 I want to call an api from a Lambda function. My handler is triggered by an intent which includes two required slots. Therefore I don't know in advance whether I will be returning a Dialog.Delegate directive or my response from the api request. How do I promise these return values by the time the intent handler is called? This is my handler: const FlightDelayIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput

AWS Lambda schedule a delayed execution to run once

一曲冷凌霜 提交于 2019-12-24 07:56:53
问题 I have an API Gateway with Lambdas behind, for some of the endpoints I want to schedule an execution in the future, to run once, for example the REST call was made at T time, I want that lambda to schedule an execution ONCE at T+20min. The only solution I found to achieve this is to use boto3 and Cloudwatch to setup a cron at the moment the REST call was made, send an event with the payload, then when the delayed lambda runs, it removes the rule. I found this very heavy, is there any other

Lambda Python request athena error OutputLocation

允我心安 提交于 2019-12-24 07:55:00
问题 I'm working with AWS Lambda and I would like to make a simple query in athena and store my data in an s3. My code : import boto3 def lambda_handler(event, context): query_1 = "SELECT * FROM test_athena_laurent.stage limit 5;" database = "test_athena_laurent" s3_output = "s3://athena-laurent-result/lambda/" client = boto3.client('athena') response = client.start_query_execution( QueryString=query_1, ClientRequestToken='string', QueryExecutionContext={ 'Database': database },

Python at AWS Lambda: `requests` from botocore.vendored deprecated, but `requests` not available

流过昼夜 提交于 2019-12-24 07:39:36
问题 I've got a Python script for an AWS Lambda function that does HTTP POST requests to another endpoint. Since Python's urllib2.request , https://docs.python.org/2/library/urllib2.html, can only handle data in the standard application/x-www-form-urlencoded format and I want to post JSON data, I used the Requests library, https://pypi.org/project/requests/2.7.0/. That Requests library wasn't available at AWS Lambda in the Python runtime environment, so had to be imported via from botocore

Amazon Python 2.7 Lambda: DPI-1047: 64-bit Oracle Client library cannot be loaded: “libclntsh.so”

折月煮酒 提交于 2019-12-24 07:28:24
问题 This article was the closest to what I experienced: Connecting to Oracle RDS using AWS Lambda using Python. However, after following all of the steps, I am unable to get a successful result. Steps on ami-aa5ebdd2 in us-west-2: sudo yum -y install gcc mkdir oracle_connect source oracle_connect/bin/activate virtualenv oracle_connect pip install cx_Oracle wget https://github.com/bumpx/oracle-instantclient/raw/master/instantclient-basic-linux.x64-12.2.0.1.0.zip mv instantclient_12_2/* oracle

Lambda : Is any Batch processing scheduler available?

醉酒当歌 提交于 2019-12-24 07:20:52
问题 Problem : Fetch 2000 items from Dynamo DB and process(Create a POST req from 100 items) it batch by batch (Batch size = 100). Question : Is there anyway that I can achieve it from any configuration in AWS. PS : I've configured a cron schedule to run my Lambda function. I'm using Java. I've made multi-threaded application which synchronously does so, but this eventually increases my computation time drastically. 回答1: I have the same problem and thinking of solving it in following way. Please

s3.upload() works but uploads broken image

为君一笑 提交于 2019-12-24 04:43:05
问题 I've got a Lambda function in AWS that is hooked up to a POST method which basically takes an image URL and uploads the image to an S3 bucket. My Lambda function looks like this: var s3 = new AWS.S3(); exports.handler = (event, context, callback) => { let encodedImage = JSON.parse(event.body).user_avatar; let decodedImage = Buffer.from(encodedImage, 'base64'); var filePath = "avatars/" + event.queryStringParameters.username + ".jpg" var params = { "Body": decodedImage, "Bucket": "MYBUCKETNAME