aws-api-gateway

How to Invoke AWS step function using API gateway?

人盡茶涼 提交于 2019-12-01 17:47:39
问题 According to Amazon's documentation, step function can be invoked using HTTP API. Step Functions can be accessed and used with the Step Functions console, the AWS SDKs, or an HTTP API. I tried to search the detailed information, but can't seem to find any good ones. Does anyone know how to invoke AWS step function using API gateway, similar to the way it invokes Lambda functions? 回答1: If you need to call StepFunction from API Gateway, it's now possible and described well in docs: https://docs

How can I send multiple Set-Cookie headers from API Gateway using a proxied Lambda

余生长醉 提交于 2019-12-01 17:13:07
I'm using API Gateway's Proxy integration to call a Lambda. The output format specification is this follow JSON format: { "statusCode": httpStatusCode, "headers": { "headerName": "headerValue", ... }, "body": "..." } In one response I wish to set two cookies (two different auth cookies) but JSON doesn't allow having two identical keys in the headers object (OK, technically the spec does but most libraries do not). RFC 7230 notes that Set-Cookie should be handled specially but I can't see how I can send multiple Set-Cookie values through API gateway. Does anyone know whether this is possible?

How to throw custom error message from API Gateway custom authorizer

纵饮孤独 提交于 2019-12-01 14:00:37
问题 Here in the blue print says, API gateway will respond with 401: Unauthorized. I wrote the same raise Exception('Unauthorized') in my lambda and was able to test it from Lambda Console. But in POSTMAN, I'm receiving status 500 with body: { message: null` } I want to add custom error messages such as "Invalid signature", "TokenExpired", etc., Any documentation or guidance would be appreciated. 回答1: This is totally possible but the docs are so bad and confusing. Here's how you do it: There is an

Trying to setup user pool authentication for API Gateway

老子叫甜甜 提交于 2019-12-01 12:57:11
I'm trying to setup security on an API using Cognito user pools. I'm getting back 401 Unauthorized. The API and User Pools are existing, and I've been using the user pool to log into an application. I'm now trying to secure the API calls. I created an authorizer on the API, Then I added the authorizer to one GET method in the API Then finally I tried to test the API in Postman. I'm using the AWS Signature authorization. Calling the method returns 401. The method functioned before with no security, and turning off the authorizer makes it work again (without security). Any ideas what step I'm

How to pass a querystring value from AWS API Gateway to a Lambda C# function

与世无争的帅哥 提交于 2019-12-01 12:19:31
I have a C# method which I have successfully published as an AWS Lambda function. It looks like this: public class MyClass { public async Task<APIGatewayProxyResponse> Test(APIGatewayProxyRequest request, ILambdaContext context) { return new APIGatewayProxyResponse { Body = "Body: " + request.Body + Environment.NewLine + "Querystring: " + (request.QueryStringParameters == null ? "null" : string.Join(",", request.QueryStringParameters.Keys)), StatusCode = 200 }; } } I have done the following to configure my API Gateway via the web interface: Created a new API Created a new Resource with name

SIM 800 GPRS modem for HTTP GET and POST to AWS IoT and AWS API gateway

爷,独闯天下 提交于 2019-12-01 11:23:18
问题 I was trying to POST and GET some JSON data to and from the AWS cloud respectively using the SIM 800 module. I'm initially trying it out directly from my PC over a terminal UART software and inputting AT commands in manually. HTTP GET is working fine over SSL ( AT+HTTPSSL=1 ) for websites like Google and Quora, as in, they return back <html> data. 1) I looked into first going through the AWS IoT route using HTTP as mentioned in the link here. But it requires not only a single certificate for

Upload Image into S3 bucket using Api Gateway, Lambda funnction

旧城冷巷雨未停 提交于 2019-12-01 11:08:23
I'm trying to upload the image (base64) from the postman, I can see when I hit the Serverless API, something has been added in S3 bucket but not image, I'm using nodejs Lambda function, I tried so many solutions but that didn't work out. Please suggest me where I'm wrong: const AWS = require('aws-sdk'); const s3 = new AWS.S3(); const moment = require('moment'); const fileType = require('file-type'); const sha1 = require('sha1'); const multipart = require('parse-multipart'); exports.handler = function (event, context, callback) { let request = event.body; // get the request let base64String =

Trying to setup user pool authentication for API Gateway

*爱你&永不变心* 提交于 2019-12-01 10:45:00
问题 I'm trying to setup security on an API using Cognito user pools. I'm getting back 401 Unauthorized. The API and User Pools are existing, and I've been using the user pool to log into an application. I'm now trying to secure the API calls. I created an authorizer on the API, Then I added the authorizer to one GET method in the API Then finally I tried to test the API in Postman. I'm using the AWS Signature authorization. Calling the method returns 401. The method functioned before with no

How to pass a querystring value from AWS API Gateway to a Lambda C# function

我们两清 提交于 2019-12-01 09:42:27
问题 I have a C# method which I have successfully published as an AWS Lambda function. It looks like this: public class MyClass { public async Task<APIGatewayProxyResponse> Test(APIGatewayProxyRequest request, ILambdaContext context) { return new APIGatewayProxyResponse { Body = "Body: " + request.Body + Environment.NewLine + "Querystring: " + (request.QueryStringParameters == null ? "null" : string.Join(",", request.QueryStringParameters.Keys)), StatusCode = 200 }; } } I have done the following

AWS Lambda C# - Accessing custom context

假装没事ソ 提交于 2019-12-01 06:47:04
I have a simple Lambda function written in .NET Core (C#) that uses the APIGatewayProxyRequest object to go through all the request properties. If I test this lambda function (from AWS Lambda), and pass it a sample event config that contains basic information: I can get this information like so: public string FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context) logger.Logger.Log($"Body: {request.Body} \n"); logger.Logger.Log($"Path: {request.Path} \n"); logger.Logger.Log($"Resource: {request.Resource} \n"); How is it that I can access custom context or authorizer values from