Open-source alternative to Athena Federated Query

Athena federated query runs through Lambda-based connectors billed per TB scanned, while Trino ships native connectors for PostgreSQL, MySQL, Kafka and many others that you run in your own infrastructure. This page maps the sources, the trade-offs and the security model for each.

On this page

Replacing Athena federated query with Trino connectors

If your Athena workloads reach operational databases or streams through Lambda-based connectors, Trino covers most of those sources with built-in connectors that run in your own infrastructure, but each source needs its own confirmation of version support, pushdown behavior and authentication before you cut over. Athena's engine is built with Trino, so the query language and most SQL behavior carry over. The main change is who runs the connector code and where the credentials live. Today, an Athena data source connector is a Lambda function that your AWS account owns and that Athena invokes, and the connector's billing sits on top of Athena's per-TB-scanned charge with a 10 MB minimum per query. In Trino, the connector is a plugin loaded by the coordinator and workers, so its configuration lives in catalog property files on your cluster.

Start with an inventory. For each federated source, list the connector, the database or topic it reaches, the account or service identity it uses, and whether the data is read-only. Trino's connector list includes PostgreSQL, MySQL, MongoDB, Oracle, SQL Server, OpenSearch, ClickHouse, BigQuery, Redshift and Snowflake, among 37 connectors, but Kafka is not on the list in the Trino documentation, so confirm that streaming sources need a different path. Store database passwords in a secrets system and reference them from catalog configuration rather than embedding them in files. Trino supports password file, LDAP, OAuth 2.0, Kerberos, certificate and JWT authentication for users, and file-based, Apache Ranger or Open Policy Agent access control, so decide which identity each catalog uses and who may query it. Then compare the Lambda IAM roles you have today with the database accounts you will create, because the new accounts should have the minimum grants each catalog needs.

Test before you switch. Run the same federated queries in Athena and Trino against a copy of production data, compare row counts and types, and record which queries rely on connector-specific behavior. Confirm with each connector's documentation how it handles pushdown and whether writes are permitted, since the Snowflake connector, for example, supports inserts and CREATE TABLE AS only for one database per catalog. Plan for the operational load that Lambda used to hide: Trino's coordinator, worker capacity and connection limits on source databases, along with monitoring and an upgrade path. Ask your Trino provider or implementation partner to write down the catalog configuration, credential rotation process and access review schedule before go-live.

Which Athena federated sources map to Trino connectors

This table pairs each common Athena federated source with the Trino connector that can reach it, the Athena Lambda connector it replaces, and coverage notes. Read the last column as a checklist, since read and write support and pushdown behavior vary by connector and release, so confirm each one against the current Trino connector documentation before planning. The main takeaway is that a Trino connector runs inside your own cluster without a per-query Lambda hop, but it still needs its own credentials, network path and tuning.

Federated sourceTrino connectorAthena connector it replacesCoverage notes to confirm
PostgreSQLPostgreSQL connector, built inAthena Lambda connector for PostgreSQLConfirm read and write support and which predicates push down for your Trino version.
MySQLMySQL connector, built inAthena Lambda connector for MySQLConfirm write statements and pushdown limits for joins and aggregations against current docs.
SQL Server and OracleSQL Server and Oracle connectors, built inAthena Lambda connectors for SQL Server and OracleConfirm write support and pushdown per connector, since each has its own limits in Trino.
Redshift and BigQueryRedshift and BigQuery connectors, built inAthena Lambda connectors for Redshift and BigQueryConfirm whether writes are supported and how each handles pushdown and credentials for your project.
SnowflakeSnowflake connector, one database per catalogAthena Lambda connector for SnowflakeSupports INSERT and CREATE TABLE AS per Trino docs; confirm limits and Arrow read behavior for your version.
ClickHouseClickHouse connector, built inAthena Lambda connector for ClickHouse, if usedConfirm write support, type mapping and pushdown against current Trino docs before relying on them.
MongoDB and OpenSearchMongoDB and OpenSearch connectors, built inAthena Lambda connectors for MongoDB and OpenSearchDocument-to-table mapping is a design step; confirm nested field handling and write support.
KafkaKafka connector, built in (confirm current status)Athena Lambda connector for KafkaConfirm the connector is still listed, its read behavior and message decoding options before any migration.

