unSkript Documentation
Free SandboxBlogGitHubSlack Community
  • What is unSkript?
  • Guides
    • Contribute to Open Source
    • Getting started
      • Sign Up/Install
      • Authentication
        • Okta configuration
          • Okta Groups Sync
      • Create a Proxy
      • Add Credentials to Connect your Resources
      • Key Terms
  • RunBooks
    • Prebuilt xRunBooks
      • xRunBooks for CloudOps
      • xRunBooks for Cost Optimization
      • xRunBooks for DevOps
      • xRunBooks for IAM
      • xRunBooks for SecOps
      • xRunBooks for SRE
      • xRunBooks for Troubleshooting
    • Creating RunBooks
      • Importing unSkript xRunBooks
      • Create a xRunBook
      • Add an Action
      • Connecting Actions
      • Create a RunBook Input Parameter
      • Create a Credential
      • Writing Notes
      • Running XRunBooks
        • Running RunBooks with Approvals
      • Schedules
      • xRunBook Executions
      • Alarms
        • Create an Alarm Webhook
          • Webhooks for onprem installations
        • Create a Grafana Alert
        • Attaching runbooks to alarms
      • Folders
      • RunBook Outputs
  • Actions
    • What is an Action?
    • Create Custom Actions
    • Create Actions with AI
    • Actions
      • Action Configuration
        • Configure Action Inputs
        • Add Action Inputs
        • Action Output
        • Action Iterator
          • Using Iterators
        • Action Poll
        • Action Start Condition
      • Anatomy of an Action
    • Prebuilt Actions
  • Healthchecks
    • What is a HealthCheck?
    • Create a HealthCheck
      • Create a HealthCheck Folder
      • Adding Checks
    • HealthCheck Parameters
    • Running HealthChecks
    • HealthCheck Remediation
  • Workflows
    • What is a Workflow?
  • Connnecting
    • Connectors
      • Airflow
        • Airflow Actions
      • AWS
        • AWS Actions
          • AWS Cloudwatch Actions
          • AWS EC2 Actions
          • AWS ECS Actions
          • AWS EKS Actions
          • AWS ELB Actions
          • AWS IAM Actions
          • AWS Postgres Actions
          • AWS RDS Actions
          • AWS RedShift Actions
          • AWS S3 Actions
          • AWS VPC Actions
      • Azure
        • Azure Actions
      • ChatGPT
        • ChatGPT Actions
      • Datadog
        • Configuring webhook in Datadog
        • Datadog Actions
          • Datadog Alert Actions
          • Datadog Metrics Actions
          • Datadog Monitor Actions
      • Elasticsearch
        • Elasticsearch Actions
      • GCP
        • GCP Actions
          • GCP Bucket Actions
          • GCP GKE Actions
          • GCP IAM Actions
          • GCP VM Actions
      • Github
        • Github Actions
      • Grafana
        • Grafana Actions
      • Hadoop
        • Hadoop Actions
      • Jenkins
        • Jenkins Actions
      • Jira
        • Jira Actions
      • Kafka
        • Kafka Actions
      • Kubernetes
        • K8s Actions
      • MongoDB
        • MongoDB Actions
      • MS SQL
        • MSSQL Actions
      • MySQL
        • MySQL Actions
      • Netbox
        • Netbox Actions
      • Nomad
        • Nomad Actions
      • OpenSearch
        • opensearch Actions
      • Pingdom
        • Pingdom Actions
      • Postgres
        • Postgres Actions
      • Prometheus
        • Prometheus Actions
      • Redis
        • Redis Actions
      • REST
        • REST Actions
      • SalesForce
        • SalesForce Actions
      • Slack
        • Slack Actions
      • Snowflake
        • Snowflake Actions
      • Splunk
        • Splunk Actions
      • SSH
        • SSH Actions
      • Stripe
        • Stripe Actions
      • Terraform
        • Terraform Actions
      • Zabbix
    • Proxies
      • Environment
        • RunBooks Across Environments: ServiceIDs
      • unSkript Proxy
      • AWS Proxy
      • GCP Proxy
    • Secret store
      • Vault
  • Tooling
    • Role Based Access Control
      • RBAC Roles
    • API reference
      • Authentication
      • Endpoints
        • Executions
        • RunBooks
        • Schedules
    • Command Line Tool
    • Notifications
  • Fundamentals
    • Jupyter Notebook 101
  • Use Cases
    • DevOps
    • SRE
  • Open source
    • Runbooks.sh
    • Contribute to Open Source
  • Lists
    • AWS Service Quota list
Powered by GitBook
On this page
  • What are Jupyter Notebooks?
  • How does a Jupyter Notebook work?
  • Building on previous cells
  • Why use Jupyter Notebooks for runbook automation?
  • Crash Course with Jupyter Notebook
  • unSkript and Jupyter Notebooks
  • Resources

Was this helpful?

  1. Fundamentals

Jupyter Notebook 101

An introduction to Jupyter Notebooks

PreviousNotificationsNextDevOps

