Skip to main content
Bring Your Own Spark (BYOS) lets you run WherobotsDB on a Spark cluster you own and operate. WherobotsDB is a drop-in replacement for Apache Sedona: you install its JAR on your existing cluster, and your existing code, SQL, and configuration continue to work unchanged. Your data never leaves your AWS account. Wherobots does not run, manage, or connect to your cluster — the only outbound traffic is a lightweight authenticated call from the JAR to Wherobots Cloud for license metering. This guide covers Amazon EMR. Only EMR on EC2 deployments are supported; EMR Serverless and EMR on EKS are not. It is validated on EMR 7.8.0 (Spark 3.5.4, Scala 2.12, Amazon Corretto JDK 17), and every command below targets that release. WherobotsDB is also validated on emr-spark-8.0.0 — see Version compatibility for what changes.
BYOS is distinct from Bring Your Own Cloud (BYOC). Under BYOC, Wherobots runs its own managed compute inside your AWS account. Under BYOS, you run your own Spark cluster and Wherobots supplies only the engine.For Databricks clusters, see Bring Your Own Spark (Databricks) instead.

For existing Apache Sedona users

If you already run Apache Sedona on Amazon EMR, moving to WherobotsDB takes two changes:
  1. Replace the JAR. Swap the public Apache Sedona JAR from Maven Central for the WherobotsDB EMR JAR that Wherobots supplies. The WherobotsDB build adds the enterprise functions, Wherobots Cloud authentication, and the metering client.
  2. Add your Wherobots API key. See Give Secret Manager Access and Create cluster.
Everything else in this guide — the IAM roles, bucket layout, and EMR Studio setup — is standard EMR configuration you may already have in place.

Before you start

The following requirements must be met within both your Wherobots Organization and AWS account before you begin:
  • An Admin account within a Professional, Innovation, or Enterprise Edition Organization.
    Wherobots Organization members with the User role can use a cluster an Admin has already set up, but cannot create the API key this deployment requires. See Organization Roles.
  • Community Edition is not supported. See Organization Editions or Upgrade Organization.
  • The BYOS feature enabled on your Organization. Contact Wherobots to enable it. BYOS unlocks both halves of this deployment: read access to the WherobotsDB release JARs, and the runtime authentication and usage-reporting endpoints the JAR calls. Without it, those endpoints return 403 and cluster initialization fails.
  • A Wherobots API key. You create this in Give Secret Manager Access.
  • An AWS account.
  • Permission to create IAM roles, instance profiles, and inline policies in that account. This guide creates three roles — an EMR service role, an EC2 instance role, and an EMR Studio service role — plus one instance profile. AdministratorAccess is sufficient but broader than required. For the specific actions involved, see Actions defined by AWS Identity and Access Management and Actions, resources, and condition keys for Amazon EMR in the AWS documentation.
  • Permission to create an S3 bucket, an EMR cluster, EC2 security groups, an EMR Studio, and a Secrets Manager secret.
  • iam:PassRole on the three roles this guide creates. create-cluster passes both the service role and the instance profile, and create-studio passes the Studio service role, so an identity without iam:PassRole on WherobotsEMRServiceRole, WherobotsEMRInstanceRole, and WherobotsEMRStudioServiceRole receives AccessDenied before either resource is created. This is a permission on the operator running these commands, distinct from the iam:PassRole the service role itself is granted in Create Service Role.
  • An Amazon EMR 7.x or later release. This guide targets emr-7.8.0. EMR 6.x is not supported — see Version compatibility.
  • A VPC and subnet for the cluster. The EMR Studio you create later must use the same subnet as the cluster.
  • Outbound HTTPS (port 443) from the cluster to Wherobots Cloud, for license metering. A cluster in a private subnet needs a NAT gateway or an equivalent egress path; without it, SedonaContext.create fails to authenticate.
  • The WherobotsDB release bundle from Wherobots, containing the shaded JARs, the geotools-wrapper JAR, and the wherobots-sedona Python wheels. These are not published to Maven Central or PyPI.
