Template that will create the following:
- API Gateway:
- Deployed as a
REGIONAL
endpoint. - Single root method, accepting
POST
requests only, with Lambda proxy integration to a target function.
- Deployed as a
- In-line Python Lambda function echoing back requesting users IP address to API Gateway requests:
- IAM role for Lambda allowing CloudWatch logs access.
- Permissions for Lambda that allow API Gateway endpoint to successfully invoke function.
- CloudWatch logs group for Lambda, with 90 day log retention.
After standing up the template, you will be able to make a HTTP POST
request to the URL listed as the apiGatewayInvokeURL
output value.
$ curl --request POST https://APIGW_ID.execute-api.AWS_REGION.amazonaws.com/call
# Hello there 127.0.0.1
- https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-set-up-lambda-proxy-integration-on-proxy-resource.
- https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-as-simple-proxy-for-lambda.html#api-gateway-proxy-integration-lambda-function-python.
- https://docs.aws.amazon.com/apigateway/api-reference/resource/integration/.
- https://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html.
- https://docs.aws.amazon.com/lambda/latest/dg/services-apigateway.html#apigateway-permissions.
- https://cjohansen.no/aws-apigw-proxy-cloudformation/.
- https://stackoverflow.com/a/39772260.