Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Enabling HTTPS with Apache Livy - Amazon EMR

Enabling HTTPS with Apache Livy

This topic is relevant if you are running Amazon EMR 7.3.0 or an earlier release. Beginning with release 7.4.0, HTTPS is enabled with Apache Livy by default.

  1. Provision an Amazon EMR cluster with transit encryption enabled. To learn more about encryption, see Encrypt data at rest and in transit.

  2. Create a file called livy_ssl.sh with the following contents.

    #!/bin/bash KEYSTORE_FILE=`awk '/ssl.server.keystore.location/{getline; print}' /etc/hadoop/conf/ssl-server.xml | sed -e 's/<[^>]*>//g' | tr -d ' \t\n\r\f'` KEYSTORE_PASS=`awk '/ssl.server.keystore.password/{getline; print}' /etc/hadoop/conf/ssl-server.xml | sed -e 's/<[^>]*>//g' | tr -d ' \t\n\r\f'` KEY_PASS=`awk '/ssl.server.keystore.keypassword/{getline; print}' /etc/hadoop/conf/ssl-server.xml | sed -e 's/<[^>]*>//g' | tr -d ' \t\n\r\f'` echo "livy.keystore $KEYSTORE_FILE livy.keystore.password $KEYSTORE_PASS livy.key-password $KEY_PASS" | sudo tee -a /etc/livy/conf/livy.conf >/dev/null sudo systemctl restart livy-server.service
  3. Run the following script as an Amazon EMR step. This script modifies /etc/livy/conf/livy.conf to activate SSL.

    --steps '[{"Args":["s3://amzn-s3-demo-bucket/livy_ssl.sh"],"Type":"CUSTOM_JAR","ActionOnFailure":"CONTINUE","Jar":"s3://us-east-1.elasticmapreduce/libs/script-runner/script-runner.jar","Properties":"","Name":"Custom JAR"}]'
  4. Restart the Apache Livy service so that the changes take effect. To restart Apache Livy, see Stopping and restarting processes.

  5. Test that the clients can now communicate using HTTPS. To submit a job, for example, run the following code.

    curl -k -X POST --data '{"file": "local:///usr/lib/spark/examples/jars/spark-examples.jar", "className": "org.apache.spark.examples.SparkPi"}' \ -H "Content-Type: application/json" \ https://EMR_Master_Node_Host:8998/batches

    If you've enabled HTTPS successfully, Livy sends a response indicating that the command was accepted and that the batch job was submitted.

    {"id":1,"name":null,"owner":null,"proxyUser":null,"state":"starting","appId":null,"appInfo": {"driverLogUrl":null,"sparkUiUrl":null},"log":["stdout: ","\nstderr: ","\nYARN Diagnostics: "]}
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.