I am trying to see how to access the request header and body values from with in the lambda code. If the request body is in JSON format, it automatically seems to be parsed and
You have to get the information you need in the template mapping and send them back your Lambda function, this is one of the template I used to send information to the Lambda function:
{
"params" : "$input.params()",
"content-type-value" : "$input.params().header.get('Content-Type')",
"body" : "$input.json('$')",
"request-id": "$context.requestId",
"method": "$context.httpMethod",
"resource": "$context.resourcePath",
"id": "$input.params('id')" //This is a path parameter in my case
}
You can do the same, or you can access params.path.id
(again in my case). Here is the link to the documentation.
Cheers,