Create lambda-avi gateway integration with aws-cli

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

  • create an api gateway and integrate with my lambda pattern function using the web console.

enter image description here

  1. Expand the generated api and export the json file.
  2. Create a new api gateway using the exported json file using aws-cli. a team like this.

    aws apigateway import-rest-api --body file://tmpfile.json --region us-east-1;
    

But he created only resources and methods.

  1. to integrate api method with my lambda function. I execute the command as follows

    aws apigateway put-integration --rest-api-id 42ku123id8u3a --resource-id core-api-dev --http-method DELETE --type AWS --integration-http-method POST --uri 'arn:aws:lambda:us-east-1:my-lambda-function-arn' --region us-east-1
    

    But it creates an error message like this

An error occurred while invoking the PutIntegration operation (NotFoundException): The specified resource identifier is invalid

api gateway - aws-? ?

+4
2

aws apigateway get-resources, resource-id

aws apigateway get-resources --rest-api-id 42ku123id8u3a --region us-east-1

JSon,

{
    "items": [
        {
            "path": "/resource/xxx",
            "resourceMethods": {
                "POST": {}
            },
            "id": "_yourresourceid_",
            "pathPart": "xxx",
            "parentId": "ai5b02"
        }
    ]
}

JSon aws apigateway put-integration

+1

JSON 2 . , . , , .

+1

Source: https://habr.com/ru/post/1656333/


All Articles