Enable Kerberos authentication in a Serverless Spark workspace to require all clients to authenticate before submitting Spark tasks. This reduces unauthorized access and improves task execution security.
Limitations
A workspace can be bound to only one Kerberos cluster.
Kerberos authentication is supported only for Spark batch jobs.
Kerberos authentication requires network connectivity between EMR Serverless Spark and your Virtual Private Cloud (VPC), and UDP port 88 must be open for Kerberos traffic. Complete the network setup in Step 1 before configuring authentication.
Prerequisites
Before you begin, ensure that you have:
A Kerberos principal created, with its keytab file exported and uploaded to Object Storage Service (OSS)
For EMR on ECS clusters, see Basic Kerberos usage
A Serverless Spark workspace. See Manage workspaces
Step 1: Prepare the network
Establish network connectivity between EMR Serverless Spark and your VPC. See Establish network connectivity between EMR Serverless Spark and other VPCs.
When adding a security group rule, open UDP port 88 for Kerberos traffic. If you configure the network connection over TCP instead, add udp_preference_limit = 1 under [libdefaults] in your krb5.conf file in Step 2.
Step 2: Configure Kerberos authentication
This step binds your Serverless Spark workspace to a Kerberos cluster and enables authentication enforcement.
In the EMR console, choose EMR Serverless > Spark in the left navigation pane.
On the Spark page, click the name of the target workspace.
In the left navigation pane, click Security > Kerberos Authentication.
Click Bind Kerberos.
On the Bind Kerberos page, configure the following parameters and click OK.
Parameter Description Kerberos Name Enter a custom name. Network Connection Select the network connection created in Step 1. Kerberos krb5.conf Enter the content of your krb5.conffile. See the instructions below.How to get the
krb5.confcontentThe
krb5.conffile is typically located at/etc/krb5.confon the Kerberos server.EMR DataLake cluster: Log on to the master node (see Log on to a cluster), run
cat /etc/krb5.conf, and copy the output into the Kerberos krb5.conf field.Other EMR clusters or self-managed Kerberos: Replace the
hostnamevalue in the file with the private IP address of your VPC.
If you opened UDP port 88 in Step 1, no changes to
krb5.confare needed. If you used TCP, addudp_preference_limit = 1under[libdefaults].
In the Actions column, click Enable, then click OK in the confirmation dialog.
Step 3: Submit a Spark batch job with Kerberos authentication
After enabling Kerberos authentication, every Spark batch job must include the Kerberos credentials. Submitting a job without them returns the error: spark.kerberos.keytab and spark.kerberos.principal not configured.
Create a Spark batch job. See PySpark Quick Start.
On the development tab, set Network Connection to the connection added in Step 1, then add the following Kerberos parameters to Spark Configuration and click Run.
spark.files oss://<bucketname>/path/test.keytab spark.kerberos.keytab test.keytab spark.kerberos.principal <username>@<REALM>Parameter Description spark.filesThe full path of the keytab file that is uploaded to OSS. spark.kerberos.keytabThe name of the keytab file. spark.kerberos.principalThe principal in the keytab file, used for identity authentication with Kerberos. Run klist -kt <keytab_file>to view the principal.(Optional) Connect to a Kerberos-enabled Hive Metastore from the job To query metadata from a Kerberos-protected Hive Metastore, add these parameters to Spark Configuration:
spark.hive.metastore.sasl.enabled true spark.hive.metastore.kerberos.principal hive/<hostname>@<REALM>Set
spark.hive.metastore.kerberos.principalto the principal from the keytab file used by Hive Metastore. To find it:In the EMR on ECS console, go to the Hive service Configuration page and open the hive-site.xml tab. Find the value of
hive.metastore.kerberos.keytab.file.Run
klist -kt <path_to_Hive_Metastore_keytab_file>to retrieve the principal.
The principal format is
hive/<hostname>@<REALM>, where<hostname>is the fully qualified domain name (FQDN) of the node running Hive Metastore (runhostname -fto get it) and<REALM>is the KDC realm.If the Hive Metastore endpoint uses a hostname, use
hive/_HOST@<REALM>. Spark automatically replaces_HOSTwith the hostname from the Hive Metastore endpoint. This format is required when configuring multiple Hive Metastores.After the job runs, go to the Execution Records section and click Details in the Actions column.
In Job History, view logs on the Log Exploration page.

Step 4 (Optional): Connect the workspace data catalog to a Kerberos-enabled Hive Metastore
If the workspace data catalog needs to fetch metadata from a Kerberos-protected Hive Metastore, specify the keytab file path and principal when adding an external Hive Metastore.

| Field | Description |
|---|---|
| Kerberos keytab file | The path to the Kerberos keytab file. |
| Kerberos principal | The principal name from the keytab file, used for identity authentication with Kerberos. Run klist -kt <keytab_file> to view the principal. |