Once BYOS is enabled for your Organization, a read-only WherobotsDB Releases storage source appears automatically in your Wherobots Cloud storage list. Go to Storage, open that source, and download the JARs and wheel from the release folder. If the source does not appear, BYOS is not yet enabled — contact Wherobots.

Version compatibility

WherobotsDB JARs are compiled against JDK 17, so Amazon EMR 7.x or later is required. Choose the JAR that matches your EMR release: A Spark or Scala mismatch surfaces at runtime as NoSuchMethodError or ClassNotFoundException. Every command in this guide targets emr-7.8.0. To deploy on emr-spark-8.0.0 instead, make all four substitutions below. They must move together — a release label that disagrees with the JAR produces the NoSuchMethodError described above. WherobotsDB is versioned independently of Apache Sedona. Each WherobotsDB release is API-compatible with a specific Apache Sedona version, and the GeoTools wrapper version follows the Sedona version — so VERSION and GEOTOOLS_VERSION are different values. For example: Always use the exact filenames Wherobots delivered to you.

Install WherobotsDB on an EMR cluster

Installing WherobotsDB involves staging its artifacts in Amazon S3, granting your cluster access to them, and launching an EMR cluster that loads them at startup. Complete the sections in the order listed below; later sections depend on values produced by earlier ones. Sections 1 through 12 are performed with the AWS CLI. Sections 13 and 14 are performed in the AWS Console and the notebook, because creating a Workspace has no CLI equivalent.

Prepare your command line

All aws commands in this guide are run from a terminal on your local machine, not on the cluster. To prepare your environment, complete the following steps:
1

Install the AWS CLI

Install AWS CLI v2 by following Installing or updating the latest version of the AWS CLI in the AWS documentation.
2

Confirm your credentials

The command returns your account ID and the identity in use. If it returns ExpiredToken or Unable to locate credentials, re-authenticate with aws sso login or aws configure before continuing.
3

Set a default region

None of the commands in this guide pass --region, so your profile must have one set. Confirm it:
If that prints nothing, set it before continuing — a profile with valid credentials but no region fails at create-cluster, the EC2 lookups, and the S3 calls:
4

Collect the required values

Commands in this guide use uppercase placeholders. Gather the following values before you begin:
Several steps use cat > filename <<'EOF' … EOF to create a file in the current working directory. Run every command in this guide from that same directory.
Some commands pass a filename prefixed with file://, for example --policy-document file://ec2-trust.json. The prefix instructs the AWS CLI to read the argument from a file rather than interpret it as a literal value, and it is required. Omitting it causes the command to fail, because the CLI treats the filename itself as the policy document.The path after file:// is relative to your current directory. If you keep these files elsewhere, supply the full path instead, for example file:///Users/name/emr-setup/ec2-trust.json.
This guide uses the following Amazon EMR terms:

File destinations

This guide works with two kinds of files: the artifacts Wherobots supplies, and the files you author yourself. Five objects are uploaded to Amazon S3 and read by the cluster at runtime. The remaining files you author are never uploaded — the AWS CLI reads them from disk and submits their contents to Amazon EMR and IAM, which retain them as part of the cluster definition and the roles’ policies.
Filenames must match exactly between Amazon S3 and the configuration block of the bootstrap script. A mismatch causes cluster creation to fail with NoSuchKey, or produces a cluster that starts without the Python client installed.
Values in configurations.json become part of the cluster definition and remain visible in the EMR console under Clusters → your cluster → Configurations, in the output of aws emr describe-cluster, and in the provisioning logs written to your log URI. Do not place your Wherobots API key in this file. This guide supplies the key through the configure_key.py step, which keeps it out of the cluster definition.

Configure your S3 bucket

In AWS, create a bucket with the following subdirectories:
1

