Im trying to, as the title dictates, create a resource with a method that triggers a lambda function with boto3 python library.
Im doing the following.
First, I create the resource
new_endpoint_response = aws_apigateway.create_resource(
restApiId = 'xxxxxxxx',
parentId = 'xxxxxxxx',
pathPart = event['Configure']
)
Then, the post method
put_method_response = aws_apigateway.put_method(
restApiId = 'xxxxxxxxxxx',
resourceId = new_endpoint_response['id'],
httpMethod = 'POST',
authorizationType = 'NONE'
)
And finally, assingn a lambda function to that method with
aws_apigateway.put_integration(
restApiId = 'xxxxxxxxxx',
resourceId = new_endpoint_response['id'],
httpMethod = 'POST',
integrationHttpMethod = 'POST',
type = 'AWS',
uri = 'LAMBDA ARN'
)
Here is where I'm having some issues. When I try to do the last step, I always get
An error occurred (BadRequestException) when calling the PutIntegration operation: AWS ARN for integration must contain path or action
And I have no idea why that is. From what I have searched, the uri required is in fact the api invocation url, problem is I have no idea what that means or how to obtain it. The example shown is the following.
arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${LambdaFunctionAPI.Arn}/invocations
How can I make it so that invocation URL invokes the lambda function I want and how do I even get that invocation url?