How Metabase connects to Athena and why IAM roles matter
A team that wants governed Metabase dashboards over data in Amazon Athena needs a connection its security team will accept. The Athena connection uses Metabase's Athena driver with three settings: an AWS region, a workgroup and an S3 staging directory, and the preferred credential is an IAM role rather than stored access keys. The Athena connection is available on the open source edition, so the connection itself does not require a paid plan. What does depend on the plan is everything around it, such as SSO sign-in and row and column level permissions, which the pillar pricing facts place in Pro and Enterprise. This page explains what each connection setting controls, the IAM policy Metabase needs to query Athena and the Glue catalog, how to use an instance or task role instead of long-lived keys, and how to verify and operate the connection afterward.
The region and workgroup decide where queries run and how Athena's usage and query history are scoped, so confirm them with the team that owns the Athena environment before you touch Metabase. The S3 staging directory is where Athena writes query results, which means the Metabase identity needs write access to that location, and that bucket should be one the data owners have approved for result storage. Metabase recommends a dedicated AWS service account with only the permissions needed to run Athena, so treat the principal as a purpose-built identity rather than a shared developer role. Ask your security team to review the policy against the example in the Metabase Athena documentation before it is attached.
Stored access keys are the weaker option because they live in the application database or environment files, do not expire on their own and must be rotated by hand. The Athena driver can fetch session credentials from the IAM role configured for the Metabase host, such as an IAM role for ECS tasks or an instance profile on a virtual machine. With a role, the credential is short-lived and attributable to the workload in CloudTrail, which is the evidence most access reviews ask for. The trade-off is that the role must be attached to the right compute, so the deployment design and the connection design need to be settled together. Confirm with your AWS administrators which role mechanism your hosting platform supports before you commit to the approach.
What you need before configuring the Athena connection
The Athena connection depends on pieces that sit in three places: your Metabase deployment, your AWS account, and the network between them. Settling these items first means the connection form asks for values you already know, and failures point to a single component rather than a chain of guesses.
A running self-hosted Metabase
Have a self-hosted Metabase instance running and reachable by your administrators before you add a database. Confirm the Metabase version you run against the version support page, since the end-of-life date of your release determines when you must upgrade. Also confirm that the application database is PostgreSQL for production, not the embedded H2 file, so the connection settings you save are backed up with the rest of the instance.
Version supportAn application database with a backup
Metabase stores connection settings, saved questions and permissions in its application database, not in Athena. Confirm that you have a recent backup of that database before changing connection settings or upgrading, because a restore is the recommended rollback path. Record which backup you would restore from so that a failed change can be reversed quickly.
The AWS region and catalog
Choose the AWS region where your Athena workgroup and tables live, and confirm which AWS data catalog holds the tables you want Metabase to query. Glue is the usual catalog, but confirm this in your own account, because the catalog determines which databases and tables appear in Metabase and which IAM permissions you grant.
An Athena workgroup
Identify the Athena workgroup Metabase will submit queries to. The workgroup controls the query results location, encryption settings and any data usage limits your team has set. Ask your AWS administrators whether a dedicated workgroup exists for Metabase, since sharing a workgroup with other tools makes query cost and access harder to separate later.
An S3 staging directory
Create or pick an S3 location where Athena writes query results, and where Metabase reads them back. The bucket policy and the IAM role must both allow writes to this path, and the bucket should not be shared with unrelated data. Confirm the bucket's encryption and lifecycle rules with your security team, because query results can contain the same sensitive data as the source tables.
Network paths to AWS endpoints
Confirm that the host running Metabase can reach the Athena, Glue, S3 and IAM endpoints in your chosen region, directly or through approved egress or a VPC endpoint. Firewalls and proxies that block these hosts produce errors that look like credential problems, so test connectivity from the Metabase host before troubleshooting the IAM policy.
Configuring the Athena connection step by step
This sequence takes a self-hosted Metabase from no Athena access to a verified connection that runs queries under a dedicated, narrowly scoped AWS identity. Each step ends with a check you can run before moving on.
Confirm the Athena inputs with your data team
Before touching AWS, get the AWS region where the Athena workgroup lives, the workgroup name, and the S3 bucket and prefix Athena uses for query results. Confirm which Glue catalog and databases the analysts need, and whether any tables are encrypted with a customer managed KMS key. Done means you have these values written down and the data owner has agreed which databases are in scope. Metabase's Athena connection asks for the region, workgroup and S3 staging directory, so missing one of them will block the rest of the steps.
Create a dedicated IAM role for Metabase
In the AWS account that owns the Athena workgroup, create an IAM role used only by Metabase, not a shared administrator or a personal user. Metabase recommends a dedicated AWS service account with only the permissions needed to run Athena. Name the role so it is clearly tied to this Metabase instance. Done means the role exists with no permissions attached yet, and its trust relationship allows the compute where Metabase runs (for example, the ECS task or EC2 instance profile) to assume it.
Attach a least-privilege policy for Athena, Glue and S3
Attach a customer managed policy that grants only the Athena, Glue and S3 actions the connection needs, scoped to the named workgroup, the Glue databases in scope, and the staging bucket and prefix. Metabase's Athena documentation includes an example policy with Athena and Glue permissions, so start from that and remove anything you cannot justify. Check it with the IAM policy simulator or by running a query from the role. Done means the simulator allows the reads and writes Metabase needs and denies actions outside the scope.
Enter region, workgroup and staging directory in Metabase
In the Metabase admin panel, add an Athena database and enter the AWS region, the workgroup and the S3 staging directory you confirmed earlier. Leave the credential fields for the next step so you can choose the method deliberately. Done means the form saves the connection details without validation errors. If the save fails on region or workgroup, check the spelling against the AWS console before changing the policy, since most early failures are typos in these fields.
Choose the credential method and remove stored keys
Select the option that lets the Athena driver obtain session credentials from the IAM role attached to the Metabase runtime, such as an ECS task role or instance profile, instead of entering an access key and secret. Metabase's Athena driver can fetch session credentials from the configured IAM role. If you must use stored keys in a pilot, record that as a temporary exception with an owner and a removal date. Done means the Metabase form holds no long-lived access key for this connection, and the runtime role is the only identity in use.
Run the connection test and confirm the role in use
Use the connection test in the database settings. A successful result means Metabase reached Athena and the Glue catalog with the role you attached. To confirm the identity, check the AWS CloudTrail events for the Athena StartQueryExecution call and verify the assumed role name matches the dedicated role, not a personal user. Done means the test passes and the events show the expected role.
Sync the schema and run a known-table query
Trigger a schema sync, then open a question against a table whose row count you already know from Athena or the data owner. A query returning the expected rows confirms that the Glue catalog, workgroup and results bucket all work together. Then, as a negative test, query a table outside the policy scope and confirm the query is denied with an access error. Done means the in-scope table returns the expected rows and the out-of-scope table is refused.
Record the configuration and hand over the role
Write down the role name, policy version, workgroup, region, staging location and the two test results, and store them with the platform runbook. Tell the data owner which databases are visible through Metabase, since Athena access is governed by the IAM policy, not by Metabase groups alone. Done means a second engineer could rebuild the connection from the record, and the owner has signed off the scope.
Instance roles, task roles or stored access keys
When Metabase runs on an EC2 instance, the preferred approach is to attach an IAM role to the instance through an instance profile. The Athena driver can fetch short-lived session credentials from the configured IAM role, so no long-lived access key needs to sit in Metabase's configuration or on disk. Access is granted to the role, and the team controls it in one place in AWS.
- Attach a dedicated role: Create a role used only by the Metabase host, with the Athena and Glue permissions from the Athena connection docs and nothing unrelated.
- Confirm the metadata path: Check that the instance's credential source is reachable from the Metabase process, especially if container networking or hop limits block it.
- Leave the access key field empty: When the role supplies credentials, avoid storing keys in the connection settings.
- Scope the trust: Restrict who can assume or modify the instance role, since anyone with control of the host inherits its permissions.
- Review CloudTrail: Athena queries will appear under the role's session, so confirm the audit trail names the role your team expects.
Confirm with your platform team that the EC2 image, launch template and instance metadata settings allow the role to be attached and used by the Metabase service account.
On ECS, the equivalent is a task role. The Metabase container receives temporary credentials for the role defined in its task definition, and the Athena driver can use that role to obtain session credentials. Separating the task execution role, which pulls images and writes logs, from the task role, which queries data, keeps the query permissions narrow.
- Define a task role: Set the Metabase task role in the task definition and grant only the Athena, Glue and S3 staging permissions it needs.
- Keep the execution role separate: Do not reuse the execution role for data access, because it has a different purpose and usually broader pull and log permissions.
- Pin the environment: Confirm the service runs on a platform version that supports task roles in your configuration.
- Use separate services per environment: A staging Metabase should not share a task role with production, so a test connection cannot read production buckets.
- Check the S3 staging path: Athena results land in the staging directory, so the role also needs write access to that prefix.
Confirm with your container platform owners how the task definition is versioned and approved, since a changed role ARN changes what every query can reach.
A self-hosted server outside AWS, such as an on-premises machine or a host at another cloud provider, may have no way to receive an IAM role. In that case a dedicated IAM user with an access key may be the only practical option. It works, but the key becomes a secret your team must generate, store, rotate and revoke for the life of the connection.
- Use a dedicated IAM user: Create a user used only for Metabase, with the minimal Athena and Glue policy from the Athena docs, and no console access.
- Store the secret securely: Keep the key in a secrets manager or a restricted file readable only by the Metabase service account, not in version control or shared runbooks.
- Plan rotation: Define how often keys are rotated, who performs the change, and how Metabase is restarted or reconfigured afterward.
- Watch for exposure: Monitor key usage and alert on access from unexpected networks, since a stored key works from anywhere it is copied.
- Record the decision: Document why a role was not possible, so the exception is reviewed when hosting changes.
Confirm with your security team whether your policy allows static keys for analytics tools, and whether a federated or workload identity option is available from your hosting provider.
The right option depends on how your hosting platform assigns roles, not on a general preference. Some environments support instance roles or task roles natively, while others, including some hybrid or on-premises setups, cannot. Confirm the facts with the people who own the host before writing the policy, because the answer determines whether any key is stored at all.
- Ask how identity is delivered: Find out whether the host can present an IAM role to the Metabase process, and through which metadata or task endpoint.
- Check network reachability: Confirm the Metabase process can reach the credential endpoint and that no proxy or firewall rule blocks it.
- Ask about exceptions: Establish whether stored keys are permitted, who approves them, and how long an exception lasts.
- Test the path: Run a test query after each change and confirm which identity appears in the audit logs.
- Document the owner: Name the team responsible for role changes, key rotation and the review date.
Confirm these points with your platform team and your AWS account owner before the Athena connection is configured in Metabase.
Writing an IAM policy Metabase can live with
The IAM policy for Metabase's Athena connection should grant only what Athena needs to run queries, read table metadata from the Glue Data Catalog, and read and write the S3 staging location. Metabase's Athena documentation includes an example policy with Athena and Glue permissions, and it is the right starting point. Treat it as a template, not a finished document. Before use, replace every placeholder with your own region, account, bucket, catalog and workgroup names, and remove any action your setup does not need. Confirm the current action list against the documentation and AWS's own Athena and Glue references, since permission requirements change with driver and Metabase versions.
Give Metabase a dedicated IAM role that no other application or engineer shares. A shared role makes it impossible to tell which system ran a query in CloudTrail, and it means a change made for one workload can quietly widen Metabase's access. Scope the S3 permissions in two places. The staging directory needs read and write access, because Athena writes query results there and Metabase reads them back. Each source bucket behind a catalog needs read access limited to the prefixes Metabase should query. Keep the staging location in its own bucket or prefix so that query output is never mixed with source data. Athena workgroup permissions should be limited to the workgroup Metabase uses, so the role cannot run queries under other workgroups with different result locations or limits.
Review the finished policy with the team that owns your data catalog, not only the team that runs Metabase. Ask them to confirm which databases and tables are visible through the Glue Data Catalog and whether any table uses encryption with a customer managed KMS key, which would need an additional decrypt permission on that key. Test the policy in a non-production account or with a sample workgroup first, then run a query from each dashboard group that depends on the connection. Access denied errors during that test usually point to a missing Glue or S3 action or a bucket prefix that is narrower than the queries require.
Mapping Metabase settings to AWS resources
This table maps each Metabase Athena connection field to the AWS object it refers to, who usually provides it, and where to confirm the value. Read it before the connection form is filled in, so the region, workgroup, staging bucket and role come from the right owner. The main takeaway is that the staging directory and the role are separate resources, and the policy must cover both.
| Metabase field | AWS object it refers to | Who provides it | Where to confirm |
|---|---|---|---|
| Region | The AWS Region where the Athena workgroup and query results live | Cloud platform or data team | Athena console region selector in the account running queries |
| Workgroup | The Athena workgroup that runs Metabase queries and holds query settings | Data platform team | Athena console, Workgroups page, in the same region |
| S3 staging directory | The S3 location where Athena writes query results for Metabase to read | Cloud platform team | S3 console and the workgroup's query result location setting |
| Credential method | How Metabase obtains AWS credentials: stored access keys or an IAM role | Security team with cloud platform team | Decision recorded in the design, checked against the IAM role attached to the host |
| Role | The IAM role Metabase assumes or inherits, such as an ECS task role | Cloud platform or security team | IAM console, Roles page, and the role attached to the running service |
| IAM policy | Athena and Glue permissions, plus S3 access to the staging location | Security team writes, cloud team applies | Metabase Athena documentation example, reviewed against the account's own resource ARNs |
| Dedicated service account | A non-human principal limited to the permissions Athena queries need | Security team | IAM console, confirming no console login and no unrelated permissions |
How the Metabase server reaches Athena, Glue and S3
The flow starts at the Metabase server, which authenticates to AWS either with an attached IAM role, such as a task or instance role, or with a stored access key. Its requests reach the Athena endpoint in the chosen region, which runs queries in the named workgroup. Athena reads table metadata from Glue and scans data in S3, and writes query results to the staging results directory in S3. Check that the role or key is the only credential path, that the workgroup and staging location are the ones you intend, and that everything sits inside the AWS account boundary you control.
Metabase reaches Athena, Glue and S3 from inside one AWS account boundary.
Where database routing applies to Athena
Database routing for Athena only works between different connections, so a single Athena connection cannot be split into separate visibility zones. Metabase's database routing feature sends a user's query to a destination database based on the user's group, but for Athena the destinations have to be distinct connections that differ by something real, such as the S3 bucket, the IAM role or the catalog. Two groups that both point at the same Athena connection will see the same tables, and no routing rule inside Metabase changes that. Before you design groups and permissions, decide which data sets must be isolated and map each one to a connection boundary.
The practical consequence is that teams with different data visibility may need separate Athena connections, each with its own IAM role and, where the data differs, its own bucket or Glue catalog. A finance group that can read ledger tables and a marketing group that cannot would each get a connection whose role grants only the Glue and S3 permissions that group needs. The role is then the enforcement point, not the Metabase group alone. Confirm with your AWS administrator that the roles are scoped to the right Glue databases and S3 prefixes, and test each connection by signing in as a user from each group.
The mechanics of configuring routing, including how the destination is chosen and how it appears in the admin settings, are covered in Metabase's database routing documentation. Read it before you create the second connection, and confirm against your Metabase version that the routing options match what the documentation describes. Plan the connection count early, because each additional connection is another role, another staging location and another set of credentials to review and rotate.
Hardening the Athena connection
The Athena connection gives Metabase a path into your data lake, so its permissions, storage access and audit trail matter as much as the query setup. The cards below cover the controls to put around the connection and the AWS features to confirm in your own account before go-live.
Dedicated least-privilege role
Metabase recommends a dedicated AWS service account with only the permissions needed to run Athena. Create a role used by no other workload, and attach the Athena and Glue actions the connection needs, scoped to the workgroup, catalog and databases Metabase should query. Confirm the exact actions against the example policy in Metabase's Athena docs, and test the policy with the queries your dashboards run.
Athena connection docsRole credentials instead of stored keys
Metabase's Athena driver can fetch session credentials from the configured IAM role, such as an IAM role attached to an ECS task. Where your Metabase runs on AWS compute that supports a task or instance role, use it and avoid storing access keys in the Metabase admin settings. Confirm that your hosting platform supplies the role to the Metabase container and that no static keys remain in environment files or configuration.
Restricted S3 staging prefixes
Athena writes query results to the S3 staging directory you configure in Metabase. Give the Metabase role write and read access only to a dedicated results prefix, and deny access to the raw data prefixes except where the query needs them. Confirm bucket policies, encryption settings and lifecycle rules for the staging prefix in your own account, since result files may contain sensitive query output.
Workgroup limits and query logging
Athena workgroups can separate Metabase traffic from other analysts and carry settings that matter for control, such as query result locations and, where available, data usage limits. Ask your AWS team which workgroup controls and query logging options apply to your account and region, and confirm them before relying on them. Keep the Metabase workgroup separate from interactive analyst workgroups so its activity is easy to isolate.
Who can edit the connection
Anyone who can change the Athena database connection in Metabase can point it at a different region, workgroup, bucket or role. Limit database administration to a small group of Metabase administrators, and review that group when people change roles. Database routing only works between different connections, so plan separate connections for separate data access needs and confirm how each one is permissioned in Metabase.
Database routing docsCloudTrail review for Athena activity
AWS CloudTrail can record API calls made by the Metabase role, including Athena query execution and Glue metadata reads, if a trail is enabled for your account. Set up a recurring review that checks the role's activity for unexpected regions, workgroups or query patterns. Confirm in your account that the trail covers the relevant regions and that logs are retained and protected according to your policy.
Common Athena connection failures and fixes
This table lists the failures most often seen when a self-hosted Metabase connects to Athena, with the probable cause and fix for each. Read it by matching the error you see to the row, then checking the policy and driver settings named in the fix before changing anything else.
| Failure | Probable cause | Fix |
|---|---|---|
| Wrong region | The region field does not match the region where the Athena workgroup, Glue catalog and S3 data live | Set the region to the one shown for the workgroup in the AWS console, then retest the connection |
| Workgroup the role cannot use | The IAM policy does not allow Athena actions on the configured workgroup, or the workgroup name is misspelled | Confirm the workgroup name exactly, then add it to the Athena resource list in the policy |
| Missing Glue catalog permissions | The role can run queries but cannot read Glue databases and tables, so Metabase finds no schemas to sync | Add the Glue read actions listed in the Metabase example policy for the catalog and databases in scope |
| S3 staging directory not writable | Athena writes query results to the staging bucket, and the role lacks write or list access on that prefix | Grant the role put, get and list access on the staging directory path, and confirm the bucket is in the same region |
| Role not attached to the task or instance | Metabase runs with no IAM role on its ECS task or EC2 instance, so the driver has no credentials to fetch | Attach the role to the task definition or instance profile, then confirm the container or host can reach the instance metadata endpoint |
| Expired or stored keys rejected | Static access keys in the connection settings were rotated, deactivated or are no longer valid for the account | Replace stored keys with the instance or task role where possible, or generate a new key pair and update the connection |
| Access denied on a permitted query | The query touches a database or table outside the policy scope, or the role is in a different account than the data | Compare the failing database and table with the policy resources, and confirm the account ID matches the catalog |
Questions teams ask before connecting Athena
Does connecting Metabase to Athena require a paid plan?
No. The Athena connection is available on the open source edition of Metabase, so a self-hosted instance can query Athena without a paid license. The paid question is what surrounds the connection. According to the Metabase pricing page, SSO, row and column level permissions, multi-tenant data segregation and usage analytics and auditing are included only in the Pro and Enterprise plans. If your Athena data needs per-user row or column restrictions or sign-in through your identity provider with SAML or OIDC, plan for Pro or Enterprise. Confirm current plan contents on the Metabase pricing page before you budget.
How long does an Athena connection take to set up, and what drives it?
The connection itself is a short configuration: region, workgroup and an S3 staging directory, followed by a test query. The effort comes from what surrounds it. The main drivers are how many AWS accounts and workgroups are involved, whether the IAM policy must be reviewed by a security team, whether instance or task roles already exist, and how many data sources and users need access. Ask any partner to break its estimate into discovery, IAM design, configuration, testing and handover so you can see which parts scale with your environment.
What does the work need from our AWS and data owners?
Expect to need three groups of input. Your AWS administrators provide the account, region, workgroup and S3 bucket for query results, and approve an IAM policy. Your data owners confirm which Athena databases and tables Metabase may read, along with the Glue catalog entries behind them. Your security team decides whether Metabase uses a dedicated service account with only the permissions needed to run Athena, and how the Metabase host receives credentials. Agreeing these owners before the build starts usually removes the most common delays.
Can one internal engineer set up the Athena connection alone?
Often yes for a single account and a test database, if that engineer has administrator access to the AWS account, can edit the Metabase configuration and can run queries against the workgroup. It becomes harder when the IAM policy needs review, when several workgroups or catalogs must be separated, or when the engineer must also handle SSO and permissions. Metabase's Athena documentation includes an example IAM policy with Athena and Glue permissions, which gives a starting point, but it still needs to be narrowed to your resources. Decide whether that review sits with your own team or a partner before you start.
What should a partner quote include for the Athena connection?
A written quote should list the scope in concrete terms:
- The Athena regions, workgroups, S3 staging locations and Glue databases in scope
- The IAM policy design, including whether an ECS task role or instance role supplies credentials and whether any stored access keys remain
- Database routing decisions, since Metabase's database routing only works between different connections such as different buckets, roles or catalogs
- Verification steps, handover documentation and who is responsible for each step
Ask which items are one-time and which recur, such as access reviews or Metabase upgrades. DeployOpen plans engagements as fixed scope with agreed deliverables and timelines, and provides a quote from that written scope.
Will a Metabase upgrade break the Athena connection?
A Metabase upgrade does not change your AWS side, but it does change the Metabase side, so test the connection as part of each upgrade. Upgrades run application database migrations automatically, and the docs recommend backing up the application database first. Also check that the Athena driver and your IAM role still behave as expected after the upgrade. If something fails, rollback is done by restoring the pre-upgrade application database backup, which is the recommended method, or by running the migrate down command with the newer JAR. Confirm the upgrade steps against the Metabase upgrade documentation before scheduling.
Do we need stored access keys for Athena?
Not necessarily. Metabase's Athena driver can fetch session credentials from the configured IAM role, for example IAM roles for ECS tasks, so the instance or task running Metabase can avoid storing long-lived access keys. Metabase also recommends a dedicated AWS service account with only the permissions needed to run Athena. Confirm with your security team which option fits your hosting model, because the choice affects rotation, audit trails and who can read the Metabase configuration.
How DeployOpen scopes and supports an Athena connection
DeployOpen plans the Athena connection as part of a self-hosted Metabase deployment inside your own AWS accounts. We agree the region, workgroup, S3 staging directory, IAM role model and access boundaries in writing first, then build and document the connection so your cloud and security teams can review it.
How we scope
- Confirm which AWS accounts, regions, Athena workgroups and S3 staging buckets the Metabase instance will query.
- Agree whether Metabase runs on ECS task roles, EC2 instance roles or another compute platform you control.
- Define the Glue catalogs, databases and tables in scope, and which permissions the dedicated AWS service account may hold.
How we build
- Create the IAM role and least-privilege policy for Athena and Glue access, then test it against the agreed workgroup.
- Configure the Athena connection to use the attached role rather than stored access keys, and verify the session credentials resolve.
- Review database routing needs, noting that routing only works between separate connections such as different buckets, roles or catalogs.
How we hand over
- Deliver the IAM policy, trust relationships, connection settings and a runbook your cloud team can audit and reproduce.
- Document the verification steps, including test queries, denied-access checks and the evidence captured for each step.
- Walk through rotation, role changes and offboarding of the service account with your platform and security owners.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ongoing support, Metabase upgrades and continuous testing of the connection are available as a retainer.
- Confirm with your team which Metabase and Athena driver versions your environment will run before the written scope is signed.

