def lambda_handler()

in auto-model-deploy/lambda/deploy-model.py [0:0]


def lambda_handler(event, context):
    print(event)

    bucket = event['Records'][0]['s3']['bucket']['name']
    inputKey = event['Records'][0]['s3']['object']['key']

    # Read JSON
    s3 = boto3.client('s3')

    config = s3.get_object(Bucket=bucket, Key=inputKey)
    config = json.loads(config['Body'].read())
    print(config)

    # Check that JSON has appropriate fields
    if not valid_json(config):
        return False

    res = deploy_model(config)
    
    return res