Run the script.

def lambda_handler(event, context):
    """Run the script."""
    body = event.get('body', dict())
    events = body.get('events', list())
    source_ip = str(event.get('source_ip', ''))
    if len(events) == 0:
        return {'success': False, 'message': "No events sent in"}
    status = process_events(events, source_ip)
    msg = "Wrote {} events to the cloud".format(len(events))
    return {'success': True, 'message': msg}