Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Api Gateway: AWS Subdomain for Lambda Integration

I'm attempting to integrate my lambda function, which must run async because it takes too long, with API gateway. I believe I must, instead of choosing the "Lambda" integration type, choose "AWS Service" and specify Lambda. (e.g. this and this seem to imply that.)

However, I get the message "AWS ARN for integration must contain path or action" when I attempt to set the AWS Subdomain to the ARN of my Lambda function. If I set the subdomain to just the name of my Lambda function, when attempting to deploy I get "AWS ARN for integration contains invalid path".

What is the proper AWS Subdomain for this type of integration?

Note that I could also take the advice of this post and set up a Kinesis stream, but that seems excessive for my simple use case. If that's the proper way to resolve my problem, happy to try that.

Edit: Included screen shot

Screenshot of my AWS API Gateway Integration Request Page

Edit: Please see comment below for an incomplete resolution.

like image 705
Robert Balicki Avatar asked Dec 24 '22 23:12

Robert Balicki


1 Answers

So it's pretty annoying to set up, but here are two ways:

  1. Set up a regular Lambda integration and then add the InvocationType header described here http://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html. The value should be 'Event'.

    • This is annoying because the console won't let you add headers when you have a Lambda function as the Integration type. You'll have to use the SDK or the CLI, or use Swagger where you can add the header easily.
  2. Set the whole thing up as an AWS integration in the console (this is what you're doing in the question), just so you can set the InvocationType header in the console

    • Leave subdomain blank
    • "Use path override" and set it to /2015-03-31/functions/<FunctionARN>/invocations where <FunctionARN> is the full ARN of your lambda function
    • HTTP method is POST
    • Add a static header X-Amz-Invocation-Type with value 'Event'

http://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html

like image 193
jackko Avatar answered Jan 04 '23 16:01

jackko