The API with ID does not include a resource with path /* having an integration LAMBDA on the ANY method

12,849

There are two problems with your commands -

Incorrect

aws apigateway create-resource --rest-api-id id --parent-id id --path-part {proxy+}

Correct: Notice the double quotes

aws apigateway create-resource --rest-api-id id --parent-id id --path-part "{proxy+}"

Incorrect

aws apigateway put-integration \
    --rest-api-id id \
    --resource-id id \
    --http-method ANY \
    --type HTTP_PROXY \
    --integration-http-method ANY \
    --uri arn:aws:apigateway:us-east-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-east-2:account_id:function:helloworld/invocations 

Correct

  • type should be AWS_PROXY for Lambda Proxy Integrations.

  • integration-http-method should always be POST for Lambda Proxy integration, even if the http method is GET or ANY or anything else.

aws apigateway put-integration \
    --rest-api-id id \
    --resource-id id \
    --http-method ANY \
    --type AWS_PROXY \
    --integration-http-method POST \
    --uri arn:aws:apigateway:us-east-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-east-2:account_id:function:helloworld/invocations
Share:
12,849
Vman
Author by

Vman

Updated on June 07, 2022

Comments

  • Vman
    Vman almost 2 years

    .net core serverless web api I am trying to do proxy integration with lambda and api gateway, everything is working fine with aws console

    but i am facing issues with aws cli commands i tried integrating with cli but the lambda is not properly integrated

    aws apigateway create-resource --rest-api-id id --parent-id id --path-part {proxy+}
    
    
    aws apigateway put-method --rest-api-id id --resource-id id --http-method ANY --authorization-type "NONE" 
    
    
    aws apigateway put-integration --rest-api-id id --resource-id id --http-method ANY --type HTTP_PROXY --integration-http-method ANY --uri arn:aws:apigateway:us-east-2:lambda:path//2015-03-31/functions/arn:aws:lambda:us-east-2:account_id:function:helloworld/invocations 
    
    
    aws lambda add-permission --function-name helloworld --action lambda:InvokeFunction --principal apigateway.amazonaws.com --source-arn arn:aws:execute-api:us-east-2:account_id:apiid/*/*/* --statement-id 12345678
    
  • Vinit Khandelwal
    Vinit Khandelwal about 3 years
    Did not understand at all. Website link shared does not work either