aws-api-gateway

How to get the path param value in java AWS Lambda function

情到浓时终转凉″ 提交于 2019-12-12 04:32:38
问题 URL: /test/{userName} In AWS Lambda function , How can I get the {username} path parameter value. I am calling lambda function through AWS API gaetway . 回答1: If you are using AWS integration type: Use a mapping template to send $input.params('username') property in the request body to your Lambda function. If you are using AWS_PROXY integration type: You can access the path parameters via the "pathParameters" property of the incoming event. 来源: https://stackoverflow.com/questions/41762462/how

How to return 1*1 pixel as response from AWS Lambda? [duplicate]

爱⌒轻易说出口 提交于 2019-12-12 03:16:39
问题 This question already has answers here : AWS API Gateway base64Decode produces garbled binary? (3 answers) Closed 7 months ago . I am trying to get 1*1 pixel as response from my AWS Lambda . code is like this : var imgHex = '47494638396101000100800000dbdfef00000021f90401000000002c00000000010001000002024401003b'; var imgBuffer = new Buffer(imgHex, 'hex'); context.succeed({header:"image/png",data:img}); And i mapped response header in API Gateway . But it does't give 1*1 pixel as response. 回答1:

Parameter Validation for AWS Api Gateway

旧街凉风 提交于 2019-12-12 02:49:14
问题 So I created a resource and a GET action on my Api Gateway. I correctly pass my url parameters through Method Execution and through Integration Request via Mapping Templates. Currently I am having my Api endpoint execute a Lambda function when hit and there are parameter validates in my Lambda function. I was hoping there would be a way for Api Gateway to tell me validate the url parameters for me. But I can't find any documentation or blog that teaches me how to do that. I heard in a

How do I define a custom domain name for my Amazon API Gateway API with Private endpoint type

折月煮酒 提交于 2019-12-11 19:36:57
问题 We are setting API Gateway to be accessible only inside VPC or VPC endpoints . In AWS API Gateway you can create a custom domain with Edge or Regional configuration. Is there any way somehow point map DNS name from Route53 to API Gateway "ugly" DNS name for Private type or to VPC Endpoint DNS name but with setting the header parameter automatically(it's also possible to send request VPC Endpoint but with specifying header: <APIGW DNS> )? 回答1: This is not possible. Custom domain names are not

AWS API gateway returns 400 error when square bracket (“[”, “]”) is in path

♀尐吖头ヾ 提交于 2019-12-11 19:16:29
问题 I set up API gateway with Lambda Integration and came across this problem. OK case Request URI: https://api-gateway-host/stage/hoge hoge is not a configured path so this returned: OK: missing authentication token NG case Request URI: https://api-gateway-host/stage/ho[ge The path is ho"["ge. It's also not a configured path so I expected same result but: NG: 400 All of /ho]ge , /ho[]ge , /ho[g]e , /hoge[] and /hoge[1] return the same result. Actually if square brackets are in "query" like /hoge

Custom Domain Name on API Gateway always returns 403 forbidden even though API Gateway returns 200

与世无争的帅哥 提交于 2019-12-11 18:23:02
问题 I have an API Gateway in AWS with url: my.aws.url/prod I defined a custom domain name mywebsite.com whhich points to the prod stage. The result of this is I get a target domain name, which I can then enter as the target of a DNS entry to point mywebsite.com to that target. What's strange is I can access my.aws.url/prod/api/ping just fine and I get 200 OK. But if I enter the target domain name such as target.domain.name/api/ping, it doesn't work. It returns 403 forbidden. 来源: https:/

Is it possible to customize API Gateway custom authorizer response message and status code on unauthorized?

痞子三分冷 提交于 2019-12-11 17:49:56
问题 How do I set the status code to 429 and return a custom message from an API Gateway custom authorizer? 回答1: Am also searching for this solution. i got messages like custom message & status code from our custom authorizer is not enabled. refer here - https://forums.aws.amazon.com/thread.jspa?threadID=226689 But while coding for custom authorizer found that you can send either 401 or 403 //this will send status - 401 , body - {"message":"unauthorized"} context.fail('Unauthorized') /*this will

How can I set up Web Sockets on AWS and log incoming messages to s3 (elastic beanstalk project) mysql db

ⅰ亾dé卋堺 提交于 2019-12-11 17:38:39
问题 I have an existing LAMP project on AWS (Elastic-beanstalk). I now what to set up web sockets on AWS too. According to AWS documentation, the way to do that is via AWS API Gateway. I don't know how this all works but there's documentation I found for setting up WebSockets. Does the Gateway API connect to another service? If so, what service is this? What am I missing? I mostly just want to make a Web Socket service to look incoming messages to the MySQL database on my Elastic-beanstalk project

API-Gateway Integration Request HTTP Header not mapping query string to header

China☆狼群 提交于 2019-12-11 16:32:54
问题 On Api-Gateway i'm trying so set up mapping from 'Method Request' query string to 'integration request' headers to lambda but the mapping never reach the lambda function. On 'Method Request' > 'URL Query String Parameters' I set it up the name 'customerIdentification' Then as the documentation says: doc went to 'Integration Request' > 'HTTP Headers' add a name 'userId' and mapped to 'method.request.querystring.customerIdentification' package main import ( "context" "encoding/json" "fmt"

API Gateway Cloudwatch advanced logging

爱⌒轻易说出口 提交于 2019-12-11 16:30:45
问题 I am trying to get to the point of billing for API calls made to our services, this includes creating metrics for each API Key usage, but before I even start that I would like to understand a certain aspect of the CloudWatch logs first. In this first image, you'll notice 1.06 million hits recorded on the graph at 6 weeks and 30 day period: My understanding on this is that the 1.06m is the amount of hits that have taken place on this API, the "custom (6w)" is the time period, i.e. over 6 weeks