Create the S3 bucket

  • In the AWS Console navigate to S3 → Create bucket. Enter YOUR_BUCKET_NAME, choose the region, enable default encryption and versioning as required, then click Create bucket.
2

Create the folders (prefixes)

  • Open the bucket in the Console, click Create folder, and add the following folders: apps, emr-logs, studio, and wherobots. Inside wherobots, create bootstrap, jars, and wheels.
When you are done, the wherobots prefix contains exactly three folders: bootstrap/, jars/, and wheels/.
Upload the WherobotsDB JARs supplied by Wherobots to the wherobots/jars/ prefix:
Use the sedona-emr-spark-shaded-* JAR. The sedona-dbr-spark-shaded-* JAR in the same bundle is built for Databricks Runtime and will not work on Amazon EMR, and the public sedona-spark-shaded-* JAR on Maven Central is the open-source Apache Sedona build without the WherobotsDB enterprise features.
Match the JAR to the Spark and Scala version of your EMR release, as listed in Version compatibility. A mismatch surfaces at runtime as NoSuchMethodError or ClassNotFoundException.

Configuration JSON

This file defines the Spark properties that load the WherobotsDB JARs and register the spatial SQL functions. It is not uploaded to Amazon S3. Instead, create-cluster reads it from your local disk and submits its contents to Amazon EMR, which retains them as part of the cluster definition. To create the configuration file, complete the following steps:
1

Create the file on your local machine

In the working directory you established in Prepare your command line, create a file named configurations.json using a text editor, and paste in the following:
2

Replace the JAR filenames

Substitute VERSION and GEOTOOLS_VERSION in both spark.jars and spark.yarn.dist.jars with the versions of the JARs you uploaded to wherobots/jars/. The two properties must list the same two JARs, in the same order.
spark.jars is required and is not interchangeable with spark.yarn.dist.jars. The latter distributes the JARs to YARN containers but does not add them to the driver classpath, so Spark cannot load the classes named in spark.sql.extensions. Spark logs a warning, continues without the extensions, and every ST_* call then fails with UNRESOLVED_ROUTINE on a cluster that otherwise appears healthy. Set both properties.
spark.sql.extensions is a comma-separated list, and the value you set here replaces any value already in effect. If your cluster configuration registers other extensions — Apache Iceberg’s, for example — append the two Sedona entries to your existing list instead of pasting this block verbatim. Stock Amazon EMR sets no spark.sql.extensions default of its own, so on an unmodified cluster the value above is safe as-is.
3

Validate the JSON

The command prints the formatted file if it is valid. Malformed JSON causes create-cluster to fail immediately with a parse error.
After the cluster is created, you can confirm these settings applied in the EMR console under Clusters → your cluster → Configurations, or by running aws emr describe-cluster --cluster-id CLUSTER_ID --query 'Cluster.Configurations'.

Bootstrap script

A bootstrap action is a script that Amazon EMR runs on every node of the cluster during creation, before Spark is installed. This script copies the WherobotsDB JARs from Amazon S3 onto each node and installs the wherobots-sedona Python client. The API key is not handled here. Bootstrap actions run before Spark exists, and a shell export in a bootstrap script exits before any Spark process starts, so the variable never reaches them. The key is supplied by a cluster step instead — see Create cluster. You do not run this script yourself. You create it on your local machine, upload it to Amazon S3, and reference its S3 path in the --bootstrap-actions argument of Create cluster. Amazon EMR retrieves and runs it on each node. To create and upload the bootstrap script, complete the following steps:
1

Create the file on your local machine

In the working directory you established in Prepare your command line, create a file named bootstrap-wherobotsdb.sh using a text editor, and paste in the script below.
2

Edit the configuration block

