aws-api-gateway

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

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:

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) => { /

API Gateway - Body Mapping Template - optional body parameters

孤人 提交于 2021-01-27 20:10:02
问题 I have a POST API Gateway method to which I am sending the following application/json body in order to pass parameters from it to a Lambda that the method is connected to: { "otherClientId": "12345", "message": "Text", "seconds": 0, "hours": 0 } I am using the following mapping template: #set($inputRoot = $input.path('$')) { "authorizedUser": "$context.authorizer.principalId", "otherClientId": "$inputRoot.otherClientId", "message": "$inputRoot.message", "amount": $inputRoot.amount, "duration"

AWS API Gateway multiple Integration Request per Method

孤人 提交于 2021-01-27 15:54:50
问题 My resource /api has a method POST which proxies the body to Kinesis Firehose (and then to ES). At the same time I want it to trigger a Lambda function. I tried adding an additional method ANY to trigger the Lambda function but API Gateway seems to preference the POST handler. I am aware that I can trigger Lambda on POST and submit from the Lambda function to Firehose but I'd prefer having those two independent from each other. 回答1: API Gateway doesn't fork a request into multiple concurrent

How to block HTTP and allows only HTTPS for AWS API Gateway with custom domain name map

好久不见. 提交于 2021-01-27 14:10:16
问题 I've added certificate with custom domain name map in AWS API gateway but it allows HTTP automatically, how can I block normal HTTP and only allows HTTPS? 回答1: All API Gateway APIs are fronted with a CloudFront distribution. Each of these CloudFront distributions (whether it's a Custom Domain like yours or the default *.execute-api distribution) is configured to redirect all HTTP requests to HTTPS. Although CloudFront has the option to strictly require HTTPS and return 403 on HTTP requests we

AWS API GATEWAY configuration to return binary pdf file from lambda

孤街浪徒 提交于 2021-01-27 11:58:22
问题 I want to return a pdf from a AWS Lambda function, and I use API Gateway for calling it from a any browser. I have a aws lambda function in c# that returns an API Gateway Response which body is a pdf in base64 encoded string . So far the endpoint returns a file with .pdf extension but not in binary. Instead, is a text file with the base64 string. The headers i'm returning from the c# code are: var headersDic = new Dictionary<string, string>(); headersDic.Add("Content-type", "application/pdf")

Is it possible to configure different API Gateway stages with different lambda versions using AWS SAM

…衆ロ難τιáo~ 提交于 2021-01-27 05:32:12
问题 I have a SAM template for my application. Each time I deploy my SAM template with a new API Gateway stage name, it replaces the previously created stage. So, found this article which helps me in releasing different versions pointing to different lambda versions. https://aws.amazon.com/blogs/compute/using-api-gateway-stage-variables-to-manage-lambda-functions/ But, for this, I have to change API Gateway manually after deployment. So, Is there any way that I can do this using AWS SAM ? For

AWS4 Signature key - is this tutorial wrong?

时光毁灭记忆、已成空白 提交于 2021-01-27 05:23:58
问题 According to this page: Examples of How to Derive a Signing Key for Signature Version 4 The result of this code: $kSecret = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"; $kDate = hash_hmac('sha256', "20120215", "AWS4" . $kSecret); echo "date: " . $kDate . "<br>"; $kRegion = hash_hmac('sha256', "us-east-1", $kDate); echo "region: " . $kRegion . "<br>"; $kService = hash_hmac('sha256', "iam", $kRegion); echo "service: " . $kService . "<br>"; $kSigning = hash_hmac('sha256', "aws4_request",

AWS4 Signature key - is this tutorial wrong?

依然范特西╮ 提交于 2021-01-27 05:22:43
问题 According to this page: Examples of How to Derive a Signing Key for Signature Version 4 The result of this code: $kSecret = "wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY"; $kDate = hash_hmac('sha256', "20120215", "AWS4" . $kSecret); echo "date: " . $kDate . "<br>"; $kRegion = hash_hmac('sha256', "us-east-1", $kDate); echo "region: " . $kRegion . "<br>"; $kService = hash_hmac('sha256', "iam", $kRegion); echo "service: " . $kService . "<br>"; $kSigning = hash_hmac('sha256', "aws4_request",