aws-api-gateway

Mapping Lambda output to API Gateway header

孤者浪人 提交于 2019-12-03 04:21:03
问题 I'm trying to map the JSON output from a Lambda function to the header of an API Gateway call. As an example here, we can consider a redirect scenario. So I'd like to add a Location header to the response from my API Gateway call. JSON output from Lambda function: { Location: 'http://google.com' } In "Method Response"->"Response Headers" I can add the Location header to the desired HTTP status code. Then in "Integration Response"->"Header Mappings" I can add the mapping for the Location

How to invoke an AWS Step Function using API Gateway

一曲冷凌霜 提交于 2019-12-03 04:03:39
How do I invoke an AWS Step Function using an API Gateway POST request, and the request's JSON payload to the Step Function ? 1. Create your step function Quite obvious. I guess that if you're reading this you know how to do it. Otherwise, you can go have a look at the documentation here: What is AWS Step Functions? . 2. Create the IAM Role for your API It can be for either all Step Functions, or only this one. We'll only cover the first case, as explained in an Amazon tutorial: Creating an API Using API Gateway . To create the IAM role Log in to the AWS Identity and Access Management console.

Posting from AWS-API Gateway to Lambda

五迷三道 提交于 2019-12-03 02:55:01
I have a simple C# Aws Lambda function which succeeds to a test from the Lambda console test but fails with a 502 (Bad Gateway) if called from the API Gateway (which i generated from the Lambda trigger option) and also if I use postman.(this initial function has open access (no security)) // request header Content-Type: application/json // request body { "userid":22, "files":["File1","File2","File3","File4"] } The error I get in the logs is: Wed Feb 08 14:14:54 UTC 2017 : Endpoint response body before transformations: { "errorType": "NullReferenceException", "errorMessage": "Object reference

How to add a custom domain for a serverless-1.0.0 framework defined/deployed API?

a 夏天 提交于 2019-12-03 02:46:34
问题 Serverless-1.0.0-rc.1 enables to deploy an API to be accessible via a AWS API Gateway. The question: I need the deployed API exposed via a custom domain with SSL certificate instead of the randomly assigned one (URL https://qwertylgbtqert.execute-api.... )? Can that be done from within serverless.yml or serverless framework? Here is my simple service serverless.yml definition: service: my-service provider: name: aws runtime: nodejs4.3 functions: generate: handler: handler.generate events: -

Missing Authentication Token while accessing API Gateway?

£可爱£侵袭症+ 提交于 2019-12-03 02:03:08
I am trying to call a Lambda Function through AWS API Gateway. When I mention Authentication type NONE it works fine but API become public and anyone with url can access my API. To make API call secure, I am using Authentication type AWS_IAM and also attached AmazonAPIGatewayInvokeFullAccess policy to my user but getting this error: { message: "Missing Authentication Token"} I don't know what I am missing here. I think you are directly trying to access API link, this won't work because API is secured using IAM role and you must provide AWS authentication i.e Access key and Secret key. Use the

AWS API Gateway: How to pass IAM identity to Lambda function?

那年仲夏 提交于 2019-12-02 23:12:35
I've successfully configured IAM-authenticated access to my Lambda function with AWS API Gateway front-end, but unable to find how to pass IAM user identity to my Lambda function. I need exactly IAM user identity and can not run Lambda function under calling IAM-user credentials. All I need - is to get calling IAM-user identity in my Lambda function. Is there option for that? Support for accessing identity and other information from the Amazon API Gateway request context hadn't been available when you posted the question, but recently been added, see Announcement: Context Variables : You can

AWS API Gateway: limit requests from a single IP

纵然是瞬间 提交于 2019-12-02 22:29:46
Does AWS API Gateway allows limiting a number of requests from a single IP? I'm building a public API and would like to prevent it from being abused by establishing a limit on a number of times the API can be called from a single IP address (like 100 requests per minute). Thanks, AWS API Gateway does not offer the functionality that you are looking for but there is a workaround. What you can do is Integrate AWS API gateway with AWS Cloud Front and use AWS Web Application Firewall Rules to limit the API call from a Specific IP address. Check this Guide for implementing the WAF. http://docs.aws

AWS Cloudfront (with WAF) + API Gateway: how to force access through Cloudfront?

落爺英雄遲暮 提交于 2019-12-02 22:08:10
I want to put WAF in front of API Gateway, and with the (little) info I find that is only possible by manually putting an extra Cloudfront distribution with WAF enabled, in front of APIG. It's a bit of a shame, especially since APIG now supports custom domains natively, but it should work. Now to make the solution secure rather than just obscure, I want to enforce that the APIs can only be accessed through the Cloudfront distro. What is the best option to do this? I was hoping to be able to use the 'Origin Access Identities' similar as for S3, but don't see how to do that. If I could assign an

Regional API Gateway with CloudFront

我们两清 提交于 2019-12-02 21:22:06
Amazon released new feature - to support regional api endpoints Does it mean I can deploy my same API code in two regions which sends request to Lambda micro-services? (It will be two different Https endpoints) And have CloudFront distribute the traffic for me? Any code snippets? Does it mean I can deploy my same API code in two regions which sends request to Lambda micro-services? (It will be two different Https endpoints) This was already possible. You can already deploy the same API code in multiple regions and create different HTTPS endpoints using API Gateway. What you couldn't do, before

AWS API Gateway error: API Gateway does not have permission to assume the provided role as S3 proxy

▼魔方 西西 提交于 2019-12-02 19:10:44
There are similar questions but they have answers that I have tried. I'm not sure what I could be doing wrong but any help would appreciated. Test details: The Error from a method-execution test; PUT request: Execution log for request test-request Mon Oct 16 10:13:47 UTC 2017 : Starting execution for request: test-invoke-request Mon Oct 16 10:13:47 UTC 2017 : HTTP Method: PUT, Resource Path: /pop-data-xmlz/test.xml Mon Oct 16 10:13:47 UTC 2017 : Method request path: {item=test.xml, folder=pop-data-xmlz} Mon Oct 16 10:13:47 UTC 2017 : Method request query string: {} Mon Oct 16 10:13:47 UTC 2017