Trino, ClickHouse and PostgreSQL as federated query options

Athena's federated queries depend on Lambda connectors, so each source adds a connector to build, patch and bill. The options below cover the three engines most teams compare when moving federation in-house, and each one fits a different mix of sources, tables and operational load.

Trino for multi-source federation

Trino is the default choice when one SQL statement must join a warehouse, a transactional database and lake tables. Its Apache-2.0 codebase ships connectors for sources such as PostgreSQL, MySQL, MongoDB, Oracle, SQL Server, BigQuery, Redshift and Snowflake, so the Lambda layer Athena uses is replaced by connectors inside your own cluster. Check each connector's version and authentication settings against the Trino docs before you promise the same coverage Athena gives today.

Connectors listed
37
Trino connectors

Trino needs storage and a catalog

Trino does not load data into its own storage. A Trino lakehouse therefore needs separate object storage for Parquet or ORC files and a table catalog such as an Iceberg REST catalog, Hive Metastore or AWS Glue. Budget for these as components of their own, with their own backups, access policies and upgrades. Ask your team which catalog holds table definitions today, because that decides what must be migrated first.

ClickHouse for analytical sources

ClickHouse fits when the sources are analytical tables and the workload is repeated scans or dashboards. It can read files in S3 and other stores through table functions, and it runs well as a fast query layer over data you load on a schedule. It is weaker as a general federation engine, so joins against many different transactional systems usually belong in Trino. Confirm which external table functions and engines your version supports before designing around them.

PostgreSQL as a source

PostgreSQL is usually a source that Trino or ClickHouse reads, not the engine that federates the query. Its PostgreSQL License permits self-hosting without fees, and its supported major versions set your upgrade calendar. Federated reads run on the same primary or replica that serves your application, so check replica placement and statement timeouts before analysts start running large joins.

Current major version
18
PostgreSQL versioning policy

PgBouncer under heavy federated load

Many federated queries open many short connections to the same PostgreSQL source, which can exhaust connection slots and slow the application. PgBouncer pools those connections in front of the database and limits how many reach it at once. Test pool modes against the way Trino opens sessions, and confirm that the pooler, the database and any read replica all have monitoring and clear ownership.

PgBouncer project

Authentication and access control per source

Each federated source keeps its own login, so the security model is spread across engines. Trino supports password file, LDAP, OAuth 2.0, Kerberos, certificate and JWT authentication, with file-based, Apache Ranger or Open Policy Agent access control. PostgreSQL offers SCRAM, certificate, LDAP and OAuth methods. Map which service account each source uses and who can reach it, because an overly broad account in the federation layer exposes every joined table.

How the security model changes for each federated source

For PostgreSQL, MySQL, Oracle and SQL Server, Trino opens a connection with a database account defined in a catalog properties file, so the database decides how that account is verified. Athena's Lambda connectors run under an IAM execution role and typically retrieve database credentials at runtime, so the trust boundary sits in AWS identity policies. With Trino, the boundary moves to the database role granted to the Trino service account.

  • PostgreSQL methods: PostgreSQL documents password, GSSAPI, SSPI, LDAP, RADIUS, certificate, PAM and OAuth client authentication, selected per host, database and user in pg_hba.conf.
  • SCRAM over MD5: PostgreSQL 18 deprecated MD5 password authentication in favor of SCRAM, so new roles should use SCRAM and roles created under MD5 should have their passwords reset before the upgrade.
  • TLS and certificates: Use hostssl entries so the Trino nodes must connect encrypted, and confirm which client certificate options your JDBC driver supports.
  • Credential storage: Restrict read access to the catalog files with file system permissions, or move the password into an external secrets mechanism if your deployment supports it.
  • Least privilege: Create a read-only role per federated catalog with SELECT only on the schemas Trino needs, because database grants still apply under every Trino query.

Check that each catalog maps to a role with the smallest grants and that pg_hba.conf accepts the account only from the Trino nodes.

How a federated query travels through Trino to each source

