Create api-gateway lambda integration using aws-cli


I need to create an api gateway using aws client. I successfully create and integrate with my aws-lambda function using web console. But I am confused with aws-client. These are the steps I followed.

  1. Create api gateway and integrate with my sample lambda function using web console.

enter image description here

  1. Deploy created api and export as json file.
  2. Create new api gateway using exported json file using aws-cli. Command like this.

But it created only resources & methods.

  1. For integrate api method with my lambda function, I execute command like this

    But it produces error message like this

An error occurred (NotFoundException) when calling the PutIntegration operation: Invalid Resource identifier specified

Is it possible to integrate api gateway method with existing lambda function using aws client? What is Resource identifier?


you can run aws apigateway get-resources to get the resource-id

It will return a JSon like

you can take the id from this JSon and use it on your command for aws apigateway put-integration

Leave a Reply