aws-api-gateway

How to have set up Stage in API gateway to have resources pointing to different lambda in different stages

天大地大妈咪最大 提交于 2021-02-11 06:53:27
问题 I was wondering what is the exact functionality of the "Stage" in the API gateway console. What I am trying to achieve is. To have the same resources with the same HTTP methods point to different lambda function in different stages. my development URL point to my development lambda and my production URL point to the production lambda. will it be possible? 回答1: Yes it is possible through stage variables. The variables allow you to invoke different functions depending on the used stage. This is

How can I deny public access to an AWS API gateway while allowing access by only a specific role?

◇◆丶佛笑我妖孽 提交于 2021-02-11 04:38:09
问题 I would like to deny public access to an AWS API Gateway and only allow access when the API is invoked with a specific role. In my test there are two gateways, and one calls the other: Public Gateway -> Private Gateway I want to be able to visit Public Gateway endpoints in a browser and receive a 2XX response, and when visiting the Private Gateway directly I should receive a 4XX response. The only way to access the Private Gateway should be via the Public Gateway (which proxies to the Private

How can I deny public access to an AWS API gateway while allowing access by only a specific role?

老子叫甜甜 提交于 2021-02-11 04:37:15
问题 I would like to deny public access to an AWS API Gateway and only allow access when the API is invoked with a specific role. In my test there are two gateways, and one calls the other: Public Gateway -> Private Gateway I want to be able to visit Public Gateway endpoints in a browser and receive a 2XX response, and when visiting the Private Gateway directly I should receive a 4XX response. The only way to access the Private Gateway should be via the Public Gateway (which proxies to the Private

How can I deny public access to an AWS API gateway while allowing access by only a specific role?

做~自己de王妃 提交于 2021-02-11 04:37:12
问题 I would like to deny public access to an AWS API Gateway and only allow access when the API is invoked with a specific role. In my test there are two gateways, and one calls the other: Public Gateway -> Private Gateway I want to be able to visit Public Gateway endpoints in a browser and receive a 2XX response, and when visiting the Private Gateway directly I should receive a 4XX response. The only way to access the Private Gateway should be via the Public Gateway (which proxies to the Private

How to make the AWS API Gateway request path case insensitive

五迷三道 提交于 2021-02-10 17:24:45
问题 It seems that the request path setup in AWS API gateway is case sensitive. Can anyone suggest any solution to make the request path to be case insensitive For example: https://api-gw.some-domain/health is accessible whereas https://api-gw.some-domain/Health is not accessible. (404) 回答1: Unfortunately API Gateway, like most of AWS' offerings, is case-sensitive by design. You therefore have two options: Use CloudFront with Lambda@Edge to re-write your requests (this is quite involved, but a

sam package is reducing the size of my template

余生颓废 提交于 2021-02-10 14:36:42
问题 I have a SAM template that I am using to building 4 lambda functions integrated with API gateways. AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: An AWS Serverless Specification template describing your function. #To avoide 'stage' being created when deploying the Api gateway. Globals: Api: OpenApiVersion: 3.0.1 Resources: # api gateway model for all user methods ApiGatewayApi: Type: AWS::Serverless::Api Properties: Name: loadeo_user StageName:

Enable CORS in AWS API Gateway with aws-cli

梦想与她 提交于 2021-02-10 07:37:07
问题 I'm currently writing script to programmatically enable CORS once a resource is added to an API Endpoint on AWS API Gateway. After exploring the put-integration-response function for hours. I almost got a breakthrough, but here is an error I'm getting: An error occurred (BadRequestException) when calling the PutIntegrationResponse operation: Invalid mapping expression specified: Validation Result: warnings : [], errors : [No method response exists for method.] Here is the script I'm using to

API Gateway Websockets - Dealing with 10 minute idle connection timeout

廉价感情. 提交于 2021-02-10 06:44:19
问题 I have simple chatroom application and if no users send any messages, the websocket closes after about 10 minutes. What is the best solution to keep the connection alive without reconnecting? 回答1: It is always possible to send pings, the other side will have to reply with pong. (proof) This tutorial might help you with that. 来源: https://stackoverflow.com/questions/58401092/api-gateway-websockets-dealing-with-10-minute-idle-connection-timeout

Invalid model schema specified for swagger

烈酒焚心 提交于 2021-02-09 10:57:56
问题 I tried to deploy API on AWS but it not allowed to add a model in the JSON file and shows error : It working without the use of model so maybe it not take model this way so please suggest me how to use a model in API JSON on AWS! Error is : Your API was not imported due to errors in the Swagger file. Unable to create model for 'LandingPageDTO': Invalid model specified: Validation Result: warnings : [], errors : [Invalid model schema specified] Unable to put method 'POST' on resource at path '

Invalid model schema specified for swagger

≡放荡痞女 提交于 2021-02-09 10:57:08
问题 I tried to deploy API on AWS but it not allowed to add a model in the JSON file and shows error : It working without the use of model so maybe it not take model this way so please suggest me how to use a model in API JSON on AWS! Error is : Your API was not imported due to errors in the Swagger file. Unable to create model for 'LandingPageDTO': Invalid model specified: Validation Result: warnings : [], errors : [Invalid model schema specified] Unable to put method 'POST' on resource at path '