aws-lambda

Can you send SNS push notification from lambda function in Amazon AWS?

不想你离开。 提交于 2020-01-01 10:17:23
问题 I am developing an application with Amazon AWS and what I am trying to achieve is to attach a lambda function to DynamoDB table, so after a new row is added ,the lambda function is triggered. In the above mentioned lambda function I want to add the functionality to send a push notification with Amazon SNS service, but I could not find any information in their documentation if that is possible and if it is, what exactly needs to be done to get it working? What I found in their documentation is

Timeout when publishing from AWS Lambda to SNS

為{幸葍}努か 提交于 2020-01-01 08:48:32
问题 I'm trying to publish some data to SNS from a Lambda function call, but it doesn't seem to be working. My function code is - public class Handler implements RequestHandler<DynamodbEvent, Void> { private static final String SNS_TOPIC_ARN = "arn:aws:sns:us-west-2:account_number:function_name"; @Override public Void handleRequest(DynamodbEvent dynamodbEvent, Context context) { LambdaLogger logger = context.getLogger(); AmazonSNSClient snsClient = new AmazonSNSClient(new

AWS Lambda function - convert PDF to Image

喜欢而已 提交于 2020-01-01 06:31:27
问题 I am developing application where user can upload some drawings in pdf format. Uploaded files are stored on S3. After uploading, files has to be converted to images. For this purpose I have created lambda function which downloads file from S3 to /tmp folder in lambda execution environment and then I call ‘convert’ command from imagemagick. convert sourceFile.pdf targetFile.png Lambda runtime environment is nodejs 4.3. Memory is set to 128MB, timeout 30 sec. Now the problem is that some files

How do I pass arguments to AWS Lambda functions using GET requests?

别说谁变了你拦得住时间么 提交于 2020-01-01 03:57:04
问题 Say I want to pass val1 and val2 in the URL string when making a GET request from my Api gateway endpoint to my Lambda function: https://xyz.execute-api.amazonaws.com/prod/test?val1=5&val2=10 And I have a simple function that sums the two inputs, val1 and val2: def lambda_handler(event, context): # How do I get at val1 and val2?? return {'result': val1 + val2} I've added val1 and val2 to URL Query String Parameters on the Method Request on the AWS API Gateway. But how do I access them inside

Spark submit (2.3) on kubernetes cluster from Python

浪尽此生 提交于 2020-01-01 03:32:11
问题 So now that k8s is integrated directly with spark in 2.3 my spark submit from the console executes correctly on a kuberenetes master without any spark master pods running, spark handles all the k8s details: spark-submit \ --deploy-mode cluster \ --class com.app.myApp \ --master k8s://https://myCluster.com \ --conf spark.kubernetes.authenticate.driver.serviceAccountName=spark \ --conf spark.app.name=myApp \ --conf spark.executor.instances=10 \ --conf spark.kubernetes.container.image=myImage \

AWS Lambda: How to Add Numbers to a NS Set in Dynamodb

走远了吗. 提交于 2020-01-01 03:23:48
问题 The Issue I have tried several approaches, but haven't been able to find out how to add numbers to a NS set. This is all running inside a lambda function. What I'm trying to accomplish I am creating a dynamodb table where different colors in hex align to a set of ids. I am optimizing the table for fast reads and to avoid duplicates which is why I would like to maintain a set of ids for each hex. How I'm adding items to the table: let doc = require('dynamodb-doc'); let dynamo = new doc

How can I test AWS Lambda functions locally?

我与影子孤独终老i 提交于 2020-01-01 02:11:26
问题 Explain to me please what is the best way to locally test the lambda function. I used sam local and this solution https://github.com/lambci/docker-lambda for testing, but for example, where I invoke one lambda from another error occurs. In general, I can't make stubs for methods since lambda runs in a container 回答1: There are a couple of options. Following two are some popular ones. Serverless framework along with the serverless-offline plugin. LocalStack 回答2: This is how I test local lambda

AWS Lambda Python 3.7 runtime exception logging

£可爱£侵袭症+ 提交于 2020-01-01 02:08:35
问题 Unhandled exceptions thrown while using the Python 3.7 runtime do not seem to be logged to CloudWatch as they are in Python 3.6. How can you setup the logger in Python 3.7 to capture this information? Also posted on AWS forum To replicate: 1. Create a lambda function like so: import logging logger = logging.getLogger() logger.setLevel(logging.DEBUG) def lambda_handler(event, context): logger.info("This shows fine") raise Exception("I failed") 2. Run this function using the Python 3.6 runtime

aws lambda execution after callback guaranteed?

亡梦爱人 提交于 2020-01-01 01:56:21
问题 My node4 lambda function called via API GW makes a sequence of slow API calls. In order to not let users wait until everything completes, I'm planning to have my code look like this: function(event, context, callback) { ... // Return users API GW call now callback(null, data); // Do the heavy lifting afterwards. longApiCall().then(otherLongApiCalls) } But now I read in the AWS docs: "the callback will wait until the Node.js runtime event loop is empty before freezing the process and returning

How to upload an object into S3 in Lambda?

喜夏-厌秋 提交于 2020-01-01 01:44:43
问题 Can't seem to upload an object into S3 in Lambda. Everything works fine locally. No errors in logs that would show what's going wrong... Code below: console.log('Loading function'); var AWS = require('aws-sdk'); var s3 = new AWS.S3(); exports.handler = function(event, context) { //console.log(JSON.stringify(event, null, 2)); var s3 = new AWS.S3(); var param = {Bucket: 'flow-logs', Key: 'test-lambda-x', Body: 'me me me'}; console.log("s3"); s3.upload(param, function(err, data) { if (err)