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
WORKING
AWS CLI Versions : aws-cli/1.14.32 Python/2.7.10 Darwin/17.3.0 botocore/1.8.36