Updating Licenses

If your current Driverless AI license has expired, you will be required to update it in order to continue running Driverless AI, in order to run the scoring pipeline, in order to access deployed pipelines to AWS Lambdas, etc.

Updating the License for Driverless AI

Similar to adding a license for the first time, you can update your license for running Driverless AI either by replacing your current license.sig file or via the Web UI.

Updating the license.sig File

Update the license key in your /opt/h2oai/dai/home/.driverlessai/license.sig file by replacing the existing license with your new one.

Updating the License in the Web UI

If your license is expired, the Web UI will prompt you to enter a new one. The steps are the same as adding a license for the first time via the Driverless AI Web UI.

Updating the License for Scoring Pipelines

For the Python Scoring Pipeline, include the updated license file when setting the environment variable in Python. Refer to the above Python Scoring Pipeline section for adding licenses.

For the MOJO Scoring Pipeline, the updated license file can be specifed using an environment variable, using a system property of JVM, or via an application classpath. This is the same as adding a license for the first time. Refer to the above MOJO Scoring Pipeline section for adding licenses.

Updating Driverless AI Licenses on AWS Lambda

Users can manually update each of their Driverless AI licenses deployed in production on AWS Lambda. For users with many MOJOs in production, though, H2O provides a script that will update Driverless AI licenses for all of your MOJOs currently deployed on AWS Lambda.

Manual Update

The Driverless AI deployment pipeline to AWS Lambdas explicitly sets the license key as an environment variable. Replace the expired license key with your updated one.

Update license key in production

Automatic Update

H2O provides a script that can be used to update Driverless AI licenses for all of your MOJOs deployed on a specific AWS Lambda region. This script can be run for any machine.


  • New Driverless AI license

  • The following Python packages are required for this script:

    • boto3

    • argparse

    • os

Update Steps

Perform the following steps to update your Driverless AI license for MOJOs on AWS Lambda.

  1. Copy the following code and save it as update_lambda.py.

import boto3
import argparse
import os

def load_license(license_path):
    with open(license_path, 'r') as license_file:
        license_key = license_file.read()  
        return license_key

def update_function(client, license_key, function_names): 

    for name in function_names: 
        config = client.get_function_configuration(FunctionName=name)   
        config['Environment']['Variables']['DRIVERLESS_AI_LICENSE_KEY'] = license_key    

        response = client.update_function_configuration(
                    FunctionName= name,
                    Environment= config['Environment']
        print("{} License Key updated successfully! ".format(name))

def list_functions(client):
    """Get the list of potential DAI lambda function names"""
    dai_functions = []
    response = client.list_functions()
    while True:
        for f in response['Functions']:
            if 'h2oai' not in f['FunctionName']:
        if 'NextMarker' in response:
            marker = response['NextMarker']
            response = client.list_functions(Marker=marker)

    return dai_functions

def main():
    parser = argparse.ArgumentParser()    
    parser.add_argument("--list", action='store_true', required=False, help="List all DAI lambda functions on the selected region. ")
    parser.add_argument("--update_all", action='store_true', required=False, help="Update all DAI Lambda functions on the selected region. ")
    parser.add_argument("--region", type=str, required=True, help="Region where the lambda function is deployed.")
    parser.add_argument("--name", type=str, required=False, help="The name of the Lambda function. ")    
    parser.add_argument("--license_path", type=str, required=False, help="Location of the license.sig file")
    parser.add_argument("--aws_access_key_id", type=str, required=False, help="AWS Credentials")
    parser.add_argument("--aws_secret_access_key", type=str, required=False, help="AWS Credentials")    
    args = parser.parse_args()
    if None not in (args.aws_access_key_id, args.aws_secret_access_key):
        os.environ['aws_access_key_id'] = args.aws_access_key_id
        os.environ['aws_secret_access_key'] = args.aws_secret_access_key
    client = boto3.client('lambda', region_name=args.region)

    if args.update_all or args.list: 
        dai_functions = list_functions(client)
        print("H2O Driverless AI Lambda Functions in {}: {}".format(args.region, dai_functions))

    _functions = []
    if args.update_all:     
        _functions = dai_functions
    elif args.name is not None: 
        print("Please set a name of a function to update") 

    if args.license_path is not None:
        license_key = load_license(args.license_path)
    elif "DRIVERLESS_AI_LICENSE_FILE" in os.environ:
        license_key = load_license(os.environ['DRIVERLESS_AI_LICENSE_FILE'])
    elif "DRIVERLESS_AI_LICENSE_KEY" in os.environ:
        license_key = os.environ['DRIVERLESS_AI_LICENSE_KEY']
        print("No License Found")
        return 0

    update_function(client, license_key, _functions)

if __name__ == '__main__':
  1. To run the script, you will need to provide the following:

  • The region where the MOJOs have been deployed. Note that this script must be run for each region that includes deployed MOJOs.

  • The Lambda function name

  • The Driverless AI license path

  • You AWS secret key ID

  • Your AWS secret access key

# run the upgrade script
python update_lambda.py --update_all --region [deployed_region] --name [Lambda_function_name] --license_path [path_to_license_file] --aws_access_key_id [AWS_ACCESS_KEY_ID] --aws_secret_access_key [AWS_SECRET_ACCESS_KEY]

# optionally view the help using either python or python3
python update_lambda.py --help