Integrate Teradata Jupyter extensions with SageMaker notebook instance

Author: Hailing Jiang
Last updated: September 27th, 2022


Teradata Jupyter extensions provide Teradata SQL kernel and several UI extensions to allow users to easily access and navigate Teradata database from Jupyter envioronment. This article describes how to integate our Jupyter extensions with SageMaker notebook instance.


  • Access to a Teradata Vantage instance

    If you need a new instance of Vantage, you can install a free version called Vantage Express in the cloud on Google Cloud, Azure, and AWS. You can also run Vantage Express on your local machine using VMware, VirtualBox, or UTM.
  • AWS account

  • AWS S3 bucket to store lifecycle configuration scripts and Teradata Jupyter extension package


SageMaker supports customization of notebook instances using lifecycle configuration scripts. Below we will demo how to use lifecycle configuration scripts to install our Jupyter kernel and extensions in a notebook instance.

Steps to integrate with notebook instance

  1. Download Teradata Jupyter extensions package

    Download Linux version from and upload it to an S3 bucket. This zipped package contains Teradata Jupyter kernel and extensions. Each extension has 2 files, the one with "_prebuilt" in the name is prebuilt extension which can be installed using PIP, the other one is source extension that needs to be installed using "jupyter labextension". It is recommended to use prebuilt extensions.

  2. Create a lifecycle configuration for notebook instance

    create a lifecycle configuration for notebook instance

    Here are sample scripts that fetches the Teradata package from S3 bucket and installs Jupyter kernel and extensions. Note that creates a custom conda env that persists on notebook instance’s EBS volume so that the installation will not get lost after notebook restarts. installs Teradata kernel and extensions to the custom conda env.

    set -e
    # This script installs a custom, persistent installation of conda on the Notebook Instance's EBS volume, and ensures
    # that these custom environments are available as kernels in Jupyter.
    sudo -u ec2-user -i <<'EOF'
    unset SUDO_UID
    # Install a separate conda installation via Miniconda
    mkdir -p "$WORKING_DIR"
    wget -O "$WORKING_DIR/"
    bash "$WORKING_DIR/" -b -u -p "$WORKING_DIR/miniconda"
    rm -rf "$WORKING_DIR/"
    # Create a custom conda environment
    source "$WORKING_DIR/miniconda/bin/activate"
    conda create --yes --name "$KERNEL_NAME" python="$PYTHON"
    conda activate "$KERNEL_NAME"
    pip install --quiet ipykernel

    set -e
    # This script installs Teradata Jupyter kernel and extensions.
    sudo -u ec2-user -i <<'EOF'
    unset SUDO_UID
    source "$WORKING_DIR/miniconda/bin/activate" teradatasql
    # fetch Teradata Jupyter extensions package from S3 and unzip it
    mkdir -p "$WORKING_DIR/teradata"
    aws s3 cp s3://sagemaker-teradata-bucket/ "$WORKING_DIR/teradata"
    cd "$WORKING_DIR/teradata"
    unzip -o
    # install Teradata kernel
    cp teradatakernel /home/ec2-user/anaconda3/condabin
    jupyter kernelspec install --user ./teradatasql
    # install Teradata Jupyter extensions
    source /home/ec2-user/anaconda3/bin/activate JupyterSystemEnv
    pip install teradata_connection_manager_prebuilt-3.3.0.tar.gz
    pip install teradata_database_explorer_prebuilt-3.3.0.tar.gz
    pip install teradata_preferences_prebuilt-3.3.0.tar.gz
    pip install teradata_resultset_renderer_prebuilt-3.3.0.tar.gz
    pip install teradata_sqlhighlighter_prebuilt-3.3.0.tar.gz
    conda deactivate
  3. Create a notebook instance. Please select 'Amazon Linux 2, Jupyter Lab3' for Platform identifier and select the lifecycle configuration created in step 2 for Lifecycle configuration.

    Create notebook instance

    You might also need to add vpc, subnet and security group in 'Network' section to gain access to Teradata databases.

  4. Wait until notebook instance Status turns 'InService', click 'Open JupyterLab' to open the notebook.

    Open notebook

Access the demo notebooks to get usage tips

+ access demo notebooks

Did this page help?