Una función lambda de AWS tiene un "evento" y un "contexto" como en los parámetros. El "evento" es un objeto json.
Intento conectar una API (administrador a través de AWS API Gateway) a mi función lambda, enviando el json del evento como el cuerpo de una http POST. Esto falla miserablemente, y solo tengo alguna indicación de que podría haber un evento vacío enviado a la función lambda.
¿Cómo debo enviar el "evento" a través de la API?
Este es el código de mi función lambda:
from __future__ import print_function
import boto3
import json
import time
print('Loading function')
def lambda_handler(event, context):
    print("Received event: ")
    print(type(event))
    print(""+json.dumps(event, indent=2))
    id = event['Id']
    dynamo = boto3.resource('dynamodb').Table('Table1')
    dynamo.put_item( 
        Item = {
        'Button' : int(id),
        'Time' : int(time.time()),
    })
    return {
        'statusCode' : '400',
        'body' : null,
        'headers' : { 'Content-Type': 'application/json', },
    }
Al ejecutar una prueba en la función lambda se obtiene el siguiente registro:
START RequestId: x Version: $LATEST
Received event: 
<type 'dict'>
{
  "Id": "1"
}
END RequestId: x
y la respuesta
{
   "body": null,
   "headers": {
     "Content-Type": "application/json"
  },
  "statusCode": "400"
}
pero ejecutarlo a través de la función de prueba API Gateway da
Tue May 16 15:54:27 UTC 2017 : Endpoint response body before transformations: 
  {"stackTrace": [["/var/task/lambda_function.py", 12, "lambda_handler", 
   "id = event['Id']"]], "errorType": "KeyError", "errorMessage": "'Id'"}
Tue May 16 15:54:27 UTC 2017 : Endpoint response headers: 
  {x-amzn-Remapped-Content-Length=0, x-amzn-RequestId=x, 
   Connection=keep-alive, Content-Length=153,
   X-Amz-Function-Error=Unhandled, Date=Tue, 16 May 2017 15:54:27 GMT, 
   X-Amzn-Trace-Id=root=x;sampled=0, Content-Type=application/json}
Tue May 16 15:54:27 UTC 2017 : Execution failed due to configuration 
   error: Malformed Lambda proxy response
Tue May 16 15:54:27 UTC 2017 : Method completed with status: 502

Respuestas:
Después de investigar un poco más, descubrí que puede ocurrir un error 502 si el cuerpo no está entre comillas.
Tu nulo debería ser
/programming/43708017/aws-lambda-api-gateway-error-malformed-lambda-proxy-response
fuente