A query starts at a client inside the network, passes an authentication and access control check at the Trino coordinator, and is planned there before workers read from each source through its own connector. PostgreSQL is reached through the PostgreSQL connector, Kafka through the Kafka connector, and S3-backed Iceberg tables through the Iceberg connector with a table catalog such as Hive Metastore or an Iceberg REST catalog. The trust boundary sits around the whole cluster, so each source should accept connections only from the worker network, using service accounts with the least privilege needed. Check which checkpoints your authentication and access control setup covers for each connector.

Query path from client through the Trino coordinator and workers to each source.

Running Trino beside Athena during the cutover

Most teams cannot move every federated source in one change window. During the cutover, some queries will still run through Athena Lambda connectors while others move to Trino catalogs, so the two paths need clear boundaries.

Keep catalogs separate by source

Give each Trino catalog one owner and one source system, such as a PostgreSQL catalog for an operational database or an Iceberg catalog for lakehouse tables. Name catalogs after the source so that a query reader can see where data comes from. Avoid one catalog that mixes unrelated systems, because a single misconfigured connector then affects every query that uses it. Record which Athena data source each Trino catalog replaces so the mapping stays auditable.

Avoid duplicate credentials

Each source should have one service account per engine, scoped to the tables it needs, and stored in your secrets manager instead of inside Lambda environment variables or Trino catalog files copied by hand. During the overlap, list every credential that Athena connectors and Trino catalogs both use, then rotate them once the Athena path is retired. Ask your security team whether the database audit log can tell the two engines apart by user name.

Route saved queries by source

Tag each saved query or dashboard with the systems it reads, then move them in groups rather than one at a time. A query that joins an S3 table with a PostgreSQL table is a good candidate to move only after both sides are reachable from Trino. Keep a routing table that maps each query identifier to its engine and owner, and update it as each group changes. Queries that read only S3 data can usually move to Trino with less change than cross-source joins.

Confirm permissions on both paths

Athena access often comes from IAM policies, Lake Formation grants and workgroup settings, while Trino uses its own authentication and access control. Before a group of queries moves, confirm that the same users see the same rows and columns on the Trino side, and that no user gains access through the new path. Trino supports file-based access control, Apache Ranger and Open Policy Agent, so confirm which one your organization will use before the first move.

Query commercial warehouses from Trino

Trino's connector list includes Snowflake, BigQuery and Redshift, so a query can join a self-hosted Iceberg table with a table in a commercial warehouse during migration. This helps when data still lives in a warehouse that the team has not yet moved. Check the connector's credential storage, the network path from your Trino workers to the warehouse, and who pays the warehouse compute charge for queries that Trino sends.

Trino connectors

Watch for cross-engine differences

Athena and Trino share a query language, but results can still differ on type handling, time zones, null ordering and view definitions. Compare row counts and sample results for each migrated query against Athena output before retiring the original. Keep the Athena path available until the comparison passes for the agreed set of queries, and confirm with your data owners which differences they will accept.

Moving federated sources from Lambda connectors to Trino

