Package, create and deploy to Lambda.

def deploy(environment, zappa_settings):
    """ Package, create and deploy to Lambda."""
    print(("Deploying " + environment))

    zappa, settings, lambda_name, zip_path = \
        _package(environment, zappa_settings)

    s3_bucket_name = settings['s3_bucket']

    try:
        # Load your AWS credentials from ~/.aws/credentials
        zappa.load_credentials()

        # Make sure the necessary IAM execution roles are available
        zappa.create_iam_roles()

        # Upload it to S3
        zip_arn = zappa.upload_to_s3(zip_path, s3_bucket_name)

        # Register the Lambda function with that zip as the source
        # You'll also need to define the path to your lambda_handler code.
        lambda_arn = zappa.create_lambda_function(bucket=s3_bucket_name,
                                                  s3_key=zip_path,
                                                  function_name=lambda_name,
                                                  handler='handler.lambda_handler',
                                                  vpc_config=settings['vpc_config'],
                                                  memory_size=settings['memory_size'])

        # Create and configure the API Gateway
        api_id = zappa.create_api_gateway_routes(lambda_arn, lambda_name)

        # Deploy the API!
        endpoint_url = zappa.deploy_api_gateway(api_id, environment)

        # Remove the uploaded zip from S3, because it is now registered..
        zappa.remove_from_s3(zip_path, s3_bucket_name)

        if settings['touch']:
            requests.get(endpoint_url)
    finally:
        try:
            # Finally, delete the local copy our zip package
            if settings['delete_zip']:
                os.remove(zip_path)
        except:
            print("WARNING: Manual cleanup of the zip might be needed.")

    print(("Your Zappa deployment is live!: " + endpoint_url))