aws-lambda

AWS lambda tar file extraction doesn't seem to work

本秂侑毒 提交于 2021-01-28 11:27:38
问题 I'm trying to run serverless LibreOffice based on this tutorial. Here is the full python lambda function: import boto3 import os s3_bucket = boto3.resource("s3").Bucket("lambda-libreoffice-demo") os.system("curl https://s3.amazonaws.com/lambda-libreoffice-demo/lo.tar.gz -o /tmp/lo.tar.gz && cd /tmp && tar -xf /tmp/lo.tar.gz") convertCommand = "instdir/program/soffice --headless --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --norestore --convert-to pdf --outdir /tmp" def

Unable to trigger AWS Lambda by upload to AWS S3

ぐ巨炮叔叔 提交于 2021-01-28 09:54:26
问题 I am trying to build a Kibana dashboard fed with twitter data collected via AWS Kinesis firehose where data passes into an S3 bucket which triggers a Lambda function which passes the data to AWS Elastic Search and then to Kibana. I am following this blog https://aws.amazon.com/blogs/big-data/building-a-near-real-time-discovery-platform-with-aws/ The data is loading into the S3 bucket correctly but it never arrives in Kibana, I believe this is because the Lambda function is not being triggered

How to receive an endless WebSocket data source using AWS Lambda?

无人久伴 提交于 2021-01-28 09:05:25
问题 I want to crawl data from a WebSocket data source, usually WebSocket data is an endless stream, while an AWS Lambda function has a Timout limit, the maximum allowed value is 900 seconds. If my Lambda function acts as a WebSocket client and connects to a WebSocket url, e.g., wss://ws-feed-public.sandbox.pro.coinbase.com , it starts to receive data for 900 seconds and get terminated by then. How to keep my Lamda function running forever? Thanks! Right now I'm running my crawler inside a Linux

sinon stub for Lambda using promises

天涯浪子 提交于 2021-01-28 08:27:45
问题 I just started using sinon, and I had some initial success stubbing out DynamoDB calls: sandbox = sinon.createSandbox() update_stub = sandbox.stub(AWS.DynamoDB.DocumentClient.prototype, 'update').returns({ promise: () => Promise.resolve(update_meeting_result) }) This works great. But I also need to stub Lambda, and the same approach isn't working: lambda_stub = sandbox.stub(AWS.Lambda.prototype, 'invoke').returns({ promise: () => Promise.resolve({lambda_invoke_result}) // }) With this, I get

How to get AWS Lambda ARN using Terraform?

半城伤御伤魂 提交于 2021-01-28 07:57:42
问题 I am trying to define a terraform output block that returns the ARN of a Lambda function. The Lambda is defined in a sub-module. According to the documentation it seems like the lambda should just have an ARN attribute already: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/lambda_function#arn Using that as a source I thought I should be able to do the following: output "lambda_arn" { value = module.aws_lambda_function.arn } This generates the following error:

Running python with boto2 as an AWS Lambda function

十年热恋 提交于 2021-01-28 07:29:02
问题 I am using a python script from github to run on AWS lambda. I realized that the import boto statements are not working while running inside lambda. Is there way to instruct lambda to load boto2 as well? 回答1: OK, all I had to do was install boto using "pip install module-name -t /path/to/project-dir" per the docs: http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html Then zipped the files needed for lambda and uploaded. 来源: https://stackoverflow.com

AWS DynamoDB Throttled Write Request Handling

旧城冷巷雨未停 提交于 2021-01-28 07:11:21
问题 I have a table which has throttled write request at a specified time. I want to understand more about how AWS-SDK handle them. For my current understanding, DynamoDB will return an error to my Lambda. That's why I will have user errors in DynamoDB Table Metrics. However, AWS-SDK has error-handling and retry strategy which helps me to retry and write the throttled requests back to the table. Is it correct? 回答1: Every time your application sends a request that exceeds your capacity you get a

S3 presigned upload url error

随声附和 提交于 2021-01-28 07:00:37
问题 I am trying to perform a document upload using an S3 pre-signed PUT url. I generated the url using java AWS SDK ( GeneratePresignedUrlRequest.java ). This url generation code sits in a lambda function behind AWS API gateway. However I am getting the following error when I copy the generated url in Postman & try to perform an upload. <Error> <Code>AccessDenied</Code> <Message> There were headers present in the request which were not signed </Message> <HeadersNotSigned>host</HeadersNotSigned>

Ffmpeg returning error code 1 in AWS Lamda function

浪尽此生 提交于 2021-01-28 06:53:15
问题 I'm running a lambda function which takes an mp4 video, and adds a watermark of a png image over the top of it in the bottom right hand corner (with a 10px margin). It then outputs that image to a temporary location. It keeps failing with Error code 1 , but that isn't very helpful. I'm using a binary version of ffmpeg that is specified in the main directory of the code. I know that ffmpeg is set up correctly due to using it in another lambda function in this way, which works. But adding an

Allow serverless lambda to be called by cloud watch

和自甴很熟 提交于 2021-01-28 05:45:16
问题 I have one lambda function within my serverless.yml . It looks somehow like this: functions: clean: handler: app.run events: - schedule: rate(2 hours) It works pretty well and out of the box lambda gets called every 2 hours. When I add new rule in AWS Console and sets the newly created lambda as a target it also works. Both AWS Console and Serverless framework creates on the background policy that events.amazonaws.com service can invoke this specific function. The policy looks somehow like