This sequence moves each federated source from an Athena Lambda connector to a native Trino catalog, with least-privilege access, secrets outside function settings, and tested results before the old connector is retired. Each step ends with a check you can confirm before moving on.

  1. Inventory every Athena data source

    Start by listing each data source registered in Athena, including its Lambda connector function, the catalog name that queries reference, the source system type and version, the database account it uses, and the network path it takes. Export the connector configuration from the Lambda console or infrastructure code, and record which saved queries, views and dashboards depend on each catalog. The data platform team and the owner of each source system should review the list together. The step is done when every catalog name has an owner, a source system and a dependency list.

  2. Confirm the Trino connector and its limits

    For each source, check the Trino connector documentation for that system and confirm that it supports the read operations your queries use, plus any writes your pipelines depend on. Note the differences that matter in practice: which predicates and aggregations are pushed down to the source, how data types map, and whether the connector writes at all. Record the Trino release you will deploy and confirm the connector is available in it. The step is done when each source has a written note of supported reads, writes, type mappings and pushdown behavior, reviewed by the team that owns the queries.

  3. Create catalogs with least-privilege accounts

    Create a dedicated read-only database account for each source, granting only the schemas and tables that the existing queries use, and create one Trino catalog file per source on the coordinator and workers. Where a connector supports it, set connection pooling and timeouts in the catalog properties. Use separate accounts for any pipeline that writes. Confirm that the Trino access control rules restrict which users can see each catalog. The step is done when each catalog connects with its own account, a test query returns rows from each source, and the accounts cannot reach tables outside their grants.

  4. Move secrets out of Lambda settings

    Lambda connectors often keep database passwords in function environment variables. Move each credential into a secrets store that your platform team controls, then reference it from the Trino catalog through the mechanism your deployment supports, such as a Kubernetes secret mounted into the pods or a file on the nodes with restricted permissions. Rotate the passwords after the move so the old values no longer work, and confirm that no credential appears in version-controlled catalog files. The step is done when the Lambda environment settings no longer hold live credentials and Trino starts with secrets loaded from the new location.

  5. Port queries that use federated catalog names

    Athena queries reference federated sources through catalog names such as the connector name used in the data source. Update each saved query, view, and pipeline so it references the matching Trino catalog and schema, and check the SQL for functions or syntax that differ between Athena and Trino. Keep a mapping table from old names to new names so the change can be reviewed. Run the ported queries in a staging Trino cluster next to Athena. The step is done when every inventoried query runs in Trino with a documented mapping and every syntax difference has a fix.

  6. Test pushdown and results against sources

    For each source, compare Trino results with the output of the same query run through the Athena connector, using row counts, checksums on key columns, and a sample of aggregate values. Check the query plans in Trino to confirm which filters and aggregations are pushed to the source system and which are computed in Trino, since large unfiltered reads can put load on production databases. Run the heaviest dashboard queries and watch the source database's connection count and load. Keep a record of each comparison. The step is done when results match for the agreed test set and the source owner accepts the load profile.

  7. Run both paths in parallel with a rollback

    Keep the Lambda connectors active while business users and pipelines move to Trino. Route one dashboard or pipeline at a time to Trino, and keep the matching Athena query ready as the fallback. If results diverge, the owner switches the affected query back to the Athena catalog and the team investigates before trying again. Record each switch and its reason. Confirm that the rollback path works by testing it once before the cutover. The step is done when every query has run in Trino for an agreed observation period with no unresolved differences, and the rollback has been exercised.

  8. Retire Lambda connectors and their IAM roles

    After the parallel run ends and no inventoried query references the old catalog names, disable the Lambda connectors first, keep their configuration exported for the audit trail, and then delete the functions. Remove the IAM roles and resource policies that allowed Athena to invoke them, and revoke any spill bucket permissions the connectors used. Check the Athena data source list and the audit logs for any remaining references before the removal is final. The step is done when no Lambda connector, role or spill bucket remains for federated sources and the audit log shows no further invocations.

What the cost of Trino federation includes

The main cost change is that Athena's per-terabyte charge is replaced by fixed infrastructure and operations. Athena bills federated queries through Lambda-based connectors, and those Lambda charges disappear once Trino reads PostgreSQL, MySQL or other sources through its own connectors. What remains is the Trino cluster itself: coordinator and worker compute, sized for the concurrency and join volume your federated workloads produce, plus the monitoring, catalog and on-call time needed to keep it running. Ask any provider or integrator to size the coordinator and workers from your query profile, not from a generic node count, and to state whether the quote assumes a dedicated coordinator for a cluster of your expected size.

Source databases carry a cost that does not appear on the Trino line. Every federated query pushes predicates and reads rows from your PostgreSQL or MySQL primaries, so a dashboard that once ran through Lambda may now load a production database directly. Plan for added read replicas or a reporting database for heavy federated sources, and confirm who pays for them. If you enable fault-tolerant execution, the TASK retry policy needs an exchange manager spooling intermediate data to S3, Azure Blob Storage, Google Cloud Storage or HDFS, so object storage capacity and request charges become a new recurring line. Confirm the spooling bucket size assumptions and retention settings in the quote, because they grow with the largest query you allow.