Last updated 1 year ago

Was this helpful?

What are Jupyter Notebooks?

A Jupyter Notebook is a document that helps with creating and sharing computational documents. Just like Google Docs are an online version of Microsoft Word, Jupyter Notebooks are documents that can execute code online. Notebooks have the file extension .ipynb (Interactive PYthon NOtebook), and each cell of code is executed in a REPL (Read-Eval-Print-Loop) fashion.

What is REPL? Read-Eval-Print-Loop is an interactive programming environment.

  1. Read in: The user creates some code and sends it to be processed.

  2. Eval: The code is evaluated.

  3. Print: The results are printed out for the user.

  4. Loop. The ability to repeat steps 1-3 as an iterative method.

is an open source project. Many organizations and universities use it for data science, data discovery, and visualization workflows, and it is the most popular data science interface for code execution.

Accessed via a browser, it is has a kernel (in the video below it is Python) and has a UI to access the file system:

How does a Jupyter Notebook work?

Jupyter Notebooks are built on the IPython kernel, famous for its REPL (Read-Eval-Print-Loop) capabilities. REPL interfaces take user inputs, execute the code, and presents the result to the user. This feedback loop can be repeated multiple times in each Notebook. IPython is a command line terminal through which we can interactively execute python commands.

Jupyter Notebooks contain cells that contain atomic commands. Each cell can be executed to get the result from a programming environment. For example, a cell might make a request to an API from a third-party system, and then return the result.

In addition to code cells, you can add text content (in Markdown format!)

When the Markdown cell is Run - it will display the text inside the Notebook:

Building on previous cells

Variables created in a cell are stored in the notebook kernel, and are available for use in subsequent cells:

Cells in the notebook build on the results of previously run cells. One way to think of a cell is as a microservice. The microservices are called in order, and complete a full application when the Notebook is completed.

In the video below, we access a JSON file for an API key, and then make an API call for weather data:

Once we have collected the API data, we can load it into a dataframe and visualize the data.

Why use Jupyter Notebooks for runbook automation?

DevOps/SRE groups create Runbooks to automate their workflows. Runbooks are comprised of steps that must be completed in order to complete a task. Many of these steps are accompanied by scripts that help in completeing the step. By placing the Runbook inside a Notebook container - the code can actually be evaluated while the Runbook is being used!

By applying the Jupyter Notebook concept to automate the infrastructure workflows simplifies the task of a DevOps/SRE. It also aids in decoupling and debugging various systems quickly.

Crash Course with Jupyter Notebook

Installation

I’m using the Anaconda Distribution of Jupyter Notebook. Search for “anaconda download”; the first link you find is probably from Anaconda.com, which distributes the Jupyter Notebooks and several other products like Anaconda Server.

  1. Open the Anaconda Navigator

  1. Launch Jupyter Notebook! (make you are not launching JupyterLab)

Building a notebook

Next up, hit New -> Python 3 (ipykernel)

Each Jupyter notebook contains multiple cells, which contain Python code. Python code in each cell gets executed when you run the cell. Cells can also be configured for text so that you can input instructions and guidance needed for the following code snippet. (markdown!).

Please note each cell carries the programming context from the above cells.

Running it!

A notebook (containing multiple cells) can be run in one go by using Cell -> Run Cells (as shown in the image above).

Alternatively, if you are a command line fan, you can use the below command to run a specific notebook.

> jupyter notebook notebook.ipynb

unSkript and Jupyter Notebooks

As discussed above, unSkript uses opensource Jupyter Notebooks under the hood and provides a seamless way of debugging/triggering complex infrastructure scripts.

Resources

Few more resources on getting started to understand Jupyter Notebooks:

PS: Unskript uses Jupyter Notebook under the hood. You could build or consume some knowledge shared by many engineers at the repo and run it via the .

There are many ways to install and run Jupyter Notebooks. Over the years, cloud platforms and several new-age startups have implemented Jupyter Notebooks - , , and .

Download and Install the ; it fits our use case to build and run a basic Jupyter Notebook.

A browser tab would be launched at

unSkript has many open-source runbooks (aka notebooks) at the GitHub repository. So give us a and raise an issue if you feel we are missing something.

awesome-cloud-ops
Docker container
Google Collab
Deepnote
Naas.ai
Anaconda Opensource Distribution
http://localhost:8889/tree
awesome-cloud-ops
star
Jupyter Notebook Docs
How to use Jupyter Notebooks?
A detailed guide on Jupyter Notebooks
The definitive guide on Jupyter Notebooks
[Video] Jupyter Notebook Tutorial for Python
Jupyter
A cell with one line of code. The evaluation is printed below the cell.
Markdown cell
Rendering the markdown inside the notebook
Variable in the first cell can be referred to in the second cell
screenshot of a Jupyter task
Notebook markdown cell
rendering the markdown inside the notebook
Variable in the first cell can be referred to in the second cell
cell menu showing configuration options
Jupyter screen shot
screenshot of Anaconda manager