def create_lambda_function_zip()

in social-media/create-lambda-function.py [0:0]


def create_lambda_function_zip():
    with open('index.js.template') as lambda_function_template:
        lf_string = lambda_function_template.read().format(**config.AWS)
        with open('index.js', 'w') as lambda_function_file:
            lambda_function_file.write(lf_string)

    zip_file_name = 'lambda.zip'

    with ZipFile(zip_file_name, 'w') as lambda_zip:
        lambda_zip.write('index.js')
        for root, dirs, files in os.walk('node_modules'):
            for file in files:
                lambda_zip.write(os.path.join(root, file))

    return zip_file_name