Replace the values in the Configuration: edit this section block at the top of the file. Leave the rest of the script unchanged.
If you add your own pip install lines, put them after every aws command in the script. The AWS CLI on Amazon Linux is rpm-managed and shares the system Python, so installing packages such as pandas or geopandas upgrades python-dateutil and jmespath out from under it. Any aws command that runs afterwards fails with ModuleNotFoundError: No module named 'dateutil'.
Install packages with sudo "${PY_BIN}" -m pip rather than hard-coding an interpreter. On EMR 7.8.0 PY_BIN and python3 are the same binary, but on emr-spark-8.0.0 they are not — using ${PY_BIN} keeps the script correct on both.
3

Upload the script to Amazon S3

Run the following in your terminal, from the directory containing the file:
4

Verify the upload

The file must appear with a non-zero size. Amazon EMR reads this object at cluster-creation time, so re-upload it after any edit — clusters do not pick up local changes.

WHL file

The wherobots-sedona Python client is distributed as prebuilt wheels in the WherobotsDB release bundle, alongside the JARs. It is not published to PyPI. You still install it with pip — you just point pip at the wheel file rather than at a package name. pip install wherobots-sedona cannot resolve, because there is no index to resolve it from; pip install /path/to/wherobots_sedona-....whl works normally, which is what the bootstrap script does. The wheel filename encodes both a Python version tag and a CPU architecture, and both must match your cluster. Pick the Python tag from your EMR release: Pick the architecture from your instance type: The release bundle also contains macosx_* and win_* wheels. Those are for local development — cluster nodes always take a manylinux wheel.
The Python tag must match the interpreter PySpark uses, not the one python3 resolves to in your shell. On EMR 7.8.0 those are the same binary, so cp39 is correct. They diverge on emr-spark-8.0.0, where Spark uses Python 3.11 while the shell’s python3 is still 3.9 — a wheel built for the wrong Python version installs without complaint and is never importable from Spark. Installing the wrong architecture fails outright with not a supported wheel on this platform.
To upload the wheel, complete the following steps:
1

Confirm your cluster's Python tag and architecture

Check your EMR release and the instance type you plan to launch against the tables above. The examples in this guide use emr-7.8.0 on r8g.xlarge, which is Graviton, so they use the cp39 / aarch64 wheel.
2

Create the wheels prefix

In your terminal, run:
3

Upload the wheel

Run this from the directory containing the wheel files Wherobots supplied:
4

Verify the upload

The filename listed must match SEDONA_WHEEL in the bootstrap script exactly.

Create IAM roles

This deployment uses three IAM roles. Confusing the first two is the most common setup mistake: Each role needs a trust policy naming the AWS service allowed to use it. In your terminal, create all three files first. They are not uploaded to S3 — the aws iam commands read them from disk and submit their contents to IAM, which stores them on the role:

Create Service Role

To create the role Amazon EMR uses to manage your cluster, complete the following steps in your terminal:
1

Create the role

2

Attach the AWS managed policy

AmazonEMRServicePolicy_v2 alone is not sufficient for this setup. It scopes its EC2 permissions to resources carrying the for-use-with-amazon-emr-managed-policies tag, and it does not grant iam:PassRole for a custom instance profile name such as WherobotsEMRInstanceRole. The inline policy you add in the next two steps supplies both: explicit access to your subnet and security groups, and iam:PassRole for the instance profile.
3

Look up your security group IDs

Record both group IDs. You substitute them into the policy in the next step as SECURITY_GROUP_ID_MASTER and SECURITY_GROUP_ID_SLAVE.
If the command returns no rows, Amazon EMR has not yet created its managed groups in this VPC. This is normal before your first cluster launch. Take the “no managed groups yet” path:
  1. In the policy file in the next step, remove the two security-group ARNs from the CreateInNetwork statement, keeping its subnet ARN, and delete the entire ManageSecurityGroups statement. Its Resource array contains only those two ARNs, so removing them individually would leave an empty array, which put-role-policy rejects as invalid.
  2. In Create cluster, omit EmrManagedMasterSecurityGroup= and EmrManagedSlaveSecurityGroup= from --ec2-attributes. Amazon EMR then creates its default managed groups during launch. The CreateDefaultSecurityGroupInVPC statement is what permits this.
  3. Afterwards, re-run the lookup above, add the two ARNs back to CreateInNetwork, restore the ManageSecurityGroups statement, and re-apply the policy with put-role-policy.
