aws-api-gateway

Return HTML from AWS API Gateway

谁说我不能喝 提交于 2019-11-28 04:44:31
I am trying to achieve the same thing as this post , but I do not understand the reply there and don't have permission to ask for clarification in the comments. I have an API Gateway endpoint that accepts a GET request, passes through some request variables to the Lambda function (implemented in Python), and returns text/html via an Empty Response Model (as described here As described in the earlier SO question, if the Lambda function returns an HTML string and the API endpoint uses the default Output Passthrough behavior @ Integration Response, the HTML output is quoted: "\n<html>\n<body>\n .

401 return from an API Gateway Custom Authorizer is missing 'Access-Control-Allow-Origin' header

谁都会走 提交于 2019-11-28 03:55:40
In order to prevent users who have not logged in to call my lambda function through the AWS API Gateway, I'm using the Custom Authorizer lambda solution. If the request is authorized (200) and I get a response from the called lambda everything works fine and I get the Access-Control-Allow-Origin header. But if the request is not authorized, I get a 401 that has no Access-Control-Allow-Origin header, therefore preventing me from reading the 401 status of the response and redirecting the user to the log-in page. I believe this is because the Custom Autorization mechanism is unaware that the

AWS Lambda API gateway with Cognito - how to use IdentityId to access and update UserPool attributes?

*爱你&永不变心* 提交于 2019-11-28 03:49:51
OK I am now days into this and have made significant progress but am still completely stumped about the fundamentals. My application uses Cognito User Pools for creating and managing users - these are identified on S3 it seems by their IdentityId. Each of my users has their own S3 folder, and AWS automatically gives them a folder name that is equal to the user's IdentityId. I need to relate the IdentityId to the other Cognito user information but cannot work out how. The key thing I need is to be able to identify the username plus other cognito user attributes for a given IdentityId - and it's

AWS API Gateway with AWS WAF

笑着哭i 提交于 2019-11-28 03:31:57
问题 I want to use AWS Web Application Firewall service with AWS API Gateway. AWS WAF works only with AWS CloudFront distributions. According to this post https://forums.aws.amazon.com/message.jspa?messageID=677382 API Gateway creates a CloudFront distribution behind the scenes. Although I don't see this distribution neither in the CloudFront console nor in the WAF console. Is there any way to make use of the CloudFront distribution created by API Gateway for WAF? 回答1: Unfortunately no, API

How to upload file to lambda function or API Gateway?

…衆ロ難τιáo~ 提交于 2019-11-27 21:43:51
问题 I'm try to upload file from iOS to AWS API Gateway and passthrough it to Lambda function, How can I implement this scenario? I can use multipart/form-data to upload to AWS API Gateway but how make input Model support binary data? [Edit1] moved from answer by Spektre Thanks For response, after a little of reading I figure out that's no way to upload file to lambda (and it's not logical because it's event based) and the only valid use case to upload to S3 and make S3 notify lambda. 回答1: I'd

Lambda Integration vs. Lambda Proxy: Pros and Cons

余生长醉 提交于 2019-11-27 20:12:53
问题 What do you think are the Pros and Cons of using Lambda integration with and without the proxy feature in AWS API Gateway (and more specifically, when using the Serverless framework)? Here's what I think up to now: Lambda Integration with Proxy Pro : One can rapidly prototype and code without worrying about all the needed configuration details (and reinventing a few wheels like generic template mappings, etc). Pro : It's really easy to return any status code and custom headers, while at the

AWS API Gateway - CORS + POST not working

房东的猫 提交于 2019-11-27 20:10:48
CORS is really driving me crazy and I'm really out of ideas as of what to try to make it work. I have created a simple APIG Api with 1 resource called 'abc' and added 2 methods GET and POST both with Authorization set to NONE and API Key Required set to false , everything deployed to a stage called 'dev'. Of course I enabled CORS on both methods and I see the 3 headers Access-Control-Allow-Origin , Access-Control-Allow-Headers and Access-Control-Allow-Methods added to the OPTIONS method and the Access-Control-Allow-Origin added to the POST and GET methods. Both calls are mapped to the same

Getting json body in aws Lambda via API gateway

不羁的心 提交于 2019-11-27 19:15:50
I'm currently using NodeJS to build a bot on AWS lambda via AWS Api Gateway and I'm running into an issue with POST requests and JSON data. My api uses 'Use Lambda Proxy integration' and even when I test the proxy sending a content-type of Application/json and some json in the body e.g {"foo":"bar"} I can't access the object without parsing it first e.g var json = JSON.parse(event.body); console.log(json.foo); Now I know this doesn't seem a big deal just running it through JSON.parse, but I've seen a number of other examples where this isn't the case at all. see here https://github.com/pinzler

Api gateway get output results from step function?

冷暖自知 提交于 2019-11-27 16:14:33
问题 I followed tutorial on creating and invoking step functions I'm getting output in my GET request of api as { "executionArn": "arn:aws:states:ap-northeast-1:123456789012:execution:HelloWorld:MyExecution", "startDate": 1.486772644911E9 } But, instead of above response I want my step functions output, which is given by end state as below. { "name":"Hellow World" } How to achieve this? 回答1: AWS Step Functions are asynchronous and do not immediately return their results. API Gateway methods are

How to authenticate API Gateway calls with Facebook?

孤人 提交于 2019-11-27 14:03:04
问题 Problem: I want to authorize my Amazon API Gateway hosted REST API users using Facebook Authentication. My Understanding: I know Amazon Cognito can be used to authenticate users, calling as Federated Identities. Then, I saw Authenticate API Clients with Amazon Cognito Your User Pool, which authenticates for Cognito User Pool. I also found Use Amazon API Gateway Custom Authorizers, to use from custom authorization. But, I did not find to link API Gateway to authenticate using Cognito Federated