spark-connect-proxy
A reverse proxy server which allows secure connectivity to a Spark Connect server.
Why?
Because Spark Connect does NOT provide authentication and/or TLS encryption out of the box. This project provides a reverse proxy server which can be used to secure the connection to a Spark Connect server.
Setup (to run locally)
Install Python package
You can install spark-connect-proxy from PyPi or from source.
Option 1 - from PyPi
# Create the virtual environment
python3 -m venv .venv
# Activate the virtual environment
. .venv/bin/activate
pip install spark-connect-proxy[client]
Option 2 - from source - for development
git clone https://github.com/gizmodata/spark-connect-proxy
cd spark-connect-proxy
# Create the virtual environment
python3 -m venv .venv
# Activate the virtual environment
. .venv/bin/activate
# Upgrade pip, setuptools, and wheel
pip install --upgrade pip setuptools wheel
# Install Spark Connect Proxy - in editable mode with client and dev dependencies
pip install --editable .[client,dev]
Note
For the following commands - if you running from source and using --editable mode (for development purposes) - you will need to set the PYTHONPATH environment variable as follows:
export PYTHONPATH=$(pwd)/src
Usage
This repo contains scripts to let you provision an AWS EMR Spark cluster with a secure Spark Connect Proxy server to allow you to securely and remotely connect to it.
First - you'll need to open up a port for public access to the AWS EMR Spark Cluster - in addition to the ssh port: 22. Add port: 50051 as shown here:
[!NOTE]
Even though you are opening this port to the public, the Spark Connect Proxy will secure it with TLS and JWT Authentication.
The scripts use the AWS CLI to provision the EMR Spark cluster - so you will need to have the AWS CLI installed and configured with your AWS credentials.
You can create a file in your local copy of the scripts directory called .env with the following contents:
export AWS_ACCESS_KEY_ID="put value from AWS here"
export AWS_SECRET_ACCESS_KEY="put value from AWS here"
export AWS_SESSION_TOKEN="put value from AWS here"
export AWS_REGION="us-east-2"
To provision the EMR Spark cluster - run the following command from the root directory of this repo:
scripts/provision_emr_spark_cluster.sh
That will output several files (which will be git ignored for security reasons):
tls/ca.crt- the EMR Spark cluster generated TLS certificate - needed for your PySpark client to trust the Spark Connect Proxy server (b/c it is self-signed)scripts/output/instance_details.txt- shows the ssh command for connecting to the master node of the EMR Spark clusterscripts/output/spark_connect_proxy_details.log- shows how to run a PySpark Ibis client example - which connects securely from your local computer to the remote EMR Spark cluster. Example command:
spark-connect-proxy-ibis-client-example \
--host ec2-01-01-01-01.us-east-2.compute.amazonaws.com \
--port 50051 \
--use-tls \
--tls-roots tls/ca.crt \
--token honey.badger.dontcare
[!IMPORTANT]
You must have installed thespark-connect-proxypackage with the[client]extras onto the client computer to run thespark-connect-proxy-ibis-client-examplecommand.
Handy development commands
Version management
Bump the version of the application - (you must have installed from source with the [dev] extras)
bumpver update --patch
Metadata
Release files for spark-connect-proxy 0.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| spark_connect_proxy-0.0.14.tar.gz | 12.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spark_connect_proxy-0.0.14-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.2 kB
Release files / spark_connect_proxy-0.0.14.tar.gz
| Download URL | spark_connect_proxy-0.0.14.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25ff4806a1d59ca3e2cc6e3e9471f53a362d068a24c27f52ffe72fe4c4246d3a
|
|
BLAKE2b-256 checksum How to use checksums |
63f959940380564b4b0958103dcadf9b08b73c671ad35d735a2fdce68b0e8311
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2025.
Transparency logRelease files / spark_connect_proxy-0.0.14-py3-none-any.whl
| Download URL | spark_connect_proxy-0.0.14-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47d5b1db8205fd89ede0e066b98802c4b7ec26e17b4a539f7b52c19c36fbfa93
|
|
BLAKE2b-256 checksum How to use checksums |
f0b20b91fea825523d6f91ef241f3f02ea8752775452e6af000221874963c35d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2025.
Transparency logSecurity for spark-connect-proxy 0.0.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for spark_connect_proxy-0.0.14.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 13, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.