4

Create the policy file

This policy grants the service role access to your specific subnet, security groups, and VPC, and allows it to pass the instance profile to EC2.Substitute SUBNET_ID, SECURITY_GROUP_ID_MASTER, SECURITY_GROUP_ID_SLAVE, VPC_ID, and ACCOUNT_ID, then run:
5

Verify both policies are attached

The first command must list AmazonEMRServicePolicy_v2. The second must list wherobots-emr-network-access.

Give Secret Manager Access

To store your Wherobots API key in AWS Secrets Manager and grant the cluster access to it, complete the following steps:
1

Create a Wherobots API key

Log in to Wherobots Cloud, go to Settings → API Keys, and click Create new key.
Copy the key before leaving the page. It is shown only once.
2

Store the key as a secret

In your terminal, run:Passing the key as a command-line argument writes it into your shell history and exposes it in the local process list. Read it into a 0600 file instead, hand that file to the CLI, then delete it:
read -rs keeps the key off the screen, printf '%s' writes it without a trailing newline, and umask 077 makes the file readable only by you.Store the key as plaintext — no JSON wrapper and no trailing newline. The key step reads the value verbatim, so anything extra ends up inside the key.
3

Note the secret's ARN

The ARN ends in six random characters, for example ...:secret:wherobots/api-key-Ab3xY9.
4

Create the access policy file

This policy grants the instance profile role — not the service role — permission to read the secret, read your bucket, and write cluster logs. It is applied to the role in Create Instance Profile.Substitute YOUR_BUCKET_NAME, REGION_IDENTIFIER, and ACCOUNT_ID, then run:
Keep the trailing -* on the secret ARN. Secrets Manager appends six random characters to every secret ARN, so a policy pinned to the literal ARN breaks if the secret is ever recreated.
Without the s3:PutObject statement, Amazon EMR cannot write to the log URI. A cluster that fails then reports Unknown Error. with no logs available for diagnosis.

Create Instance Profile

An instance profile is a wrapper that lets EC2 machines use an IAM role. The role by itself is not enough — EC2 can only assume a role that is wrapped in an instance profile of the same name. To create it, complete the following steps in your terminal:
1

Create the role

2

Attach the access policy

3

Wrap the role in an instance profile

4

Verify the grants

The second command must list WherobotsEMRInstanceRole under Roles. If it returns an empty list, the previous step did not complete.

Create security groups

EMR Studio reaches the cluster over port 18888, the Jupyter Enterprise Gateway. That requires two security groups: an engine group attached to the cluster’s primary node, and a workspace group attached to the Workspace.
Create these groups before launching the cluster. The engine group is attached to the primary node at launch through AdditionalMasterSecurityGroups and cannot be added to a running cluster. If you launch first, your only options are to recreate the cluster or to add an inbound rule for TCP 18888 to the cluster’s existing primary security group.
In your terminal, create both groups and connect them:
Record both IDs. The next section uses the engine group as ENGINE_SECURITY_GROUP_ID, and Create EMR Studio uses both.
The tag on the engine security group is required. Because the group is attached to the primary node at launch, the EMR service role needs ec2:RunInstances on it — which AmazonEMRServicePolicy_v2 grants only for tagged security groups. The alternative is to add its ARN to the CreateInNetwork statement of the service role policy.
$ENG and $WS are shell variables that exist only in the terminal session that created them. If you open a new terminal before finishing this guide, re-read the IDs with aws ec2 describe-security-groups --filters Name=group-name,Values=emr-studio-engine-sg,emr-studio-workspace-sg --query 'SecurityGroups[].{Name:GroupName,Id:GroupId}' --output table.

Create cluster

