Before accessing the Presto web UI or submitting Presto jobs, set the administrator password for your Presto cluster. This topic explains how to configure the password in the E-MapReduce (EMR) console.
Prerequisites
Before you begin, ensure that you have:
-
An EMR on ACK cluster with Presto deployed
-
Access to the EMR console
-
htpasswdinstalled on your local machine (see Install htpasswd)
How it works
The Presto cluster stores credentials in a password.db file. Each line follows the format username:hashed_password, where the password must be hashed using bcrypt. A valid entry looks like:
admin:$2y$10$BqTb8hScP5DfcpmHo5PeyugxHz5Ky/qf3wrpD7SNm8sWuA3VlGqsa
The htpasswd utility from Apache HTTP Server generates bcrypt-compatible hashes. The flags used in the generation command are:
| Flag | Purpose |
|---|---|
-B |
Use bcrypt hashing algorithm |
-C 10 |
Set bcrypt cost to 10 |
-n |
Print output to stdout instead of writing to a file |
Because -n prints to stdout, you must copy the output and paste it into the configuration manually.
Install htpasswd
Install htpasswd based on your operating system:
| OS | Command |
|---|---|
| macOS | Run the htpasswd command directly (pre-installed with macOS) |
| CentOS | yum install httpd |
| Ubuntu | apt-get install apache2-utils |
Commands and package names may vary depending on your system version and configuration. Adjust as needed.
Configure the administrator password
Step 1: Open the password.db tab
-
Log on to the EMR console. In the left-side navigation pane, click EMR on ACK.
-
On the EMR on ACK page, find the target cluster and click Configure in the Actions column.
-
On the Configure tab, move the pointer over the
icon and select password.db.
Step 2: Generate and save the password
-
On your local machine, run the following command to generate a bcrypt password hash:
htpasswd -nBC 10 adminEnter your chosen password when prompted. The command prints a hash similar to:
admin:$2y$10$BqTb8hScP5DfcpmHo5PeyugxHz5Ky/qf3wrpD7SNm8sWuA3VlGqsa -
On the password.db tab in the EMR console, replace the value of admin with the hash output from the previous step.
-
Click Save.
-
In the dialog box that appears, configure the Execution Reason parameter and click Save.
Step 3: Restart Presto
-
Click the Service Details tab.
-
In the Components section, find TrinoCoordinator and click Restart in the Actions column.
-
In the dialog box that appears, configure the Execution Reason parameter and click OK.
-
In the Confirm message, click OK.
Verify the configuration
After Presto restarts, you can use the new password to access the web UI of Presto and submit Presto jobs:
-
Open the Presto web UI in your browser.
-
Log in with the username
adminand your new password. -
Try logging in with an incorrect password and confirm that access is denied.