---
title: How to Deploy Trino as an Amazon Athena Alternative
url: https://docs.vultr.com/how-to-deploy-trino-as-an-amazon-athena-alternative
description: Deploy Trino on Vultr with Docker Compose as an Amazon Athena alternative, with an Iceberg REST catalog, object storage, federated PostgreSQL queries, and TLS.
publish_date: 2026-12-04T19:48:04.362149Z
last_updated: 2026-12-04T20:12:41.542438Z
author: Darshan  Siroya
header_image: https://assets.vultrdevrel.com/docs-main-doc-assets-1/2697/b754eefb-b178-4943-813a-532aee01c663.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

[Amazon Athena](https://aws.amazon.com/athena/) is a serverless query service that analyzes data in Amazon S3 using SQL and supports federated queries across other data sources. It removes the need to deploy and manage query infrastructure, but it bills on-demand for SQL queries based on the amount of data scanned, and its catalog, permissions, and federated connectors integrate with AWS Glue, IAM, and Lambda.

[Trino](https://trino.io/) is an open-source distributed SQL query engine that queries data in object storage, relational databases, and other sources through connectors. Athena SQL engine version 3 builds on Trino, making Trino a close self-hosted alternative. A self-hosted deployment gives you control over the engine release, connector configuration, resource allocation, and data location, with infrastructure costs rather than per-query data scan charges.

This article covers deploying Trino on a single Linux server using Docker Compose as an alternative to Amazon Athena. It includes setting up a coordinator and two workers, configuring an Iceberg REST catalog with Object Storage, creating and querying Iceberg tables, and joining PostgreSQL data with Iceberg tables through federated queries. Additional topics include HTTPS and password authentication, resource groups, deployment verification, and migration from Amazon Athena.

## Understanding Trino Architecture

Trino components closely correspond to Amazon Athena query processing and data access features, but the match is not always one-to-one. The following table pairs each Athena feature with its nearest Trino counterpart and notes the differences.

| Amazon Athena | Trino | Description |
| --- | --- | --- |
| Athena query engine | Trino coordinator and workers | Plan and execute distributed SQL queries across connected data sources. |
| Amazon S3 data lake | Object Storage bucket | Stores Iceberg data and metadata files in S3-compatible storage. |
| AWS Glue Data Catalog | Iceberg REST catalog | Stores table and schema metadata. This deployment's REST catalog manages Iceberg tables only, while Glue also holds other table formats. |
| Athena federated Lambda connectors | Trino connectors (plugins) | Query external data sources, such as PostgreSQL, through connectors that run inside the Trino servers, so there are no Lambda functions to deploy. |
| Athena workgroups | Trino resource groups | Limit concurrency, queue sizes, and memory usage for groups of queries. Resource groups do not replace other workgroup features, such as IAM-based access control, enforced query result settings, and data usage controls. |
| Athena console query editor | Trino CLI or a JDBC SQL client | Submit SQL queries and retrieve results. The Trino Web UI monitors queries but cannot run them. |
| On-demand per-TB data scan billing | Infrastructure-based compute cost | Infrastructure-based costs instead of per-TB query charges, with additional charges for storage and data transfer. Athena Capacity Reservations bill by DPU-hour instead of data scanned. |

The Trino deployment architecture consists of:

* **Coordinator**: Accepts SQL queries, plans their execution, and assigns tasks to workers. The coordinator runs in a dedicated container with worker task execution disabled.
* **Workers**: Two containers that read data through connectors, execute query tasks in parallel, and exchange intermediate results.
* **Iceberg REST Catalog**: Manages namespaces, table registration, and references to current Iceberg metadata. A backing database persists catalog state.
* **Object Storage**: Stores Iceberg data and metadata files independently of the Trino containers.
* **PostgreSQL**: Provides an external data source for federated queries that join PostgreSQL data with Iceberg tables.

## Prerequisites

Before you begin, you need to:

* Have access to a [Linux-based server](https://docs.vultr.com/products/compute/instances/cloud-compute/provisioning) (with at least 4 CPU cores and 8 GB of RAM) as a [non-root user with sudo privileges](https://docs.vultr.com/how-to-create-a-sudo-user-in-linux).
* [Install Docker and Docker Compose](https://docs.vultr.com/how-to-install-docker-on-ubuntu-24-04).
* Provision an [Object Storage subscription](https://docs.vultr.com/products/storage/object-storage/provisioning).
* Create a [DNS A record](https://docs.vultr.com/products/network/dns/management/manage-records) pointing to your server's public IP address (for example, `trino.example.com`).

## Plan the Cluster Layout

This deployment runs a coordinator and two workers as separate containers on a single Linux server, all from the `trinodb/trino:483` image. Each node keeps its configuration in its own `etc/` directory.

1. Create the project directory with subdirectories.

    ```console
    $ mkdir -p ~/trino/{coordinator/etc,worker-1/etc,worker-2/etc,catalog}
    ```

    * `coordinator/etc/`: Holds the configuration for the `trino-coordinator` container, which accepts SQL queries, plans their execution, and assigns tasks to workers.
    * `worker-1/etc/`: Holds the configuration for the `trino-worker-1` container, which executes query tasks and reads data through connectors.
    * `worker-2/etc/`: Holds the configuration for the `trino-worker-2` container, which executes query tasks and reads data through connectors.
    * `catalog`: Holds the connector properties files shared by all three containers.

1. Navigate to the project directory.

    ```console
    $ cd ~/trino
    ```

## Deploy the Iceberg REST Catalog

The Iceberg REST catalog manages table registration and references to Iceberg metadata stored in Object Storage.

1. Create an [Object Storage bucket](https://docs.vultr.com/products/storage/object-storage/management/manage-buckets) named `trino-warehouse` in your subscription. Record the bucket name, endpoint hostname, access key, and secret key.

    > [!NOTE]
    > This guide uses `trino-warehouse` as the bucket name. If you choose a different name, replace `trino-warehouse` with your bucket name wherever it appears in the rest of this guide.

1. Create an environment file.

    ```console
    $ nano .env
    ```

1. Add the following configuration.

    ```ini
    CATALOG_DB_PASSWORD='CATALOG_DB_PASSWORD'
    OBJECT_STORAGE_ENDPOINT=https://OBJECT_STORAGE_ENDPOINT
    OBJECT_STORAGE_REGION='OBJECT_STORAGE_REGION'
    OBJECT_STORAGE_ACCESS_KEY='OBJECT_STORAGE_ACCESS_KEY'
    OBJECT_STORAGE_SECRET_KEY='OBJECT_STORAGE_SECRET_KEY'
    OBJECT_STORAGE_BUCKET=trino-warehouse
    ```

    Replace:

    * `CATALOG_DB_PASSWORD` with a strong password for the catalog database.
    * `OBJECT_STORAGE_ENDPOINT` with your object storage hostname.
    * `OBJECT_STORAGE_REGION` with the first label of the endpoint hostname, such as `ams1` for `ams1.vultrobjects.com`.
    * `OBJECT_STORAGE_ACCESS_KEY` and `OBJECT_STORAGE_SECRET_KEY` with your subscription's S3 credentials.

    Save and close the file.

1. Restrict access to the environment file.

    ```console
    $ chmod 600 .env
    ```

1. Create the Docker Compose file.

    ```console
    $ nano docker-compose.yml
    ```

1. Add the following configuration.

    ```yaml
    services:
      catalog-db:
        image: postgres:17-alpine
        restart: unless-stopped
        environment:
          POSTGRES_DB: iceberg
          POSTGRES_USER: iceberg
          POSTGRES_PASSWORD: ${CATALOG_DB_PASSWORD:?Set CATALOG_DB_PASSWORD in .env}
        volumes:
          - catalog-db-data:/var/lib/postgresql/data
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -U iceberg -d iceberg"]
          interval: 5s
          timeout: 5s
          retries: 12

      iceberg-rest:
        image: tabulario/iceberg-rest:1.6.0
        restart: unless-stopped
        depends_on:
          catalog-db:
            condition: service_healthy
        environment:
          CATALOG_CATALOG__IMPL: org.apache.iceberg.jdbc.JdbcCatalog
          CATALOG_URI: jdbc:postgresql://catalog-db:5432/iceberg
          CATALOG_JDBC_USER: iceberg
          CATALOG_JDBC_PASSWORD: ${CATALOG_DB_PASSWORD:?Set CATALOG_DB_PASSWORD in .env}
          CATALOG_WAREHOUSE: s3://${OBJECT_STORAGE_BUCKET}/
          CATALOG_IO__IMPL: org.apache.iceberg.aws.s3.S3FileIO
          CATALOG_S3_ENDPOINT: ${OBJECT_STORAGE_ENDPOINT}
          CATALOG_S3_PATH__STYLE__ACCESS: "true"
          AWS_ACCESS_KEY_ID: ${OBJECT_STORAGE_ACCESS_KEY}
          AWS_SECRET_ACCESS_KEY: ${OBJECT_STORAGE_SECRET_KEY}
          AWS_REGION: ${OBJECT_STORAGE_REGION}
        ports:
          - "127.0.0.1:8181:8181"

    volumes:
      catalog-db-data:
    ```

    Save and close the file.

    In this configuration:

    * `catalog-db-data`: Preserves catalog database records when you recreate containers.
    * `depends_on`: Waits for PostgreSQL to accept connections before starting the REST catalog.
    * `CATALOG_WAREHOUSE`: Sets the default storage location for Iceberg tables.
    * `CATALOG_S3_ENDPOINT` and `CATALOG_S3_PATH__STYLE__ACCESS`: Configure access to the S3-compatible storage endpoint.

1. Validate the Docker Compose configuration.

    ```console
    $ docker compose config --quiet
    ```

    The command returns no output if the configuration is valid.

1. Start the services in detached mode.

    ```console
    $ docker compose up -d
    ```

1. Verify that services are running.

    ```console
    $ docker compose ps
    ```

    The output shows `Up` with `(healthy)` for the `catalog-db` container and `Up` for the `iceberg-rest` container.

1. Verify that the REST catalog responds.

    ```console
    $ curl --fail --silent --show-error http://localhost:8181/v1/config
    ```

    The endpoint returns a JSON response containing `defaults` and `overrides`.

## Configure the Coordinator and Workers

The coordinator accepts queries and assigns tasks to the workers. Each node uses a separate configuration directory with a unique node ID, while all three nodes share the same environment and discovery URI.

1. Create a `node.properties` file for each node.

    ```console
    $ for node in coordinator worker-1 worker-2; do
        cat > "$node/etc/node.properties" <<EOF
    node.environment=trino
    node.id=$node
    node.data-dir=/data/trino
    EOF
      done
    ```

    Each file uses its node name as the `node.id`. The matching `node.environment` value allows the nodes to join the same cluster.

1. Create the coordinator configuration file.

    ```console
    $ nano coordinator/etc/config.properties
    ```

1. Add the following configuration.

    ```ini
    coordinator=true
    node-scheduler.include-coordinator=false
    http-server.http.port=8080
    discovery.uri=http://trino-coordinator:8080
    ```

    Save and close the file.

    The discovery URI uses the coordinator's Docker Compose service name, `trino-coordinator`, so all three nodes can reach the same discovery service.

1. Create the first worker configuration file.

    ```console
    $ nano worker-1/etc/config.properties
    ```

1. Add the following configuration.

    ```ini
    coordinator=false
    http-server.http.port=8080
    discovery.uri=http://trino-coordinator:8080
    ```

    Save and close the file.

    The worker uses the same discovery URI as the coordinator and executes queries.

1. Copy the worker configuration to the second worker.

    ```console
    $ cp worker-1/etc/config.properties worker-2/etc/config.properties
    ```

    The workers share the same server configuration but retain their separate `node.properties` files.

1. Extract the default JVM configuration from the Trino image.

    ```console
    $ docker run --rm --entrypoint cat trinodb/trino:483 \
        /etc/trino/jvm.config > coordinator/etc/jvm.config
    ```

1. Open the JVM configuration file.

    ```console
    $ nano coordinator/etc/jvm.config
    ```

    Replace the following two lines:

    ```ini
    -XX:InitialRAMPercentage=80
    -XX:MaxRAMPercentage=80
    ```

    With:

    ```ini
    -Xmx2G
    ```

    Save and close the file.

    This sets the maximum heap size of each Trino JVM to 2 GB. Increase the heap allocation for larger workloads while allowing memory to be used outside the JVM heap.

1. Copy the JVM configuration to the first worker.

    ```console
    $ cp coordinator/etc/jvm.config worker-1/etc/jvm.config
    ```

1. Copy the JVM configuration to the second worker.

    ```console
    $ cp coordinator/etc/jvm.config worker-2/etc/jvm.config
    ```

## Deploy Trino with Docker Compose

Docker Compose runs the coordinator and workers on the same network so they can communicate using service names. Each container mounts its own configuration directory and the shared catalog directory.

1. Create the catalog mount point inside each node's configuration directory.

    ```console
    $ mkdir -p coordinator/etc/catalog worker-1/etc/catalog worker-2/etc/catalog
    ```

    These directories allow Docker to mount the shared catalog directory inside each read-only configuration mount.

1. Open the Docker Compose file.

    ```console
    $ nano docker-compose.yml
    ```

1. Add the following services under the existing `services:` block, at the same indentation as `catalog-db` and `iceberg-rest`. Keep the existing services and top-level `volumes:` block unchanged.

    ```yaml
    trino-coordinator:
      image: trinodb/trino:483
      restart: unless-stopped
      mem_limit: 2560m
      ports:
        - "127.0.0.1:8080:8080"
      volumes:
        - ./coordinator/etc:/etc/trino:ro
        - ./catalog:/etc/trino/catalog:ro

    trino-worker-1:
      image: trinodb/trino:483
      restart: unless-stopped
      mem_limit: 2560m
      depends_on:
        - trino-coordinator
      volumes:
        - ./worker-1/etc:/etc/trino:ro
        - ./catalog:/etc/trino/catalog:ro

    trino-worker-2:
      image: trinodb/trino:483
      restart: unless-stopped
      mem_limit: 2560m
      depends_on:
        - trino-coordinator
      volumes:
        - ./worker-2/etc:/etc/trino:ro
        - ./catalog:/etc/trino/catalog:ro
    ```

    Save and close the file.

    Each container mounts its node configuration at `/etc/trino` and the shared connector configuration at `/etc/trino/catalog`. The mounts are read-only. Only the coordinator publishes a host port, bound to localhost.

    The `mem_limit` setting caps each Trino container at 2.5 GB. This leaves 512 MB above the 2 GB JVM heap set in `jvm.config` for memory that Trino uses outside the heap, such as thread stacks and direct buffers. Increase `mem_limit` for each Trino service if your queries need more headroom. A container that restarts with exit code `137` has run out of memory and needs a higher limit. When you increase `-Xmx`, keep `mem_limit` about 25 percent above the heap size.

1. Validate the Docker Compose configuration.

    ```console
    $ docker compose config --quiet
    ```

    The command returns no output if the configuration is valid.

1. Start the coordinator and workers.

    ```console
    $ docker compose up -d trino-coordinator trino-worker-1 trino-worker-2
    ```

1. Verify that services are running.

    ```console
    $ docker compose ps
    ```

    The output displays the containers with an `Up` status.

1. Query the coordinator to verify node registration.

    ```console
    $ docker compose exec trino-coordinator trino \
        --server http://localhost:8080 \
        --user admin \
        --execute "SELECT node_id, node_version, coordinator, state FROM system.runtime.nodes ORDER BY node_id"
    ```

    The output lists three active nodes running version `483`. The node with `true` in the `coordinator` column is the coordinator.

## Configure the Iceberg Catalog Connector

The Iceberg connector connects Trino to the REST catalog and reads table data from Object Storage. The shared catalog file provides the same connection settings to the coordinator and both workers.

1. Open the Docker Compose file.

    ```console
    $ nano docker-compose.yml
    ```

1. Add the following `environment` block under each Trino service.

    ```yaml
    environment:
      OBJECT_STORAGE_ENDPOINT: ${OBJECT_STORAGE_ENDPOINT}
      OBJECT_STORAGE_REGION: ${OBJECT_STORAGE_REGION}
      OBJECT_STORAGE_ACCESS_KEY: ${OBJECT_STORAGE_ACCESS_KEY}
      OBJECT_STORAGE_SECRET_KEY: ${OBJECT_STORAGE_SECRET_KEY}
    ```

    Save and close the file.

1. Create the Iceberg catalog configuration file.

    ```console
    $ nano catalog/iceberg.properties
    ```

1. Add the following configuration.

    ```ini
    connector.name=iceberg
    iceberg.catalog.type=rest
    iceberg.rest-catalog.uri=http://iceberg-rest:8181
    fs.s3.enabled=true
    s3.endpoint=${ENV:OBJECT_STORAGE_ENDPOINT}
    s3.region=${ENV:OBJECT_STORAGE_REGION}
    s3.aws-access-key=${ENV:OBJECT_STORAGE_ACCESS_KEY}
    s3.aws-secret-key=${ENV:OBJECT_STORAGE_SECRET_KEY}
    s3.path-style-access=true
    ```

    Save and close the file.

1. Validate the Docker Compose configuration.

    ```console
    $ docker compose config --quiet
    ```

    The command returns no output if the configuration is valid.

1. Recreate the coordinator and workers to apply the environment variables and load the Iceberg catalog.

    ```console
    $ docker compose up -d --force-recreate trino-coordinator trino-worker-1 trino-worker-2
    ```

1. Check the container status.

    ```console
    $ docker compose ps
    ```

    The output displays all Trino containers with an `Up` status.

1. List the available catalogs.

    ```console
    $ docker compose exec trino-coordinator trino \
        --server http://localhost:8080 \
        --user admin \
        --execute "SHOW CATALOGS"
    ```

    The output lists the `iceberg` and `system` catalogs. If the output shows "Trino server is still initializing", wait a few seconds and run the command again.

## Create and Query Tables

Trino creates Iceberg tables through the REST catalog and stores their data and metadata files in Object Storage.

1. Open an interactive Trino CLI session.

    ```console
    $ docker compose exec trino-coordinator trino \
        --server http://localhost:8080 \
        --user admin
    ```

1. Create a schema in the `iceberg` catalog.

    ```sql
    CREATE SCHEMA iceberg.analytics
    WITH (location = 's3://trino-warehouse/analytics/');
    ```

    Tables in this schema use subdirectories under the `analytics/` prefix in the `trino-warehouse` bucket.

1. Create an Iceberg table for orders.

    ```sql
    CREATE TABLE iceberg.analytics.orders (
        order_id BIGINT,
        customer_id BIGINT,
        order_date DATE,
        amount DECIMAL(10, 2)
    )
    WITH (
        format = 'PARQUET'
    );
    ```

1. Insert sample orders into the table.

    ```sql
    INSERT INTO iceberg.analytics.orders
        (order_id, customer_id, order_date, amount)
    VALUES
        (1, 101, DATE '2026-10-01', 120.00),
        (2, 102, DATE '2026-10-02', 85.50),
        (3, 101, DATE '2026-10-03', 49.99);
    ```

1. Query the table to verify the stored data.

    ```sql
    SELECT order_id, customer_id, order_date, amount
    FROM iceberg.analytics.orders
    ORDER BY order_id;
    ```

    The output displays the three orders with the values inserted in the previous step.

1. Verify the storage location of the table's data files.

    ```sql
    SELECT DISTINCT "$path" AS file_path
    FROM iceberg.analytics.orders;
    ```

    The output displays Parquet file paths beginning with `s3://trino-warehouse/analytics/`, confirming that the queried rows reside in the configured Object Storage bucket.

1. Exit the Trino CLI.

    ```sql
    exit
    ```

## Add a Federated Catalog

The PostgreSQL connector allows Trino to query PostgreSQL tables and join them with Iceberg tables in a single SQL query.

1. Open the environment file.

    ```console
    $ nano .env
    ```

1. Append the following variable. Replace `POSTGRES_SOURCE_PASSWORD` with a strong password for the sample PostgreSQL database.

    ```ini
    POSTGRES_SOURCE_PASSWORD='POSTGRES_SOURCE_PASSWORD'
    ```

    Save and close the file.

1. Open the Docker Compose file.

    ```console
    $ nano docker-compose.yml
    ```

1. Add the following service under the existing `services` block.

    ```yaml
    postgres-source:
      image: postgres:17-alpine
      restart: unless-stopped
      environment:
        POSTGRES_DB: sales
        POSTGRES_USER: demo
        POSTGRES_PASSWORD: ${POSTGRES_SOURCE_PASSWORD:?Set POSTGRES_SOURCE_PASSWORD in .env}
      volumes:
        - postgres-source-data:/var/lib/postgresql/data
      healthcheck:
        test: ["CMD-SHELL", "pg_isready -U demo -d sales"]
        interval: 5s
        timeout: 5s
        retries: 12
    ```

    Append the following entry to the existing `volumes` block.

    ```yaml
    postgres-source-data:
    ```

    Add the following variable to the existing `environment` block of each Trino service. Keep the existing Object Storage variables.

    ```yaml
    POSTGRES_SOURCE_PASSWORD: ${POSTGRES_SOURCE_PASSWORD}
    ```

    Save and close the file.

    PostgreSQL stores its database in a persistent volume. Trino connects to it through the internal Docker network using the `postgres-source` service name.

1. Validate the Docker Compose configuration.

    ```console
    $ docker compose config --quiet
    ```

    The command returns no output if the configuration is valid.

1. Start the `postgres-source` service in detached mode.

    ```console
    $ docker compose up -d postgres-source
    ```

1. Verify that the `postgres-source` container is ready.

    ```console
    $ docker compose ps postgres-source
    ```

    The output shows the container in a `healthy` state.

1. Create the customers table.

    ```console
    $ docker compose exec -T postgres-source psql \
        -U demo -d sales -v ON_ERROR_STOP=1 <<'SQL'
    CREATE TABLE public.customers (
        customer_id BIGINT PRIMARY KEY,
        customer_name VARCHAR(100) NOT NULL
    );
    SQL
    ```

    The output displays `CREATE TABLE`.

1. Populate the customers table.

    ```console
    $ docker compose exec -T postgres-source psql \
        -U demo -d sales -v ON_ERROR_STOP=1 <<'SQL'
    INSERT INTO public.customers (customer_id, customer_name)
    VALUES
        (101, 'Alice'),
        (102, 'Bob');
    SQL
    ```

    The output displays `INSERT 0 2`, confirming that PostgreSQL inserted two rows.

1. Create the PostgreSQL catalog configuration file.

    ```console
    $ nano catalog/postgresql.properties
    ```

1. Add the following configuration.

    ```ini
    connector.name=postgresql
    connection-url=jdbc:postgresql://postgres-source:5432/sales
    connection-user=demo
    connection-password=${ENV:POSTGRES_SOURCE_PASSWORD}
    ```

    Save and close the file.

    The shared catalog directory makes the connector configuration available to the coordinator and both workers.

1. Recreate the Trino containers to apply the environment variable and load the PostgreSQL catalog.

    ```console
    $ docker compose up -d --force-recreate trino-coordinator trino-worker-1 trino-worker-2
    ```

1. Verify that services are running.

    ```console
    $ docker compose ps
    ```

    The output displays all the containers with an `Up` status.

1. Join the Iceberg orders table with the PostgreSQL customers table.

    ```console
    $ docker compose exec trino-coordinator trino \
        --server http://localhost:8080 \
        --user admin \
        --execute "
            SELECT o.order_id, c.customer_name, o.order_date, o.amount
            FROM iceberg.analytics.orders AS o
            JOIN postgresql.public.customers AS c
                ON o.customer_id = c.customer_id
            ORDER BY o.order_id
        "
    ```

    The output displays three orders, with Alice associated with orders `1` and `3`, and Bob associated with order `2`. The query combines data from PostgreSQL and Object Storage through their respective catalogs. If the output shows "Trino server is still initializing", wait a few seconds and run the command again.

## Configure Authentication and Access Control

Password authentication restricts access to users defined in the password file, while HTTPS protects client connections. Resource groups control how many queries can run concurrently and how many can wait in a queue.

### Configure HTTPS and Password Authentication

1. Generate a shared secret for internal node authentication.

    ```console
    $ openssl rand -hex 32
    ```

    Copy the generated value for a later step.

1. Open the environment file.

    ```console
    $ nano .env
    ```

1. Append the following variables.

    ```ini
    TRINO_DOMAIN=trino.example.com
    ACME_EMAIL=admin@example.com
    TRINO_INTERNAL_SECRET='TRINO_INTERNAL_SECRET'
    ```

    Replace:

    * `trino.example.com` with your configured domain.
    * `admin@example.com` with your email address for certificate notifications.
    * `TRINO_INTERNAL_SECRET` with the secret generated earlier.

    Save and close the file.

1. Allow HTTP and HTTPS connections through the firewall. Caddy uses port `80` to obtain the TLS certificate and port `443` to serve Trino.

    ```console
    $ sudo ufw allow 80,443/tcp
    ```

    If a cloud firewall protects the server, allow inbound TCP ports `80` and `443` in it as well.

1. Update the package index.

    ```console
    $ sudo apt update
    ```

1. Install the password-file utility.

    ```console
    $ sudo apt install apache2-utils -y
    ```

1. Create a password file for the `admin` user.

    ```console
    $ htpasswd -B -C 10 -c coordinator/etc/password.db admin
    ```

    Enter and confirm a strong password when prompted. The command stores a bcrypt hash rather than the plaintext password.

1. Create the password authenticator configuration file.

    ```console
    $ nano coordinator/etc/password-authenticator.properties
    ```

1. Add the following configuration.

    ```ini
    password-authenticator.name=file
    file.password-file=/etc/trino/password.db
    ```

    Save and close the file.

1. Open the coordinator configuration file.

    ```console
    $ nano coordinator/etc/config.properties
    ```

1. Append the following settings.

    ```ini
    http-server.authentication.type=PASSWORD
    http-server.process-forwarded=true
    internal-communication.shared-secret=${ENV:TRINO_INTERNAL_SECRET}
    ```

    Save and close the file.

    The forwarded-header setting allows Trino to recognize HTTPS connections terminated by Caddy.

1. Open the first worker's configuration file.

    ```console
    $ nano worker-1/etc/config.properties
    ```

1. Append the following setting.

    ```ini
    internal-communication.shared-secret=${ENV:TRINO_INTERNAL_SECRET}
    ```

    Save and close the file.

1. Copy the updated worker configuration to the second worker.

    ```console
    $ cp worker-1/etc/config.properties worker-2/etc/config.properties
    ```

    Both workers use the same server configuration. Their separate `node.properties` files retain their unique node IDs.

1. Create the Caddy configuration file.

    ```console
    $ nano Caddyfile
    ```

1. Add the following configuration.

    ```ini
    {
        email {$ACME_EMAIL}
    }

    {$TRINO_DOMAIN} {
        reverse_proxy trino-coordinator:8080
    }
    ```

    Save and close the file.

1. Open the Docker Compose file.

    ```console
    $ nano docker-compose.yml
    ```

1. Add the following service under the existing `services:` block, at the same indentation as the Trino services.

    ```yaml
    caddy:
      image: caddy:2.11.9-alpine
      restart: unless-stopped
      ports:
        - "80:80"
        - "443:443"
      environment:
        TRINO_DOMAIN: ${TRINO_DOMAIN}
        ACME_EMAIL: ${ACME_EMAIL}
      volumes:
        - ./Caddyfile:/etc/caddy/Caddyfile:ro
        - caddy-data:/data
        - caddy-config:/config
      depends_on:
        - trino-coordinator
    ```

    Append the following entries to the existing `volumes` block.

    ```yaml
    caddy-data:
    caddy-config:
    ```

    Add the following variable to the existing `environment` block of each Trino service. Keep the existing variables.

    ```yaml
    TRINO_INTERNAL_SECRET: ${TRINO_INTERNAL_SECRET:?Set TRINO_INTERNAL_SECRET in .env}
    ```

    Save and close the file.

    All three nodes receive the same shared secret. Caddy stores its certificates and configuration state in persistent volumes.

### Configure Resource Groups

1. Create the resource group manager configuration file on the coordinator.

    ```console
    $ nano coordinator/etc/resource-groups.properties
    ```

1. Add the following configuration.

    ```ini
    resource-groups.configuration-manager=file
    resource-groups.config-file=/etc/trino/resource-groups.json
    ```

    Save and close the file.

1. Create the resource group definition file.

    ```console
    $ nano coordinator/etc/resource-groups.json
    ```

1. Add the following configuration.

    ```json
    {
      "rootGroups": [
        {
          "name": "global",
          "softMemoryLimit": "80%",
          "hardConcurrencyLimit": 4,
          "maxQueued": 10
        }
      ],
      "selectors": [
        {
          "group": "global"
        }
      ]
    }
    ```

    Save and close the file.

    The selector assigns all queries to `global`. The group allows up to four running queries and ten queued queries. Trino rejects additional queries when the queue is full. The soft memory limit queues new queries when the group exceeds 80 percent of the cluster's query memory.

### Apply and Verify the Configuration

1. Validate the Docker Compose configuration.

    ```console
    $ docker compose config --quiet
    ```

    The command returns no output if the configuration is valid.

1. Recreate the Trino containers and start Caddy.

    ```console
    $ docker compose up -d --force-recreate trino-coordinator trino-worker-1 trino-worker-2 caddy
    ```

1. Verify that services are running.

    ```console
    $ docker compose ps
    ```

    The output displays all the containers with an `Up` status.

    > [!NOTE]
    > After you enable password authentication, Trino rejects the earlier `--server http://localhost:8080` CLI commands with `Authentication over HTTP is not enabled`. Connect through the HTTPS endpoint, as the following steps do.

1. Verify that the query endpoint rejects requests without credentials. Replace `trino.example.com` with your configured domain.

    ```console
    $ curl --silent --show-error \
        --output /dev/null \
        --write-out '%{http_code}\n' \
        --data 'SELECT 1' \
        https://trino.example.com/v1/statement
    ```

    The output displays `401`, confirming that the HTTPS endpoint requires authentication.

1. Verify that Trino assigns queries to the configured resource group. Replace `trino.example.com` with your configured domain.

    ```console
    $ docker run --rm -it trinodb/trino:483 trino \
        --server https://trino.example.com \
        --user admin \
        --password \
        --execute "
            SELECT resource_group_id
            FROM system.runtime.queries
            WHERE resource_group_id IS NOT NULL
            LIMIT 1
        "
    ```

    The command prompts for the administrator password. Enter it to run the query. The output displays `"[global]"`.

## Verify the Deployment

Verify query execution independently of Object Storage, confirm node registration, and review completed queries in the Trino Web UI.

1. Run a query that does not access external data sources. Replace `trino.example.com` with your configured domain.

    ```console
    $ docker run --rm -it trinodb/trino:483 trino \
        --server https://trino.example.com \
        --user admin \
        --password \
        --execute "SELECT 1"
    ```

    The command prompts for the administrator password. Enter it to run the query. The query returns `1`, confirming that Trino can execute a query without reading from Object Storage or PostgreSQL.

1. Verify that the coordinator and both workers are active. Replace `trino.example.com` with your configured domain.

    ```console
    $ docker run --rm -it trinodb/trino:483 trino \
        --server https://trino.example.com \
        --user admin \
        --password \
        --execute "
            SELECT node_id, node_version, coordinator, state
            FROM system.runtime.nodes
            ORDER BY node_id
        "
    ```

    The command prompts for the administrator password. Enter it to run the query. The output displays `coordinator`, `worker-1`, and `worker-2`, each running version `483` with an `active` state.

### Access the Trino Dashboard

1. Open `https://trino.example.com` in a web browser. Replace `trino.example.com` with your configured domain.

1. Log in with the username `admin` and the password created earlier. Verify that **Active workers** show `2`.

    ![Trino dashboard showing two active workers](https://assets.vultrdevrel.com/docs-main-doc-assets-1/2697/7e553888-e87b-4b8f-b645-9a1bf5cd1889.png)

1. Under **Query details**, select **FINISHED** from the **State** dropdown. Verify that the `SELECT 1` query and the node-registration query appear with a `FINISHED` state.

1. Click the query ID above a completed query's entry to open its details.

    ![Trino completed query entry showing the query ID](https://assets.vultrdevrel.com/docs-main-doc-assets-1/2697/0b7552db-3b54-4a15-8e03-644a132d6dce.png)

1. On the **Overview** tab, verify that the query state is `FINISHED` and the **Resource group** is `global`. Review the session information and execution statistics.

    ![Trino query Overview showing the FINISHED state and global resource group](https://assets.vultrdevrel.com/docs-main-doc-assets-1/2697/8e1c132e-e00e-4412-9c8d-b1463dd45e36.png)

## Migrate from Amazon Athena to Trino

Amazon Athena resolves tables through the AWS Glue Data Catalog, reads data from Amazon S3, and enforces access with AWS IAM and Lake Formation. This deployment replaces those layers with an Iceberg REST catalog, Vultr Object Storage, and Trino authorization rules. Migrating involves updating SQL queries and clients, transferring catalog definitions and data, and recreating access policies. Because Athena and Trino handle cost, scaling, and result caching differently, review the operational differences before switching workloads.

### Query Migration

Athena SQL engine version 3 builds on Trino, so most standard SQL queries carry over with few changes. AWS does not publish a fixed upstream Trino version that matches engine version 3. Test queries against Trino `483`, particularly date and timestamp functions, type conversions, and AWS-specific statements.

* **Catalog references**: Update fully qualified table names to use the Trino catalog and schema, such as `iceberg.analytics.orders`.
* **Table definitions**: Rewrite Athena DDL using Trino syntax. Athena table properties and partition definitions do not all map directly to Iceberg properties.
* **SQL clients**: Replace the Athena JDBC or ODBC connection with a Trino-compatible driver and configure the HTTPS endpoint and authentication credentials.
* **Federated connectors**: Athena federated Lambda connectors do not carry over. Replace each one with the equivalent Trino connector, such as the PostgreSQL connector used in this guide.
* **Validation**: Compare query results, data types, and execution times before moving production workloads.

Refer to the [Athena engine version 3 documentation](https://docs.aws.amazon.com/athena/latest/ug/engine-versions-reference-0003.html) when reviewing engine-specific behavior.

### Catalog Migration

Export table definitions from AWS Glue using `aws glue get-tables --database-name <database>`. The command returns tables for a single database, so run it for each database you plan to migrate. Record each table's columns, partition configuration, storage location, and format. Use these definitions to recreate the corresponding schemas and tables in the Iceberg REST catalog.

Existing tables require different migration paths:

* **Iceberg tables**: Retrieve the current metadata location from the Glue table definition. Register the table in the destination catalog using its existing Iceberg metadata. Trino provides the `system.register_table` procedure, which requires `iceberg.register-table-procedure.enabled=true` in the Iceberg catalog configuration. Refer to the [Iceberg connector documentation](https://trino.io/docs/current/connector/iceberg.html#register-table) for registration options.
* **Non-Iceberg tables**: You cannot import Glue definitions for ordinary Parquet, ORC, CSV, or JSON tables directly as Iceberg tables. Read the source through a suitable connector and write it into newly created Iceberg tables, or use a supported conversion tool.
* **Views**: Recreate views using Trino SQL and update their catalog references.

Registering a table makes its existing metadata available to the catalog. It does not copy data or convert the table format.

### Data Storage Considerations

Copy data from Amazon S3 to Object Storage using a tool that supports separate source and destination endpoints, such as `rclone`. Preserve object prefixes and partition layouts during the transfer.

Iceberg metadata and manifest files can contain absolute paths to data files. Copying a table to a different bucket or prefix does not update those references. Use an Iceberg-aware relocation tool or rewrite the table into the destination location before registering it. Changing only the catalog's warehouse location does not relocate existing tables.

Pause source writes or use a consistent snapshot during the final transfer. Compare row counts and representative query results between Athena and Trino before switching clients. Include partition-level counts and aggregates such as total order amounts when validating larger tables.

### Access Control Migration

AWS IAM and Lake Formation permissions do not carry over to this deployment. Lake Formation row and column access policies have no drop-in replacement, so recreate and test them using Trino authorization rules.

* **File-based access control**: Define permissions for catalogs, schemas, tables, and columns in a JSON rules file. Trino also supports row filters and column masks. Refer to the [file-based access control documentation](https://trino.io/docs/current/security/file-system-access-control.html).
* **Apache Ranger**: Use the [Ranger access control integration](https://trino.io/docs/current/security/ranger-access-control.html) when policies require centralized administration across services.
* **Storage permissions**: Replace AWS storage credentials with Object Storage credentials that grant only the required access to the specified bucket.

Password authentication identifies users, and resource groups limit query resources. Neither replaces table authorization. Test permitted and denied operations for each user before granting access to migrated data.

### Things to Consider During Migration

* **Cost model**: Athena's standard SQL pricing depends on the amount of data scanned. This deployment incurs compute costs while the server runs, as well as storage and data transfer charges. Compare expected scan volume and operating costs before assuming savings.
* **Query result reuse**: This deployment does not provide Athena-style query result reuse. Repeated queries execute again.
* **Scaling**: Docker Compose does not provide automatic worker scaling or scale-to-zero. Size the server and resource groups for the expected workload.
* **Catalog operations**: Back up the REST catalog's PostgreSQL database and protect the Iceberg metadata in Object Storage. Catalog availability, upgrades, and recovery become your responsibility.
* **Query interface**: The Trino Web UI monitors queries but does not run them. Provide analysts with the Trino CLI or a SQL interface such as DBeaver or Apache Superset.
* **Storage compatibility**: Trino documents compatibility testing against AWS S3 and MinIO. Validate reads, writes, and table operations against your Object Storage endpoint before migrating production data.

## Conclusion

You have deployed Trino on a single Linux server using Docker Compose as a self-hosted alternative to Amazon Athena. The deployment includes a coordinator and two workers, an Iceberg REST catalog backed by Object Storage, federated PostgreSQL queries, HTTPS with password authentication, and resource groups. For additional connectors and configuration options, refer to the [official Trino documentation](https://trino.io/docs/483/).