Upgrades are a recurring staff cost. Trino publishes releases several times a year, and the release notes list the cadence you will be following, so upgrade testing, rollout and rollback should be budgeted as an ongoing task rather than a one-time project. Ask for the named roles in the quote (platform engineer, DBA for each source, security reviewer for the authentication and access control setup) and for the hours each role is expected to spend per month and per upgrade. Also ask whether monitoring, alerting and the first-line support rotation are included, and whether an ongoing support retainer covers upgrades after the initial handover.

Questions teams ask before replacing Athena federated query

Can Trino reach every data source that Athena federated query reaches?

Not necessarily, so confirm your source list one by one. Trino ships with 37 connectors according to its documentation, including PostgreSQL, MySQL, MongoDB, Oracle, SQL Server, Redshift, BigQuery, Snowflake, ClickHouse, Kafka-backed and lakehouse sources such as Iceberg, Delta Lake and Hive. Athena federated queries run through Lambda-based connectors, which can cover sources that have no native Trino connector. For each source, check the Trino connector list, confirm the connector supports the reads and writes you need, and identify any source that would need a custom connector or a staging copy. Ask your vendor or implementation partner to produce this mapping before committing to a timeline.

What does a federated query migration require from the team?

The team needs a current inventory of federated catalogs, the Lambda connectors behind them, the queries and views that depend on them, and the credentials each connector uses. Then it needs owners for four areas: the Trino cluster and its catalogs, the network paths to each source, the access model in Trino's authentication and access control options, and testing that compares query results against Athena. Engineers should be comfortable with SQL dialect differences, catalog configuration files and Kubernetes or Linux server operations. Confirm with your own security and database teams which sources require change approval, because each catalog change usually touches a database account or firewall rule.

How long does a source migration take, and what changes the answer?

Duration depends mainly on the number of sources, how complex each one is, and how many queries depend on each. A single PostgreSQL catalog with a few saved queries is a different job from a dozen sources with custom Lambda logic, shared views and strict change control. Other drivers include whether source database owners must approve new read accounts, how much query rewriting is needed, and how much validation the business requires. No duration is supplied for this migration, so ask any provider for a written, source-by-source plan with dependencies, and check it against your own change calendar and test windows.

Can our own team do this migration without outside help?

Yes, many teams can, provided they have the skills listed above and time to test. Trino's deployment documentation covers a coordinator plus workers layout, a 64-bit Linux system, a 64-bit Java runtime, and a Kubernetes deployment guide using Helm, so the platform work is documented. The harder parts are usually source-specific: credential rotation, network segmentation, query porting and proving results match. An outside partner can take fixed-scope work on any of these, such as planning, implementation, hardening and documentation, with deliverables agreed in writing before work starts. Decide which parts your team owns, which it hands over, and who runs the cluster after go-live.

How do credentials and network access change when Trino replaces Athena connectors?

With Athena, each federated connector is a Lambda function with its own execution role and network configuration. With Trino, each catalog is a configuration file on the cluster that holds the connection details, so credentials become a secret handled by your cluster and secrets process. Trino documents authentication by password file, LDAP, OAuth 2.0, Kerberos, certificates and JWT, and access control that is file-based, through Apache Ranger or through Open Policy Agent. Network access moves from Lambda subnets to the Trino coordinator and worker network paths, so source firewalls and database allowlists must be updated. Ask your security team to review least-privilege read accounts, secret storage, and audit logging for every source before cutover.

How does fault-tolerant execution affect long federated jobs?

By default, Trino's fault-tolerant execution is off, so a failed worker can fail the whole query. Trino supports a QUERY retry policy and a TASK retry policy. The TASK policy is recommended for large batch queries and needs an exchange manager that spools intermediate data to S3, Azure Blob Storage, Google Cloud Storage or HDFS. That spooling storage is an extra component to size, secure and pay for. Long federated jobs that pull large volumes from transactional databases also put load on the source, so confirm with source owners which schedules are acceptable. Test your longest federated query under failure conditions before retiring the Athena path.

What does the cost comparison depend on for federated queries?

