How do I determine the path or action for my Lambda when setting up AWS API Gateway through the CLI?

Viewed 2292

I have a lambda function (Java) deployed in AWS Lambda.

I have set up an API Gateway resource and method through the UI console at API Gateway.

I am trying to set up the API Gateway through the command line, with something like

aws apigateway put-integration --rest-api-id <rest-api-id> \
  --resource-id <resource-id> \
  --http-method GET \
  --type AWS \
  --integration-http-method POST \
  --uri <lambda-arn> \
  --request-templates file://mapping.json

Note, <lambda-arn> is the ARN of the Lambda.

I get an error of the form

An error occurred (BadRequestException) when calling the PutIntegration operation: 
AWS ARN for integration must contain path or action

What is the path or action I need to provide?

1 Answers

It looks like the path should be of the form

arn:aws:apigateway:<region>:lambda:path/2015-03-31/functions/<lambda-arn>/invocations 

But why this should be the case is an absolute mystery to me.

The documentation here clearly states

The uri parameter is the ARN of the function-invoking action.

And whose birthday is it on 31 March 2015?

Related