The following steps create an EMR cluster that runs WherobotsDB. You can also use an existing EMR cluster, but it must meet the requirements outlined in the Before you start section, and it must already carry the engine security group on its primary node. The API key reaches Spark through a step that runs immediately after the cluster starts. It reads the secret on the primary node and writes spark.wherobots.api.key into Spark’s own configuration file, so every later session picks it up. This cannot be done in the bootstrap script, because Spark is not installed yet when bootstrap actions run. In your terminal, save the following as configure_key.py:
Substitute REGION_IDENTIFIER with your actual region before uploading. Unlike the IAM policy files, this script is not read by the AWS CLI on your machine — it is uploaded verbatim and executed on the cluster’s primary node, where a literal REGION_IDENTIFIER makes the boto3 client fail immediately. Because the step runs with ActionOnFailure=TERMINATE_CLUSTER, that failure tears down the cluster you just launched.
Substitute the region, then upload it to the apps/ prefix, where the cluster’s first step reads it from:
spark.redaction.regex is set in Configuration JSON rather than here, because it is not a secret and should apply from the moment the cluster starts. Spark’s default value, (?i)secret|password|token, does not match spark.wherobots.api.key; without extending it the key appears in the Spark UI Environment tab and in the event logs written to S3.
This step writes to /etc/spark/conf/spark-defaults.conf on the primary node only. That covers EMR Studio notebook kernels and any pyspark or spark-submit --deploy-mode client session on the primary node. Jobs submitted with --deploy-mode cluster run their driver in a YARN container on a core node, which does not see this file — pass the key to those jobs explicitly with --conf spark.wherobots.api.key=... or as the WHEROBOTS_API_KEY environment variable.
To create the cluster, complete the following steps in your terminal:
1

Run create-cluster