Athena charges per terabyte scanned, which applies to federated queries as well as S3 queries, and Lambda connector runtime adds its own cost. The Athena cost page of this site covers that model in detail. A self-hosted Trino cluster costs the servers or Kubernetes nodes, the catalog and monitoring tools, the spooling storage if fault-tolerant execution is enabled, and the people who operate it. Query volume, the number of sources, and how often you rescan the same source decide which model is cheaper. Ask any quote to itemize infrastructure, one-time migration work, recurring support, and upgrades, so you can compare it with your current Athena invoices.

Does Trino upgrade and patching fit our change process?

Trino publishes numbered releases with dated release notes, so teams should plan a recurring upgrade cycle and test each catalog after every upgrade. Confirm the Java runtime requirement for the version you intend to run, because Trino's deployment documentation sets a minimum Java version that changes over time. Keep a staging cluster that mirrors your catalogs so connector behavior can be checked before production. Ask your provider or internal team who owns upgrades, how regression tests are run, and how rollback is handled, and write those answers into your operating procedures.

Where Trino federation does not replace Athena

Trino federation does not replace every Athena federated source one for one, so the first task is to check each source against the current Trino connector documentation rather than assuming parity. Connectors differ in how far they go beyond reads. Some are read-only, some allow inserts or table creation but not updates or deletes, and some expose only a single database per catalog. The Trino connector documentation lists the connectors and their write support, and the Snowflake connector page, for example, states that it accesses one Snowflake database per catalog. Any Athena workflow that writes back to a source, or that joins several databases on one server inside a single query, needs a specific check against the connector version you plan to run.

Sources without a Trino connector remain a gap. Athena's Lambda-based connectors are a different extension mechanism, and a custom internal system with no published Trino connector means you must either write and maintain a Trino plugin, export the data to object storage, or keep that query on its original path. Pushdown is the second risk. Filters, projections, aggregations and limits that Athena or Trino push into a source database determine how many rows cross the network and how much work the source does. Pushdown support varies by connector and by data type, so a query that was cheap under Athena can move far more data under Trino. Run representative queries with EXPLAIN against each source and compare rows read before you commit to a cost model.

Lakehouse tables are the third gap. Trino does not store data itself, so any table you move out of Athena's S3 model into Iceberg or Delta Lake needs object storage, a table catalog such as an Iceberg REST catalog, AWS Glue or a Hive Metastore, and a decision on who owns maintenance jobs such as compaction and snapshot expiry. Plan these as recurring operational work, and confirm each catalog option against the Trino Iceberg connector documentation and your own environment, since supported write operations and format versions are listed there and change with releases.

How DeployOpen scopes federated query replacement

DeployOpen plans and implements self-hosted Trino inside your own cloud accounts, data centers or air-gapped networks, so federated sources, catalogs and access rules are reviewed before any connector goes live. Each engagement starts from a written scope that names the sources you need to reach and the controls your security team must review.

How we scope

  • Inventory every Athena federated connector, the source it reaches and the Lambda role it uses today
  • Map each source to a Trino connector, noting where a connector is missing or needs a different driver
  • Agree in writing which sources, catalogs, authentication methods and access control rules are in scope
  • Confirm with your database owners which connector versions and network paths they will approve

How we build

  • Deploy the Trino cluster on Linux with a coordinator and workers, using the Helm guide where Kubernetes is the target
  • Configure one catalog per source with credentials held in your secrets manager, not in plain configuration files
  • Set up authentication through your identity provider and access control through file-based rules, Apache Ranger or Open Policy Agent
  • Test queries across sources for correctness, permissions and failure behavior, then review results with your security team

How we hand over

  • Deliver architecture, network flow and catalog diagrams showing where each federated query reads data
  • Provide runbooks for adding a catalog, rotating credentials, upgrading Trino and recovering a failed node
  • Document the access control model, audit logging setup and evidence your compliance team can review
  • Train your platform and data teams on operating the cluster and on the differences from Athena connectors

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts
  • Ongoing support, Trino upgrades and continuous testing are available as a retainer
  • Ask any quote to itemize the number of sources, environments and access control models included in scope
  • Confirm with DeployOpen which Trino release line and upgrade cadence your retainer covers

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.