aws-api-gateway

Secure AWS API Gateway with Lambda Integration

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 10:34:13
I am creating a publicly available API using API Gateway which is backed with lambda functions to do some processing. I have secured it with a custom security header that implements hmac authentication with timestamp to protect against replay attacks. I understand that API Gateway protects against DDOS attacks through its high availability, but any invalid requests will still be passed to the lambda authentication function. So, I guess an attacker can submit invalid unauthenticated requests resulting in high costs. It will take a considerable number of requests to cause damage but it is still

AWS API Gateway Method to Serve static content from S3 Bucket

心已入冬 提交于 2019-11-30 08:40:37
问题 I want to serve my lambda microservices through API Gateway which seems not to be a big problem. Every of my microservices has a JSON-Schema specification of the resource provided. Since it is a static file, I would like to serve it from an S3 Bucket rather than also running a lambda function to serve it. So while GET,POST,PUT,DELETE http://api.domain.com/ressources should be forwarded to a lambda function. I want GET http://api.domain.com/ressources/schema to serve my schema.json from S3. My

How to call API Gateway with Cognito Credentials through retrofit2 on Android?

岁酱吖の 提交于 2019-11-30 07:30:23
I use retrofit2 in my android apps for any http/rest call. Now I need to call an api generated with Amazon AWS API Gateway . The AWS documentation say I should generate the client code throw the API Gateway console and use the class ApiClientFactory to build the request: ApiClientFactory factory = new ApiClientFactory(); // Use CognitoCachingCredentialsProvider to provide AWS credentials // for the ApiClientFactory AWSCredentialsProvider credentialsProvider = new CognitoCachingCredentialsProvider( context, // activity context "identityPoolId", // Cognito identity pool id Regions.US_EAST_1 //

How can I retrieve a user's public IP address via Amazon API Gateway + Lambda (node)

自古美人都是妖i 提交于 2019-11-30 06:25:10
问题 I'm currently writing a Node.js lambda function, in which I want to log the incoming requester's public IP address. I've been looking through both the API Gateway and Lambda docs all day, but haven't found a solution. Does the lambda event object include request metadata I can use to extract the user's IP? 回答1: Here is a simple demonstration of using API Gateway's $context.identity.sourceIp in a Lambda function. API Mapping template: { "sourceIP" : "$context.identity.sourceIp" } Lambda

Regional/Edge-optimized API Gateway VS Regional/Edge-optimized custom domain name

自古美人都是妖i 提交于 2019-11-30 06:16:25
问题 This does not make sense to me at all. When you create a new API Gateway you can specify whether it should be regional or edge-optimized. But then again, when you are creating a custom domain name for API Gateway, you can choose between the two. Worst of all, you can mix and match them!!! You can have a regional custom domain name for an edge-optimized API gateway and it's absolutely meaningless to me! Why these two can be regional/edge-optimized separately? And when do I want each of them to

How to pass a params from POST to AWS Lambda from Amazon API Gateway

时光毁灭记忆、已成空白 提交于 2019-11-30 06:16:12
问题 In this question How to pass a querystring or route parameter to AWS Lambda from Amazon API Gateway shows how to map query string params to AWS lambda using API gateway. I would like to do the same but mapping POST values instead of query-string. I tried: { "values": "$input.params()" } but did not work, I don't see the actual form data. BTW I am posting using: application/x-www-form-urlencoded I get my response from my lambda function, so I know it is invoking lambda fine, but my problem is

Using an api key in amazon api gateway

旧街凉风 提交于 2019-11-30 05:40:32
I have created an api key and added it to my functions. I have then deployed the api and tested it but still get: "message": "Forbidden" How do I pass the api key with my JSON request as I have been using "x-api-key": "theKey"? The x-api-key parameter is passed as a HTTP header parameter (i.e. it is not added to the JSON body). How you pass HTTP headers depend on the HTTP client you use. For example, if you use curl and assuming that you POST the JSON payload, a request would look something like (where you replace [api-id] with the actual id and [region] with the AWS region of your API): $

How can i call AWS Step Functions by API Gateway? [closed]

筅森魡賤 提交于 2019-11-30 05:14:06
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . I would like to know how to make API Gateway call a Step Function and execute it. 回答1: API Gateway added support for Step Functions currently. Now you can create an AWS Service integration via API Gateway Console. Integration Type: AWS Service AWS Service: Step Functions HTTP

AWS Api Gateway Authorizer + Cognito User Pool Not Working {“message”: “Unauthorized”}

岁酱吖の 提交于 2019-11-30 05:01:10
I am trying to use aws api gateway authorizer with cognito user pool. It is working fine when i test using aws api gateway console. But when i try enabling the authorization in the api it says "message": "Unauthorized". Please check below screenshot API Gateway Console Screenshot - This works fine Postman Screen shot - Not working Can someone help please. FYI I have followed the instructions as mentioned here http://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-integrate-with-cognito.html In my case, authorization code should be id_token . I made a mistake for using access

AWS API Gateway: form-data support

﹥>﹥吖頭↗ 提交于 2019-11-30 04:52:25
问题 Is it possible to send request with: Content-Type: multipart/form-data to API Gateway? In my case, I try to send form-data like below via Postman: user[email]:extest829@ex.com user[password]:password user[password_confirmation]:password user[username]:testUser But It seems that API Gateway loses the content. Everything works fine when I send it as: application/x-www-form-urlencoded or application/json . 回答1: Using mulipart/form-data is not fully supported by AWS API Gateway, especially when