aws-lambda

How to load npm modules in AWS Lambda?

ぃ、小莉子 提交于 2019-12-17 17:21:37
问题 I've created several Lambda functions using the web based editor. So far so good. I'd now like to start extending those with modules (such as Q for promises). I can't figure out how to get the modules out to Lambda so they can be consumed by my functions. I've read through this but it seems to involve setting up an EC2 and running Lambda functions from there. There is a mechanism to upload a zip when creating a function but that seems to involve sending up functions developed locally. Since I

Use AWS Glue Python with NumPy and Pandas Python Packages

狂风中的少年 提交于 2019-12-17 16:28:08
问题 What is the easiest way to use packages such as NumPy and Pandas within the new ETL tool on AWS called Glue? I have a completed script within Python I would like to run in AWS Glue that utilizes NumPy and Pandas. 回答1: I think the current answer is you cannot . According to AWS Glue Documentation: Only pure Python libraries can be used. Libraries that rely on C extensions, such as the pandas Python Data Analysis Library, are not yet supported. But even when I try to include a normal python

Can bash script be written inside a AWS Lambda function

吃可爱长大的小学妹 提交于 2019-12-17 15:53:59
问题 Can I write a bash script inside a Lambda function? I read in the aws docs that it can execute code written in Python, NodeJS and Java 8. It is mentioned in some documents that it might be possible to use Bash but there is no concrete evidence supporting it or any example 回答1: Something that might help, I'm using Node to call the bash script. I uploaded the script and the nodejs file in a zip to lambda, using the following code as the handler. exports.myHandler = function(event, context,

Getting json body in aws Lambda via API gateway

别说谁变了你拦得住时间么 提交于 2019-12-17 15:42:24
问题 I'm currently using NodeJS to build a bot on AWS lambda via AWS Api Gateway and I'm running into an issue with POST requests and JSON data. My api uses 'Use Lambda Proxy integration' and even when I test the proxy sending a content-type of Application/json and some json in the body e.g {"foo":"bar"} I can't access the object without parsing it first e.g var json = JSON.parse(event.body); console.log(json.foo); Now I know this doesn't seem a big deal just running it through JSON.parse, but I

AWS Lambda NoClassDefFoundError

久未见 提交于 2019-12-17 09:47:08
问题 I am having difficulty with a Java based Lambda function setup to receive messages from SNS. My function looks like the below: package com.mycompany; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.LambdaLogger; import com.amazonaws.services.lambda.runtime.events.SNSEvent; public class LambdaHandler { public void Handler(SNSEvent event, Context context) { //Process the event } } It compiles just fine and I don't have any problems uploading

How do I store aws pinpoint messages to rds?

妖精的绣舞 提交于 2019-12-17 07:55:33
问题 I am new to aws and I have been experimenting with aws pinpoint two way messages. Right now my customers are able to send messages to my long code and I already have predefined responses based on some key word s. The problem is some users do not use the key words that I have captured so I want to store all messages from my customers in a database (preferably a sql server database) and send custom responses to each message. How do I achieve this? 来源: https://stackoverflow.com/questions

API Gateway - Post multipart\form-data

倾然丶 夕夏残阳落幕 提交于 2019-12-17 05:05:10
问题 Seems my question maybe a little similar to this one. I have an API within my API Gateway and am doing a HTTP proxy through to an endpoint that POST's multipart/form-data files. If I call the http endpoint directly (not through the API gateway) - using postman, it works as expected, however, using the API gateway endpoint (through postman) fails. I have compared both requests (through fiddler and CloudWatch logs) which seem to be identical: Request for direct API call (working): POST https:/

Is there a way to change the http status codes returned by Amazon API Gateway?

南笙酒味 提交于 2019-12-17 02:27:34
问题 For instance if I want to return a specific 400 error for invalid parameters or perhaps a 201 when the lambda function call resulted in a create. I'd like to have different http status codes but it looks like api gateway always returns a 200 status code even if the lambda function is returning an error. 回答1: Update per 20-9-2016 Amazon finally made this easy using the Lambda Proxy integration. This allows your Lambda function to return proper HTTP codes and headers: let response = {

AWS Lambda for objects moved to glacier

那年仲夏 提交于 2019-12-14 04:19:35
问题 I am working on a POC where I have setup a Lifecycle rule on S3 to move objects to glacier after certain no of days (if objects have specified tag). Rule is working fine for me, objects are getting moved to glacier by lifecycle rule and storage type is change to Glacier from Standard. (so far so good). As I need to restrict user to use that file (archived file) from my application, I am looking for a way to get notification (either through SQS) or invoke Lambda function (to call my

Querying DynamoDB with Lambda does nothing

爱⌒轻易说出口 提交于 2019-12-14 04:16:12
问题 I have the following code for a Lambda function: console.log('Loading function'); var aws = require('aws-sdk'); var ddb = new aws.DynamoDB(); function getUser(userid) { var q = ddb.getItem({ TableName: "Users", Key: { userID: { S: userid } } }, function(err, data) { if (err) { console.log(err); return err; } else { console.log(data); } }); console.log(q); } exports.handler = function(event, context) { console.log('Received event'); getUser('user1'); console.log("called DynamoDB"); context