aws-api-gateway

Whitelist IP of AWS API Gateway API endpoint in company's firewall

我怕爱的太早我们不能终老 提交于 2020-01-06 07:20:22
问题 I have built an AWS API Gateway API endpoint which will be hit by one of the machines of my company's network to POST data every regular interval. But, the office firewall blocks it when I try it from office network through Postman (but when I use mobile hotspot/other wifi, it works seamlessly due to no firewall challenge), so I have to give the range of IP addresses to be white-listed by the office network team to be able to hit the API endpoint. Where to get the IPs? Will they be constant

How to create predefined restApi resource? with explicit name

匆匆过客 提交于 2020-01-06 06:35:25
问题 Below is the SAM template that tries giving explicit name( some_name ) to restApi resource on AWS: SampleApi: Type: AWS::Serverless::Api Properties: Name: some_name But I see the events in stack creation as: User: arn:aws:sts::1111222333344:assumed-role/some-role/i-34454503ea88 is not authorized to perform: apigateway:DELETE on resource: arn:aws:apigateway:us-east-1::/restapis/vxrf0gfs2a where vxrf0gfs2a is the random name of restApi Cloudformation stack creates Api gateway with explicit name

How to create predefined restApi resource? with explicit name

不问归期 提交于 2020-01-06 06:35:22
问题 Below is the SAM template that tries giving explicit name( some_name ) to restApi resource on AWS: SampleApi: Type: AWS::Serverless::Api Properties: Name: some_name But I see the events in stack creation as: User: arn:aws:sts::1111222333344:assumed-role/some-role/i-34454503ea88 is not authorized to perform: apigateway:DELETE on resource: arn:aws:apigateway:us-east-1::/restapis/vxrf0gfs2a where vxrf0gfs2a is the random name of restApi Cloudformation stack creates Api gateway with explicit name

Velocity Template Language: How to import EscapeTool

自闭症网瘾萝莉.ら 提交于 2020-01-06 04:47:04
问题 I am trying to use unurl for my mapping template. $url -> hello here & there $esc.url($url) -> hello+here+%26+there $esc.unurl($esc.url($url)) -> hello here & there I wrote the following mapping template, but $esc.unurl([...]) doesn't work. I couldn't figure out how to fix it. One reason might be that I am missing an import, but I don't know how to import the EscapeTool properly. #set($httpPost = $input.path('$').split("&")) { #foreach( $kvPair in $httpPost ) #set($kvTokenised = $kvPair.split

AWS API Gateway Method request path parameter not working

泄露秘密 提交于 2020-01-06 04:36:42
问题 I am trying to configure API Gateway to route requests to a specific route on my backend GO microservice. I am using a GET request method with a VPC_LINK integration with an NLB , which routes to my backend microservice running in Fargate . This is a simple REST api written in GO . On the service side, in my handler, I put a catch all response for my stage route and then a "Hello World" response for the /nmapscan route, which is what I am trying to hit. However, when I try to hit my backend

502 internal server error response from API gateway from lambda function

百般思念 提交于 2020-01-05 07:18:13
问题 this is my lambda function: I've obviously blanked out the config for now exports.handler = (event, context) => { var config = { }; firebase.initializeApp(config) const gymData = firebase.database().ref("gymData/exercises") axios.get('https://------/gymData/exercises.json').then(({data}) => { const returnedData = Object.values(data) const response = { statusCode: '200', body: JSON.stringify(returnedData), headers: { 'Content-Type': 'application/json', } } context.succeed(response) }) }; when

Giving AWS Api Gateway Permission To Invoke Lambda Function using BOTO3

 ̄綄美尐妖づ 提交于 2020-01-05 05:36:10
问题 I am attempting to use BOTO3 to create an Api Gateway method that invokes a lambda function. I have so far been unable to find how to grant the necessary permissions. Curiously, setting the lambda method name manually through the AWS console sets up permissions automatically. I have been unable to replicate this in code. This is the code I am using to set up the gateway: # Create a rest api self.rest_api = self.apigateway.create_rest_api( name='AWS_CMS_Operations' ) # Get the rest api's root

Authorizing AWS API Gateway requests from token in query string

蓝咒 提交于 2020-01-05 04:30:13
问题 I have API Gateway set up with a Cognito authorizer that correctly authorizes any request with the id token in the header. This is fine when requests are XHR based as I can add the header when preparing the request. However I can't add this when using <audio src="http://api-gateway/..."> which is made directly by the browser. The best I can do is append the token in the querystring ( ?token=... ) but Cognito only accepts tokens in the headers. Is there any way to get Cognito to authorize

HttpContext.Request is blank for a middleware running on AWS API Gateway

試著忘記壹切 提交于 2020-01-05 04:18:10
问题 I have a .Net Core webapi that i have deployed on the AWS API Gateway. I created a middleware to process all incoming requests and outgoing responses. That middleware works perfectly fine on any local machine, which means, before http request hits my api controller, it goes through that middleware and being processed there correctly, but when it is deployed to AWS API Gateway, context.Request is always blank... Here is how the middleware is implemented public class RequestLoggingMiddleware {

AWS API Gateway with Lambda Authorizer

僤鯓⒐⒋嵵緔 提交于 2020-01-05 04:13:10
问题 I am trying to configure an API Gateway which takes a proxy parameter from the request path, and also a parameter from the Lambda authorizer return and put it in the header, so that it can be passed to my Elastic Beanstalk REST API running Spring Boot. The proxy path is working as expected; and I see my Lambda function is returning the variable "x-api-auth" in the "context" map as per documentation. The only piece not working is adding "x-api-auth" to the request header. :( Whenever I ran my