aws-lambda

AWS API Gateway always returns 502 bad gateway

被刻印的时光 ゝ 提交于 2021-02-08 09:55:12
问题 I have created a simple lambda function in AWS that returns list from DynamoDB. I have also created API Gateway to trigger the lambda function. The function works fine when I test in AWS console. But I always get 502 bad gateway below error when I test this function in Postman. ({ "message": "Internal server error" } Below is the function in node.js: const doc = require('dynamodb-doc'); const dynamo = new doc.DynamoDB(); /** * Provide an event that contains the following keys: * * - operation

AWS API Gateway always returns 502 bad gateway

微笑、不失礼 提交于 2021-02-08 09:54:09
问题 I have created a simple lambda function in AWS that returns list from DynamoDB. I have also created API Gateway to trigger the lambda function. The function works fine when I test in AWS console. But I always get 502 bad gateway below error when I test this function in Postman. ({ "message": "Internal server error" } Below is the function in node.js: const doc = require('dynamodb-doc'); const dynamo = new doc.DynamoDB(); /** * Provide an event that contains the following keys: * * - operation

pymssql package does not work with lambda in aws

混江龙づ霸主 提交于 2021-02-08 08:29:41
问题 How do we create a pymssql package for lambda. I tried creating it using pip install pymssql -t . When I run my lambda function it complaints saying that Unable to import module 'lambda_function': No module named lambda_function I follow the steps on this link http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html I have a windows machine 回答1: Glad that it worked for you, could you please share the working process for your, me too tried different trial

Does AWS apigateway change http body? How can I stop it from doing this?

匆匆过客 提交于 2021-02-08 07:27:31
问题 Does AWS apigateway change http body? How can I stop it from doing this? My application: (1) A front end "UI" that sends a "http request" using "POST method" that contains a "zip file" in "body" through "form-data". (2) AWS "apigateway" receives this request and forward it to "Lambda Proxy" (3) AWS "Lambda" implemented by python coding receives this request and decompresses this zip file to a temporary folder. The problem I'm facing: (1) and (2) works fine, but in (3) the pythong program at

Terraform: CloudWatch Event that notifies SNS

别等时光非礼了梦想. 提交于 2021-02-08 07:21:59
问题 I'm learning TF and trying to apply an infrastructure that creates: a simple lambda function an SNS topic get that lambda to subscribe the SNS topic a Cloud Watch Event that publishes a message to the topic at some interval a Cloud Watch Log Group to check if the lambda gets notified by the SNS The lambda permission to allow calls from SNS I'm able to apply that successfully. The infrastructure seems perfectly fine (it has the same aspect when I create that myself through the visual aws

Terraform: CloudWatch Event that notifies SNS

独自空忆成欢 提交于 2021-02-08 07:21:12
问题 I'm learning TF and trying to apply an infrastructure that creates: a simple lambda function an SNS topic get that lambda to subscribe the SNS topic a Cloud Watch Event that publishes a message to the topic at some interval a Cloud Watch Log Group to check if the lambda gets notified by the SNS The lambda permission to allow calls from SNS I'm able to apply that successfully. The infrastructure seems perfectly fine (it has the same aspect when I create that myself through the visual aws

AWS Lambda - Invoke a method of another lambda function

南楼画角 提交于 2021-02-08 06:24:14
问题 I am trying to invoke a method, different than the default handler method, of one lambda from another lambda. But not getting how to do it. It is not clear from the documentation. Here is my code Lambda function 1: my_function1 import json import boto3 def lambda_handler(event, context): lambda_inv = boto3.client("lambda", region_name="us-east-1") payload = {"message":"Hi From my_function1"} lambda_inv.invoke(FunctionName='arn:aws:lambda:us-east-1:1236547899871:function:my_function2',

Temporarily disable DynamoDB Lambda Triggers / Stream

老子叫甜甜 提交于 2021-02-08 05:31:52
问题 I'm looking for a way to temporarily disable Lambda triggers on a DynamoDB. I want to be able do apply manual Updates on a table (e.g. such as importing data from a S3 backup) without the Lambda code being triggers. I tried the disable button next to the trigger in the lambda functions "Trigger" tab. I also tried to disable the whole Stream for the table. In both cases, when reactivating the trigger/stream all the trigger events (that happened, while they were deactivated) are executed then.

Temporarily disable DynamoDB Lambda Triggers / Stream

こ雲淡風輕ζ 提交于 2021-02-08 05:31:32
问题 I'm looking for a way to temporarily disable Lambda triggers on a DynamoDB. I want to be able do apply manual Updates on a table (e.g. such as importing data from a S3 backup) without the Lambda code being triggers. I tried the disable button next to the trigger in the lambda functions "Trigger" tab. I also tried to disable the whole Stream for the table. In both cases, when reactivating the trigger/stream all the trigger events (that happened, while they were deactivated) are executed then.

Python AWS Lambda Certificates

允我心安 提交于 2021-02-07 19:49:43
问题 How do I add an additional CA (certificate authority) to the trust store used by my Python3 AWS Lambda function? 回答1: If you only need a single CA, then get your crt file and encode it into a pem using the following command in linux: openssl x509 -text -in "{your CA}.crt" > cacert.pem If you need to add CA's to the default CA bundle, then copy python3.8/site-packages/certifi/cacert.pem to your lambda folder. Then run this command for each crt: openssl x509 -text -in "{your CA}.crt" >> cacert