Substitute ENGINE_SECURITY_GROUP_ID with the engine group ID from Create security groups. This is what lets EMR Studio reach the cluster, and it cannot be added after launch.
ActionOnFailure is set to TERMINATE_CLUSTER deliberately. With CONTINUE, a failed key step leaves a cluster that reaches WAITING and looks healthy, but every spatial query fails later with an authentication error. Failing at launch surfaces the cause while the step logs are the obvious place to look.
The command returns a ClusterId. Use it as CLUSTER_ID in the steps that follow.
--tags for-use-with-amazon-emr-managed-policies=true is required. The EMR console adds this cluster tag automatically, but the CLI does not. EMR propagates cluster tags onto the EC2 instances it launches, and AmazonEMRServicePolicy_v2 authorizes ec2:RunInstances on instance/* only when that request tag is present. Omitting it fails cluster creation with VALIDATION_ERROR: Service role ... has insufficient EC2 permissions — a message that does not mention tags, and produces no logs because no instance ever launches.
Make sure the logs S3 path has a trailing slash.
2

Wait for the cluster to be ready

The state moves through STARTING, BOOTSTRAPPING, and RUNNING before reaching WAITING, which takes roughly five to ten minutes.
3

Confirm the bootstrap installed the Python client

Find the instance ID, then read the bootstrap log:
Expected output includes:
Logs are archived to S3 on a five-minute cycle, so they may not appear immediately after the cluster is ready.

EMR Studio Notebook

EMR Studio is the browser-based notebook environment for EMR. A Studio is the container; a Workspace is an individual notebook environment inside it that attaches to a cluster.

Create EMR Studio

A Studio needs its own service role, which EMR Studio uses to store notebook files in your bucket and to attach Workspaces to clusters. To create the Studio, complete the following steps in your terminal:
1

Create the Studio service role

This role uses the studio-trust.json trust policy you created in Create IAM roles:
2

Create and attach the Studio policy

Substitute YOUR_BUCKET_NAME, then run:
3

Create the Studio

Substitute the engine and workspace security group IDs from Create security groups if you are in a new terminal session, then run:
The command returns a StudioId and a Url. Save the URL — it is how you open the Studio.
The Studio’s subnet must be the same one the cluster runs in, or Workspaces will not be able to reach it.
Security groups cannot be added to a Studio after it is created. If you see the message “You haven’t set up the VPC, subnets, or security groups in the Studio for this Workspace”, the Studio was created without them and you need to create a new one.

Launch notebook and attach cluster

Creating a Workspace has no CLI equivalent. To create one, complete the following steps in the AWS Console:
1

Open the Studio

Go to the Url returned by create-studio, or in the AWS Console navigate to EMR → EMR Studio, then select your Studio.
2

Create a Workspace

Select Workspaces → Create Workspace. Enter a name and leave the subnet at its default, which comes from the Studio.
3

Attach the cluster

In the Workspace, open the cluster panel on the left sidebar and attach it to the cluster you created. You can also select the cluster while creating the Workspace.
4

Launch and choose a kernel

Open the Workspace, create a new notebook, and select the PySpark kernel.
A Workspace in Ready status has its cluster and security group fields locked. Stop the Workspace first if you need to change which cluster it attaches to, then start it again.

Test in EMR Studio Notebook

These commands run in a notebook in your browser, not in your terminal. Nothing is installed in the notebook session and no API key is entered, because the bootstrap action and the configure-wherobots-key step have already supplied both. To open the notebook, complete the following steps:
1

Open EMR Studio

In the AWS Console, navigate to EMR → EMR Studio, then select the Studio you created in Create EMR Studio. You can also open the Url returned by aws emr create-studio.To retrieve the URL again, run:
2

Open your Workspace

Select Workspaces, then select the Workspace you attached to your cluster. Its status must be Ready. If it is Stopped, select Start and wait for it to become Ready.
3

Confirm the cluster is attached

In the Workspace, open the cluster panel in the left sidebar and confirm your cluster is listed as attached. If it is not, attach it before continuing. See Launch notebook and attach cluster.
4

Create a PySpark notebook

Create a new notebook and select the PySpark kernel. The kernel must be PySpark; the other kernels do not connect to the Spark cluster.
Then run the following cells in order:
1

Confirm the client is installed against the interpreter Spark uses

If the import fails with No module named 'sedona', the wheel did not install. Check the bootstrap log for WARN: 'sedona' is NOT importable.
2

Initialize Sedona

3

Run the validation query

Because spark.sql.extensions is set, ST_* functions are also available through plain spark.sql(...) without calling SedonaContext.create first. The later cells rely on this.
4

Confirm geometries reach Python

This exercises the wheel rather than the JAR alone — the returned value is a Shapely object, not text.
5

Confirm spatial functions run on executors

This requires the wheel to be present on every node, not just the primary.
If a query fails with Wherobots Cloud credentials are required, the session did not pick up spark.wherobots.api.key. Confirm the configure-wherobots-key step completed, then restart the notebook kernel — spark-defaults.conf is read only when a session is created.

How Wherobots authentication works

WherobotsDB validates your API key at startup and uses it for usage-based billing. Both operations call Wherobots Cloud endpoints that are part of the BYOS feature:
  1. At startup, the JAR authenticates against POST /apps/authenticate, which returns a workload ID.
  2. While the workload runs, the JAR periodically reports usage heartbeats to POST /apps/report/{workload_id}.
If BYOS is not enabled for your Organization, both endpoints return 403 and initialization fails. The same feature grants access to the release JARs. See Before you start. You can supply the key in either of two ways: For details on creating and rotating keys, see the Wherobots API Keys documentation.

Feature differences from Wherobots Cloud

BYOS provides the WherobotsDB engine on your cluster. Features of the managed Wherobots Cloud platform are not included:
  • The Wherobots managed catalogswherobots, wherobots_open_data, wherobots_pro_data, and the tutorial examples_temp catalog — are not available. Notebooks or jobs that reference them must be pointed at your own catalogs or read public data directly.
  • The EMR JAR does not bundle Apache Iceberg. Add your own Iceberg runtime and catalog configuration if you need Iceberg tables, appending its extension to spark.sql.extensions rather than replacing the Sedona entries.
  • Runtime conveniences that Wherobots Cloud preconfigures — the Spark checkpoint directory, visualization packages such as SedonaKepler, and pre-installed Python dependencies — must be set up on your cluster yourself. The bootstrap script covers the essentials.

Troubleshooting

ClassNotFoundException, UNRESOLVED_ROUTINE, ST_* functions not recognized, or 'JavaPackage' object is not callable in PySpark
  • Confirm both spark.jars and spark.yarn.dist.jars are set as in Configuration JSON, and that the filenames exactly match the files in /jars. A missing spark.jars is the classic cause when running pyspark or spark-submit in client mode: the extensions silently fail to load on the driver.
  • Check the bootstrap log at <log-uri>/<cluster-id>/node/<instance-id>/bootstrap-actions/1/ and confirm /jars was populated on every node.
  • If you set classpaths directly, append to Amazon EMR’s defaults rather than replacing them. Overwriting spark.driver.extraClassPath or spark.executor.extraClassPath at the cluster level removes EMRFS from the classpath and breaks S3 access. Prefer the spark.jars approach.
ModuleNotFoundError: No module named 'sedona' — the Python client is not installed into the interpreter PySpark uses. Check the bootstrap log for the wheel-install section, and confirm PY_BIN matches your EMR release: /usr/bin/python3 on EMR 7.8.0, /usr/bin/python3.11 on emr-spark-8.0.0. If you are installing by hand, pass pip the wheel’s path — pip install wherobots-sedona by name cannot resolve, since the package is not on PyPI. ModuleNotFoundError: No module named 'pandas' — wheels up to and including 1.28.0 did not declare their pandas dependency. When deploying those versions, add a sudo "${PY_BIN}" -m pip install pandas line to the bootstrap script, after every aws command. Bootstrap fails with Cannot uninstall setuptools ... RECORD file not found — pip is trying to replace the rpm-owned setuptools on Amazon Linux. Wheels up to and including 1.28.0 pinned setuptools>=69, which triggers this. Add --ignore-installed to the bootstrap’s pip install line when deploying those versions. Later releases carry no setuptools pin. UnsupportedClassVersionError — the cluster is running JDK 8. Use an EMR 7.x or later release, which ships JDK 17. See Version compatibility. NoSuchMethodError at query time — a Spark or Scala mismatch between the JAR and the EMR release, for example the 4.0_2.13 JAR on emr-7.8.0, which is Spark 3.5 and Scala 2.12. See Version compatibility. Bootstrap fails with S3 AccessDenied — the EMR EC2 instance profile is missing s3:GetObject on your staging prefix or on the bootstrap script itself. If you modified the bootstrap to use --recursive or sync, it additionally needs s3:ListBucket on the bucket. Cluster creation fails with VALIDATION_ERROR: Service role ... has insufficient EC2 permissions, and no logs are written — the for-use-with-amazon-emr-managed-policies=true cluster tag is missing. See Create cluster. No instance ever launches, so there is nothing to log. A failed cluster reports Unknown Error. with no logs — the instance profile cannot write to the log URI. Confirm the s3:PutObject statement from Give Secret Manager Access is present, and that --log-uri ends in a trailing slash. AccessDenied reading public S3 datasets — Amazon EMR’s S3 filesystem signs every request with the instance profile, and cross-account access requires an identity-policy allow even for publicly readable buckets. Either grant the instance profile read access to those buckets, or read them anonymously with s3a:// URIs plus spark.hadoop.fs.s3a.bucket.<bucket-name>.aws.credentials.provider=org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider. Authentication errors from SedonaContext.create — confirm spark.wherobots.api.key or WHEROBOTS_API_KEY is set, that the key has not expired, that BYOS is enabled for your Organization, and that your security groups and network policy allow outbound HTTPS to Wherobots Cloud.

Support

For issues or questions, contact Wherobots support.