aws-api-gateway

How to invoke lambda async with AWS ApiGateway HttpApi

拥有回忆 提交于 2020-07-03 10:15:12
问题 I'm using the new HTTP Api (The one introduced in December 2019) of AWS Api Gateway. I used to work with REST Api, which lets you trigger lambda functions async by adding X-Amz-Invocation-Type:Event header. The new HTTP Api does not let you specify that header, how can I call lambda functions asynchronously? thanks in advance 回答1: You can invoke a Lambda function asynchronously via API Gateway only if the integration is non-proxy. By default, HTTP APIs are designed to support only proxy

Destination only works when Lambda is invoked through AWS CLI

依然范特西╮ 提交于 2020-06-28 03:44:07
问题 I have a hello-world test Lambda configured with: trigger: API Gateway destination: Amazon SQS. one queue for success, and another for failure. import json def lambda_handler(event, context): print("Received event: " + json.dumps(event)) return { "statusCode": 200, "body": 'success' } When I invoke the Lambda via the CLI, the message gets enqueued to the success queue as expected: aws lambda invoke --function-name event-destinations --invocation-type Event --payload '{}' response.json However

AWS API Gateway 403 Forbidden

帅比萌擦擦* 提交于 2020-06-27 08:33:35
问题 I have created one API in AWS API Gateway. In that API I created one proxy resource with custom http endpoint. But when I access the API Gateway endpoint https://2r3g3ttr6y.execute-api.eu-east-1.amazonaws.com/production/abc/abc.html it is not working whereas the original HTTP endpoint is working perfectly fine. I get {"message":"Forbidden"} response. Here is the setting: NOTE: The above API Endpoint is just a dummy endpoint. 回答1: This thing happened to me in the past because I forget to

Mapping multiple values for x-amazon-apigateway-integration.requestParameters for a single key?

耗尽温柔 提交于 2020-06-17 14:15:06
问题 I'm trying to create a new API on Amazon API gateway but for my use-case I want to concatenate 2 values for a single key in request parameters. How can we specify multiple values for a single key in integration.requestParameters ? This is what I'm trying to achieve but the syntax is not correct and it's giving me error: For one to one mapping we use something like this integration.request.querystring.start: "method.request.querystring.oauth_code" Documentation link 来源: https://stackoverflow

AWS CDK how to create an API Gateway backed by Lambda from OpenApi spec?

大兔子大兔子 提交于 2020-06-17 02:07:13
问题 I want to use AWS CDK to define an API Gateway and a lambda that the APIG will proxy to. The OpenAPI spec supports a x-amazon-apigateway-integration custom extension to the Swagger spec (detailed here), for which an invocation URL of the lambda is required. If the lambda is defined in the same stack as the API, I don't see how to provide this in the OpenAPI spec. The best I can think of would be to define one stack with the lambda in, then get the output from this and run sed to do a find-and

AWS CDK how to create an API Gateway backed by Lambda from OpenApi spec?

耗尽温柔 提交于 2020-06-17 02:05:11
问题 I want to use AWS CDK to define an API Gateway and a lambda that the APIG will proxy to. The OpenAPI spec supports a x-amazon-apigateway-integration custom extension to the Swagger spec (detailed here), for which an invocation URL of the lambda is required. If the lambda is defined in the same stack as the API, I don't see how to provide this in the OpenAPI spec. The best I can think of would be to define one stack with the lambda in, then get the output from this and run sed to do a find-and

Frequent timeout with app using Serverless Framework (AWS Lambda/Gateway), Express, Mongoose/MongoDB Atlas

早过忘川 提交于 2020-06-12 06:14:13
问题 Trigger warning : Beginner question. I built an api using Express and Mongoose with a MongoDB Atlas DB. Most of the time, it works normally, but often I get timeout errors. This seems to happen very randomly and concerns all routes, etc... Precisely, I get : `502 Internal server error via POSTMAN` and in the Serverless Dashboard, I get : invocation time invoked 1 day ago, mar 08 at 1:38pm fatal error Function execution duration going to exceeded configured timeout limit. cold start duration

How to access private API Gateway over on-prem/VPN?

余生长醉 提交于 2020-06-01 04:09:09
问题 I have created an API gateway to run a Lambda function. This is meant to be used as an internal service so my API gateway is private. In order to make the API gateway accessible privately I did the following: Created a VPC endpoint in a couple of subnets of our VPC Added the endpoint to a security group that only allows traffic from on-prem Added a resource policy to the API gateway that only allows requests from the VPC endpoint These steps effectively block public requests and allow

Access API gateway endpoint in cloudformation using custom resource

久未见 提交于 2020-05-31 04:06:36
问题 I want to be able to call a API gateway endpoint from within cloudformation and parse the response from the output and pass in relevant information to one of the other service in the cloudformation. I have an api endpoint https://123x123x.execute-api.eu-west-2.amazonaws.com/myendpoint/tenants with x-api-key: b8Yk6m63rq8XRnMDKa2PeWE3KvBcU7ZyFIn0Vvrty Content-Type: application/json which returns { "tenants": [ { "tenantId": "tenant-1234", "AZ": "us-west-2c", "tenantUsers": 24, "instanceType":

Access API gateway endpoint in cloudformation using custom resource

拈花ヽ惹草 提交于 2020-05-31 04:06:11
问题 I want to be able to call a API gateway endpoint from within cloudformation and parse the response from the output and pass in relevant information to one of the other service in the cloudformation. I have an api endpoint https://123x123x.execute-api.eu-west-2.amazonaws.com/myendpoint/tenants with x-api-key: b8Yk6m63rq8XRnMDKa2PeWE3KvBcU7ZyFIn0Vvrty Content-Type: application/json which returns { "tenants": [ { "tenantId": "tenant-1234", "AZ": "us-west-2c", "tenantUsers": 24, "instanceType":