aws-api-gateway

Limit access to lambda or api gateway to a specific vpc

不问归期 提交于 2019-12-09 13:32:42
问题 is it possible to make an api gateway or lambda function accessible only by a specific vpc. I searched in amazon doc, but I didn't find anything about this subject. Thank you in advance 回答1: Unfortunately, you won't be able to do that (See update below). s3 is the service which provides that kind of control access through Bucket policies . What you can do is grant permissions to your callers (Lambda invoker and API caller) . Take a look at these resources: Control Access to an API with IAM

Get non file body from multipart/form-data using AWS API Gateway and Lambda

若如初见. 提交于 2019-12-09 11:36:05
问题 I am trying to get the form data from a multipart/form-data POST to my ASW Lambda web service via API Gateway. The HTTP POST has Content-Type "multipart/form-data" and body that is URL encoded. File data is also sent in this post (hence the multipart, I guess). The web service needs to integrate with a thirdparty service, so changing the format of the POST isn't really an option. I have seen this thread talking about converting the URL encoded data to JSON object for use in Lambda, but this

Access HTTP request (headers, query string, cookies, body) object in lambda with http endpoint

馋奶兔 提交于 2019-12-09 08:51:52
问题 I am trying to see how to access the request header and body values from with in the lambda code. If the request body is in JSON format, it automatically seems to be parsed and made available in the event object. How can I access the complete query string, request body, request headers (cookies) for any type of incoming "Content-Type" request inside Lambda ? The edits below are information I have gathered to help solve the question that may or may not be relevant. Please ignore them if you

AWS API Gateway: Pass Referrer URL

喜欢而已 提交于 2019-12-09 06:45:29
问题 Is it possible for requests to the API-Gateway to pass the referrer URL to Lambda? For example, I'd love to let my lambda functions know if a request comes from the domain "good.com" vs. "bad.com". I'm familiar with the list of supported $context Variables and I know a referrer url is not in there. I'm wondering if there is another way. If it is possible, what steps do I need to take? 回答1: Here's how to do it. As it turns out, the mapping template allows you to map HTTP headers, not just the

Can AWS API Gateway cache invalidate specific entries based on the response content?

こ雲淡風輕ζ 提交于 2019-12-09 03:51:27
I have used AWS API Gateway with the endpoint as a lambda function. I have enabled the cache functionality provided by API Gateway, to reduce both response time & the number of calls forwarded to my lambda function. The lambda function queries another data store to return data. If data is not found, an asynchronous call is made to update the data store and "data not found" is returned to the caller. Now the API Gateway is even caching this result, which we do not want to happen. This results in the cache always returning "data not found" for its lifetime (1 hr TTL), even though data is updated

AWS API Gateway with Step Function

我怕爱的太早我们不能终老 提交于 2019-12-09 01:52:32
问题 I want a sample to integrate AWS API Gateway with Step Function. I have read this tutorial Creating a Step Functions API Using API Gateway but that tutorial needs me to send request in format of { "input": "{}", "name": "PostmanExecution", "stateMachineArn": "arn:aws:states:us-east-1:123456789012:stateMachine:Custom" } I want to send normal request and configure this stateMachineArn in API Gateway only, so that clients dont need to send this. 回答1: Create your API Gateway resource and method.

Send an array as a parameter in a Alamofire POST request

試著忘記壹切 提交于 2019-12-08 23:33:29
问题 My app is currently using AWS API Gateway and Alamofire to access different lambda functions that act as my backend. I have the need to send an array as one of the parameters to one of those API end points, for that I am using the following code: var interests : [String] interests = globalInterests.map({ (interest) -> String in return interest.id! }) // Parameters needed by the API let parameters: [String: AnyObject] = [ "name" : name, "lastName" : lastName, "interests" : interests ] // Sends

Passing HTTP Post from AWS API GW to Lambda

♀尐吖头ヾ 提交于 2019-12-08 18:37:28
I process the HTTP POST from a service that does not support JSON (Mailgun). It appears if I create an AWS API GW for POST and pass this to an AWS Lambda function that the data must be in JSON. Other than trying to serialize the POST to JSON (which I would prefer not to), does anyone know if this is the case? I found a solution here, works for me. https://forums.aws.amazon.com/thread.jspa?messageID=673012&tstart=0#673012 The following is from the original post for a complete answer. Step-by-step instructions are as follows: Amazon API Gateway -> Click "Create API". API name = "myTestAPI",

How to access AWS API Gateway documentation using Swagger UI

二次信任 提交于 2019-12-08 16:53:43
问题 I have created API using AWS Api Gateway. Then i have documented documentation parts for all the entities ( like API, RESOURCE, METHOD, MODEL etc). Then using AWS Gateway Console i have published the documentation to dev stage with version 1 But i am not sure how do i (or the consumer of the API) going to access the documentation? There is an Export option that can export documentation as Swagger or OpenAPI3 . This will create .json or .yaml file and then consumer has to import these files

Is there any way to signal an error in AWS Lambda for Java without throwing an exception?

只愿长相守 提交于 2019-12-08 16:41:26
问题 If my Lambda throws an Exception with the message 404 then the response as seen in API Gateway is { "errorMessage":"404", "errorType":"java.lang.Exception", "stackTrace":[..."] } and I can match on the errorMessage to affect the HTTP result. However if I return effectively the same result, viz: { "errorMessage":"404", "errorType":"Error" } API Gateway doesn't seem to recognise that there is an error and always returns a 200. Is there any way for my nice functional code to signal an error