1

for reference you can visit this aws issue i've created:

https://github.com/aws/aws-cli/issues/3118


  • I use this AWS CLI commands below but it is inside to *.sh file
  • no problem with the script it successfully run NOTE: i manually create API ```

    remove GET method

    aws apigateway delete-method \ --rest-api-id 2132132 \ --resource-id 8998989 \ --http-method GET \

    /dev/null 2>&1 && echo '-> [aws] APIGateway GET method removed'

    remove permission first

    aws lambda remove-permission \ --function-name function_main \ --statement-id function_main \

    /dev/null 2>&1 && echo '-> [aws] APIGateway permission removed'

    and then add method

    aws apigateway put-method \ --rest-api-id 2132132 \ --resource-id 8998989 \ --http-method GET \ --authorization-type 'NONE' \ --region us-east-1 \

    /dev/null 2>&1 && echo '-> [aws] APIGateway GET method created'

    and add integration.

    aws apigateway put-integration \ --region us-east-1 \ --rest-api-id 2132132 \ --resource-id 8998989 \ --http-method GET \ --type AWS_PROXY \ --integration-http-method GET \ --passthrough-behavior WHEN_NO_MATCH \ --uri "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:23645667:function:function_main/invocations" \

    /dev/null 2>&1 && echo '-> [aws] APIGateway integration added'

    and add method response

    aws apigateway put-method-response \ --rest-api-id 2132132 \ --resource-id 8998989 \ --http-method GET \ --status-code 200 \ --response-models "{\"application/json\": \"Empty\"}" \

    /dev/null 2>&1 && echo '-> [aws] APIGateway GET method response created'

    and then add

    aws lambda add-permission \ --function-name function_main \ --statement-id 4454854604c23688a9f42907de4d18ec \ --action "lambda:InvokeFunction" \ --principal apigateway.amazonaws.com \ --source-arn "arn:aws:execute-api:us-east-1:23645667:2132132/*/GET/" \

    /dev/null 2>&1 && echo '-> [aws] APIGateway permission added' ```

  • but the output is this, in method response I can't see HTTP STATUS: Proxy or just 'Select an Integration response' unlike when i manually add method and integration there is (please see below image difference)

  • ERROR api_gateway

  • WORKING api_gateway

AWS CLI Versions : aws-cli/1.14.32 Python/2.7.10 Darwin/17.3.0 botocore/1.8.36

XanderDwyl
  • 69
  • 1
  • 9
  • I'm also trying the same with cloudformation how can i do that. Any Idea? Here is the methode defination . – Narendra Aug 20 '19 at 17:31

1 Answers1

0

i just want to share answer from github.com/issues by https://github.com/kyleknap

> @XanderDwyl I think you need to include an apigateway put-integration-response command in your shell script even if you are doing a proxy integration. We had to do something similar in old version of chalice. I would recommend checking out some of the source code. It is Python, but the parameters and values map directly back to CLI commands and parameters. So it should be straightforward to figure out what may be missing. Let us know if that helps.

XanderDwyl
  • 69
  • 1
  • 9