aws-api-gateway

API Gateway Caching vs CloudFront

蓝咒 提交于 2019-12-18 16:09:13
问题 I'm a bit confused by how API Gateway and CloudFront work together. Ultimately, I want to be able to have a custom header and value be considered part of my cache key. I know this can be done by whitelisting (if I'm using CloudFront). So when I make the following request: GET /pagesRead/4 Some-Header: fizz This returns, for instance, '29 pages' Then there's a post that updates id 4 to '45 pages' If I make this request GET /pagesRead/4 Some-Header: buzz It will now return '45 pages' But I'm

AWS Lambda fails to return PDF file

穿精又带淫゛_ 提交于 2019-12-18 15:48:22
问题 I have created a lambda function using serverless. This function is fired via API Gateway on a GET request and should return a pdf file from a buffer. I'm using html-pdf to create the buffer and trying to return the pdf file with the following command let response = { statusCode: 200, headers: {'Content-type' : 'application/pdf'}, body: buffer.toString('base64'), isBase64Encoded : true, }; return callback(null, response); but the browser is just failing to load the pdf, so I don't know

Returning images through AWS API Gateway

被刻印的时光 ゝ 提交于 2019-12-18 12:22:33
问题 I'm trying to use AWS API Gateway as a proxy in front of an image service. I'm able to get the image to come through but it gets displayed as a big chunk of ASCII because Content-Type is getting set to "application/json". Is there a way to tell the gateway NOT to change the source Content-Type at all? I just want "image/jpeg", "image/png", etc. to come through. 回答1: I was trying to format a string to be returned w/o quotes and discovered the Integration Response functionality. I haven't tried

Missing Authentication Token while accessing API Gateway?

自古美人都是妖i 提交于 2019-12-18 12:03:23
问题 I am trying to call a Lambda Function through AWS API Gateway. When I mention Authentication type NONE it works fine but API become public and anyone with url can access my API. To make API call secure, I am using Authentication type AWS_IAM and also attached AmazonAPIGatewayInvokeFullAccess policy to my user but getting this error: { message: "Missing Authentication Token"} I don't know what I am missing here. 回答1: I think you are directly trying to access API link, this won't work because

Setup a basic WebSocket mock in AWS ApiGateway

半城伤御伤魂 提交于 2019-12-18 11:58:03
问题 I am trying to setup an extremely simple WebSocket mock within AWS ApiGateway. However, every attempt I've tried gives me an error: 13:36:52 (X33uOGUfIAMFq7w=) Extended Request Id: X33uOGUfIAMFq7w= 13:36:52 (X33uOGUfIAMFq7w=) Verifying Usage Plan for request: X33uOGUfIAMFq7w=. API Key: API Stage: redacted/prod 13:36:52 (X33uOGUfIAMFq7w=) API Key authorized because route '$connect' does not require API Key. Request will not contribute to throttle or quota limits 13:36:52 (X33uOGUfIAMFq7w=)

Can I specify HTTP endpoint in a VPC as resource in AWS API Gateway?

主宰稳场 提交于 2019-12-18 11:33:30
问题 I have a situation when my product(some Web API) is living inside of VPC, i.e. with no any any external access. I'd like to expose the part of this APIs(just a couple of HTTP methods) to be accessible from the internet. I'm trying to achieve this using AWS API Gateway but it looks like I cannot make internal ELB endpoint the API Gateway resource. Any ideas how can I do this? Thanks, --Vovan 回答1: This was originally not possible, and then was solved with support for client certificates that

AWS API Gateway should prevent use of TLS v1

时间秒杀一切 提交于 2019-12-18 04:45:11
问题 Refering to AWS Cloudfront Documentation, AWS API Gateway supports TLS v1.0, v1.1, v1.2. But I want to limit the encryption protocols to TLS v1.1 and v1.2 for my Gateway API. Where do I configure this? I do not see any cloudfront distribution for my API. Gateway resource page does not have an option to specify the security protocol. My API is running in production for last 2 years using a custom domain. Any idea how do I limit my API to TLS V1.1 and V1.2 protocols only in API Gateway? 回答1: In

aws api gateway & lambda: multiple endpoint/functions vs single endpoint

三世轮回 提交于 2019-12-17 21:46:33
问题 I have an AWS api that proxies lamba functions. I currently use different endpoints with separate lambda functions: api.com/getData --> getData api.com/addData --> addData api.com/signUp --> signUp The process to manage all the endpoints and functions becomes cumbersome. Is there any disadvantage when I use a single endpoint to one lambda function which decides what to do based on the query string? api.com/exec&func=getData --> exec --> if(params.func === 'getData') { ... } 回答1: It's

Posting form-data and binary data through AWS API Gateway

白昼怎懂夜的黑 提交于 2019-12-17 18:40:17
问题 I'm trying to POST "mutlipart\form-data" to my EC2 instance through AWS API Gateway, but I couldn't find a way to this. There is a way to post data using "application/x-www-form-urlencoded" and Mapping Tamplate to convert it to JSON but still posting a binary data like an image file is missing I guess. Is there anything I'm missing ? EDIT: I have found another way: I convert the image to base64 string then POST it as with content type "application/x-www-form-urlencoded". By this way I'm

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

烂漫一生 提交于 2019-12-17 17:33:48
问题 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