aws-lambda

DynamoDB not receiving the entire SQS message body

£可爱£侵袭症+ 提交于 2021-01-28 05:43:44
问题 I am pulling data from an API in batches and sending it to an SQS Queue. Where I am having an issue is processing the message in order to send the data to DynamoDB. There is supposed to be 147,689 records in the dataset. However, when running the code, sometimes less than 147,689 records will be put to DynamoDB, sometimes more than 147,689 records will be put to DynamoDB, and sometimes 147,689 records will be put to DynamoDB. It is not consistently putting 147,689 records into the database. I

Iterate over multiple payloads and take multiple screenshots with Puppeteer AWS Lambda

末鹿安然 提交于 2021-01-28 04:38:22
问题 I am currently using the following Puppeteer AWS Lambda Layer to scrape 30 URLs and create and save screenshots in S3. At the moment, I send 30 individual payloads therefore running 30 AWS Lambda functions. https://github.com/shelfio/chrome-aws-lambda-layer Each JSON payload contains a URL and an image file name that are sent every 2-3 seconds to API Gateway via a POST request. The first 6 or 9 Lambda functions in the list seem to run fine, then they start to fail with Navigation failed

Lambda function to check if specific tag do NOT exists-python

给你一囗甜甜゛ 提交于 2021-01-28 04:01:55
问题 I'm trying to get following: Get all EC2 instances that either: are Tagged with tag Owner and value Unknown or unknown are missing tag Owner I'm able to accomplish 1) but no idea how to get 2) import boto3 import collections import datetime import time import sys ec = boto3.client('ec2', 'eu-west-1') ec2 = boto3.resource('ec2', 'eu-west-1') def lambda_handler(event, context): instance_ids = [] reservations = ec.describe_instances( Filters=[ {'Name': 'tag:Owner', 'Values': ['Unknown', 'unknown

Amazon Cognito Delete account

青春壹個敷衍的年華 提交于 2021-01-28 03:12:16
问题 I have Amazon Cognito user pool with few users added in it. I have added trigger to invoke my Lambda function after Post confirmation. Do we have any trigger in Cognito to invoke the Lambda function after "User Signout" and "Delete User". I did not see any trigger in Cognito. How the lambda function can be invoked automatically after User signout and Delete user. Kindly throw some light on this. 回答1: TL;DR: Can't be done It can't be done automatically because unlike Sign-in/Sign-ups which

Is there a good way to close mongo connections when a lambda container expires?

▼魔方 西西 提交于 2021-01-28 03:03:44
问题 I am using AWS-lambda handler to write a dynamoDB stream to mongoDB. I want to define the db connection outside of the handler so that the requests reuse the same connections, based on our expected throughput volume. The problem with the lambda containers will expire without disposing of the connections properly. Does anybody know of any good solutions for this problem? Essentially boils down to "I want to use connection pools without maxing out the connection limit" 回答1: When I faced with

Handling errors in AWS Lambda function with API Gateway

 ̄綄美尐妖づ 提交于 2021-01-28 02:51:49
问题 Every time I have a syntax error or I just want to send a custom error in my AWS Lambda function, I get the same 502 Bad Gateway response (Internal server error). I tried that simple code: module.exports.saveImage = (event, context, callback) => { callback("the sky is falling!"); // also tried sending new Error("the sky is falling!") } And still getting the same "Internal server error" response instead of the defined one. This is my function in the serverless.yml file: saveImage: handler:

how to ensure distinct public ip per aws lambda

狂风中的少年 提交于 2021-01-28 02:00:40
问题 I have several aws lambda instances accessible publicly, from the internet they all have the same public ip, how can we ensure that each lambda has distinct public IP address? It does not need to be static, it only needs to be different per lambda, and its no problem if same lambda has different IPs (high availability), the only condition is that 2 different lambdas never have the same IP... 回答1: Look at the answer (and the comments) to this question: Lambda function within VPC doesn't have

Serverless does not create SQS events

笑着哭i 提交于 2021-01-28 01:56:01
问题 I am trying to make serverless create a trigger to fire whenever an object queues. But it does not create and also does not fire any errors. My serverless.yml: I did according to the documentation (https://serverless.com/framework/docs/providers/aws/events/sqs/) service: lambda-messages provider: name: aws runtime: nodejs8.10 stage: dev region: us-east-1 memorySize: 256 iamRoleStatements: - Effect: "Allow" Action: - sqs:SendMessage - sqs:ReceiveMessage - sqs:DeleteMessage - sqs

CloudFormation issue: couldn't delete stack

≡放荡痞女 提交于 2021-01-28 01:32:45
问题 I create CloudFormation template for our resources, it includes Lambda functions, API Gateways, Roles, etc. For verifying our template I create CloudFormation stack using it, check some resources which I updated and after that I delete stack. But last time I got such message when I tried to delete stack: CloudFormation is waiting for NetworkInterfaces associated with the Lambda Function to be cleaned up. I tried to stop deletion process and restart it, but I faced the same issue again. What

Sending raw Body JSON to AWS Lambda via API gateway

假如想象 提交于 2021-01-28 00:52:52
问题 I have been struggling with API Gateway trying to get what I assumed would be a simple procedure, sending raw JSON from a webhook to my AWS Lambda as an event to use within my function. All I want to do is output the Woocommerce order number and send an email of the order number as well by getting the Woocommerce webhook body to Lambda, like I have in my test event. Here is the function: var AWS = require('aws-sdk'); var ses = new AWS.SES(); exports.handler = (event, context, callback) => { /