Skip to main content

Spark on Azure HDInsight

Spark on Azure HDInsight example in Python

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set classic-azure-py-hdinsight-spark
cd pulumi-examples/classic-azure-py-hdinsight-spark

An example Pulumi component that deploys a Spark cluster on Azure HDInsight.

Running the App#

  1. Create a new stack:

    Terminal window
    pulumi stack init dev
  2. Login to Azure CLI (you will be prompted to do this during deployment if you forget this step):

    Terminal window
    az login
  3. Specify the Azure location and subscription to use:

    Terminal window
    pulumi config set azure:location WestUS
    pulumi config set azure:subscriptionId <YOUR_SUBSCRIPTION_ID>
  4. Define Spark username and password (make it complex enough to satisfy Azure policy):

    Terminal window
    pulumi config set username <value>
    pulumi config set --secret password <value>
  5. Run pulumi up to preview and deploy changes:

    Terminal window
    pulumi up
    Previewing changes:
    ...
    Performing changes:
    ...
    info: 5 changes performed:
    + 5 resources created
    Update duration: 15m6s
  6. Check the deployed Spark endpoint:

    Terminal window
    pulumi stack output endpoint
    https://myspark1234abcd.azurehdinsight.net/
    # For instance, Jupyter notebooks are available at https://myspark1234abcd.azurehdinsight.net/jupyter/
    # Follow https://docs.microsoft.com/en-us/azure/hdinsight/spark/apache-spark-load-data-run-query to test it out

Related

The infrastructure as code platform for any cloud.