aws-api-gateway

Amazon APi gateway fails to generate transformed request

梦想与她 提交于 2019-12-10 13:30:51
问题 I was trying the integration of Amazon API gateway with Lambda function. I was successfully able to achieve though but when I tried with curl it fails. Lambda method, API gateway integration along with template mapping under integration request are setup. When I run "test" from console, it works fine Execution log for request test-request Wed Nov 04 07:27:30 UTC 2015 : Starting execution for request: test-invoke-request Wed Nov 04 07:27:30 UTC 2015 : API Key: test-invoke-api-key Wed Nov 04 07

Create a Contact form in Angular 2 / 4 that POSTS JSON to a specified API

為{幸葍}努か 提交于 2019-12-10 12:08:11
问题 I'm trying to create an Angular 2 / 4 project that has a 'Contact Us' form that creates data via JSON.stringify to then POST to my API that I have setup in AWS API Gateway. This uses Lambda and SES to email the details to me. I am struggling learning Angular 2 / 4 and an working example of such type of form would be a terrific learning tool to amend and learn from. I have followed many Angular 2 example videos and read tutorials, but, I'm unable to find a simple form that POSTs JSON to an API

Is it possible to have an internal load balancer with elasticbeanstalk to create a private service?

五迷三道 提交于 2019-12-10 11:44:01
问题 I have an api that I deploy using elasticbeanstalk, and I wish to make it completely internal so that it cannot be accessed from the public Internet. I am doing this because I only want the service to be accessible via our other services (that each run in their own VPCs and are all deployed via elasticbeanstalk). Is it possible to use an internal ELB with elasticbeanstalk? Is this even what I need to do? Can VPC peering help me here? The ultimate aim is that the api needs to have some http

Setting Cookie in http response header from AWS lambda Node JS

元气小坏坏 提交于 2019-12-10 11:34:17
问题 I have a Lambda proxy integration enabled, and setting the response headers as part of Lambda output and API Gateway that will return them as part of the HTTP response to the client. Sample code: callback(null, { "statusCode": 302, "Location" : "https://somewebsite.com" "headers": { "headerName": "headerValue", ... }, "body": "..." }); I need to send out 3 cookies in the headers. I tried. But, failed: callback(null, { "statusCode": 302, "Location" : "https://somewebsite.com" "headers": { "Set

Get CloudFront custom domain in the headers of a request

柔情痞子 提交于 2019-12-10 11:15:04
问题 I have a CloudFront distribution abcd1234.cloudfront.net and I've added a custom domain of mysite.com to the distribution. The CloudFront distribution's origin: aaabbbccc.execute-api.us-east-1.amazonaws.com When I load the page mysite.com/hello/world , CloudFront is then consuming API Gateway aaabbbccc.execute-api.us-east-1.amazonaws.com/prod/{proxy+} the API Gateway path endpoint is invoking a Lambda Function that calls a function like getPageContent(customDomainName, pagePath) which should

Is it possible to pass a stage variables to a custom authorizer in AWS API Gateway?

大城市里の小女人 提交于 2019-12-10 10:13:03
问题 I'm currently developing an API using AWS API Gateway. I'm issuing a JSON Web Token (JWT) to my client. That JWT is signed using a secret. I'm currently storing the secret in stage variables. I want to use a custom authorizer to validate the JWT's signature. However I can't seem to find a way of passing the stage variable containing my secret to my custom authorizer. For the authorisation endpoint issuing the JWT, I've used Lambda Proxy Integration to pass the secret from the stage variable

AWS Lambda chaining best practice

不羁的心 提交于 2019-12-10 10:04:35
问题 I'm looking a solution for my problem and maybe someone could give me some ideas. I have a API Gateway plugged to a aws lambda A. I have to handle cases like this: Lambda A should call lambda B and if there are any results, return to the API Gateway. Lambda A should call lambda B and if no results, it will call lambda C, and then return whatever the results are to the APi Gateway . So, my problem is how to chain these lambdas, because I don't want to have a huge lambda. At first, I thought

How to generate Options(CORS) with Swagger

别说谁变了你拦得住时间么 提交于 2019-12-10 04:22:55
问题 For a project we are working on we are generating an Swagger File automatically. However at this moment we are struggling with the CORS part. We are using the Amazon API gateway import api functionality. To use this in combination with Swagger and CORS, we have to create an additional action (operation) in our source code which allows CORS(options) for each api method (operation)! eg: [HttpOptions] [Route("{id}")] [ProducesResponseType((int)HttpStatusCode.OK)] public IActionResult UserOptions

Api Gateway can't invoke Lambda function

99封情书 提交于 2019-12-09 20:47:27
问题 Following this tutorial on AWS, I hit a roadblock when trying to test the api through the web console (as many others did): Thu Nov 10 22:54:48 UTC 2016 : Execution failed due to configuration error: Invalid permissions on Lambda function I've read every relevant post on SO and AWS forums I could find, but can't figure out how to grant permission to the API Gateway to invoke the Lambda function. 回答1: Web Console Method: Thanks to this mate I found a quick fix: Go into the web console and

Does API Gateway behind CloudFront not support AWS_IAM authentication?

我们两清 提交于 2019-12-09 14:38:21
问题 It seems that it is impossible to call a REST API that has AWS_IAM protection enabled through a CloudFront Distribution. Here is how to reproduce this: create a REST API with API Gateway protect a REST API method with AWS_IAM authentication create a CloudFront Distribution that targets the REST API create an A Record in Route 53 that targets the CloudFront Distribution Now use an authenticated user (I use Cognito UserPool user and aws-amplify) to call the protected REST API method with its