aws-lambda

Destroy resources created via Serverless without destroying Lambda endpoints

匆匆过客 提交于 2019-12-23 09:28:01
问题 I have the following resource defined in my serverless.yml file. Its working great to create the resource for all my different stages of development. resources: Resources: uploadBucket: Type: AWS::S3::Bucket Properties: BucketName: ${self:service}-${self:custom.stage}-uploads visitsTable: Type: AWS::DynamoDB::Table Properties: TableName: ${self:custom.visitsTable} AttributeDefinitions: - AttributeName: userId AttributeType: S - AttributeName: visitId AttributeType: S KeySchema: -

AWS Lambda RDS Database Connection Pooling

☆樱花仙子☆ 提交于 2019-12-23 08:57:13
问题 I am looking for AWS Lambda to handle RDS Database connection pooling mechanism or do we have work around for this???? If we not having option for this i will face max connection error quickly.. 回答1: There are two aspects to the problem, I had similar issue and this is how I mitigated. Reusing the database connection pooling, Following is an example where declaring the connection object outside of the handler will help for boost the hot starts https://github.com/jeffnoehren/Spotinst-Function

aws lambda layer shared library in node_modules not accesible in function

主宰稳场 提交于 2019-12-23 08:47:03
问题 I recently changed my lambda functions to use the new aws Lambda Layer functionality, to share all the node_modules folder. I created the zip with the following structure: nodejs/node_modules/<libraries, like 'async' and others..> nodejs/package.json I also linked the lambda function to the layer, and it succeed (checked both in the CLI and in the web console), see output below.. but anyway, always the lambda function fails on the require: in lambda: require('async') output: "errorMessage":

AWS Lambda Python libssl C Library

巧了我就是萌 提交于 2019-12-23 08:12:24
问题 Trying to make a deployment package for the service Pusher in Python on AWS lambda. When I run simple code like this from pusher import Pusher def pusherTest(context, event): mypusher = Pusher(app_id=u'***', key=u'***', secret=u'***') mypusher.trigger('testchannel', 'testevent', {u'some': u'data'}) I'm getting this stack trace. libssl.so.1.0.0: cannot open shared object file: No such file or directory: ImportError Traceback (most recent call last): File "/var/task/Lambda.py", line 3, in

AWS Lambda Python libssl C Library

孤人 提交于 2019-12-23 08:12:06
问题 Trying to make a deployment package for the service Pusher in Python on AWS lambda. When I run simple code like this from pusher import Pusher def pusherTest(context, event): mypusher = Pusher(app_id=u'***', key=u'***', secret=u'***') mypusher.trigger('testchannel', 'testevent', {u'some': u'data'}) I'm getting this stack trace. libssl.so.1.0.0: cannot open shared object file: No such file or directory: ImportError Traceback (most recent call last): File "/var/task/Lambda.py", line 3, in

Invoke AWS Lambda(s) regularly every 1 minute

社会主义新天地 提交于 2019-12-23 07:38:37
问题 How can invoke a AWS Lambda regularly, specifically every 1 minute ? The current functionality allows Lambdas to be setup with 5 minute trigger but I am looking for a much lesser time interval . I thought of running the Lambda for ever but looks like that can't be done since the Maximum execution duration per request 300 seconds 回答1: [Removed previous answer and update] Now, AWS Lambda provides a per minute frequency CloudWatch Events - Schedule as a trigger option. 回答2: There was a session

How to describe AWS Lambda function test events in CloudFormation template?

不羁的心 提交于 2019-12-23 07:15:30
问题 I describe existing AWS Lambda function in CloudFormation template and I face with the next issue. In our Lambda we configured few test events which helps us to verify some usecases (I mean functionality from the screenshot below). But I don't see any abilities to add these test events to the CloudFormation template. AWS documentation don't help me with that. Is that possible at all or are there any workarounds how to export and import Lambda function test events? 回答1: Lambda test

how would one run aws lambda locally (java) for testing

我的梦境 提交于 2019-12-23 06:48:11
问题 How would one run aws lambda locally (java) for testing. I was able to find some information for node, but not for java. 回答1: AFAIK there is no magic to actually triggering the lambda function locally. Take a look at: http://docs.aws.amazon.com/lambda/latest/dg/java-programming-model-req-resp.html and http://docs.aws.amazon.com/lambda/latest/dg/java-gs.html Depending what your lambda code does you need to build the input and (possibly the context) and pass them into the function writing your

AWS lambda function firing twice when I click the Test button

青春壹個敷衍的年華 提交于 2019-12-23 05:46:14
问题 I am using chrome browser and when I click the Test button in the top right side of my screen the lambda function seems to fire 1-3 times and I cannot figure out why this is happening. I have tried putting the parameters directly into the dynamoDB.get call as well as googling for a while and trying to find someone with a similar issue. I found some that were close, but none that talk about a single function firing multiple times while using the built in test button. I have also tried making

Filter CloudWatch Logs to extract Instance ID

喜夏-厌秋 提交于 2019-12-23 05:29:16
问题 I have an AWS Lambda function that is invoked when an instance gets terminated and this the message is stored in Amazon CloudWatch Logs. I want to extract and filter these log messages to get a particular ID. How can I extract the logs and filter it using Python? 回答1: The easiest method might be to create a rule in Amazon CloudWatch Events that triggers an AWS Lambda function. The function automatically passes information relating to the instance that was terminated. You can write the Lambda