> For the complete documentation index, see [llms.txt](https://v2.dataos.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://v2.dataos.info/references/october2026/engine-guide/athena/connect-to-athena.md).

# Connect to Athena

Configure Athena gateways, local development, and production deployment for Vulcan.

With IAM access in place, this is the connect stage. Configure the gateway that lets Vulcan reach Athena, then validate it before writing models.

{% hint style="info" %}
**Flagged for review:** the source manual had two steps here that don't carry over to any other converted engine page: a generic "install Vulcan" step with an unresolved wheel-link placeholder ("TBD: attach the wheel link from your DataOS distribution channel"), and a TPCH-style QA-fixture bootstrap (`before_all`/`after_all` creating `sales`/`raw` databases and an anomalies audit table). Both are left out here as generic/internal content rather than Athena-specific guidance; the wheel link is still unresolved wherever the shared install doc lives.
{% endhint %}

## Set up authentication

Store credentials in `.env`. Never commit them. The IAM principal needs the grants from [Permissions and grants](https://v2.dataos.info/references/october2026/engine-guide/athena/permissions-and-grants.md), and its keys must belong to the same account (or a trusted cross-account catalog) as the Glue databases you target.

```bash
# .env
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
AWS_REGION=ap-south-1
ATHENA_WORK_GROUP=primary
ATHENA_S3_STAGING_DIR=s3://your-athena-results/
ATHENA_SCHEMA_NAME=<glue-database>
ATHENA_CATALOG_NAME=awsdatacatalog
ATHENA_S3_WAREHOUSE_LOCATION=s3://your-data-bucket/vulcan-warehouse/
```

## Connection options

Set these options under `gateways.<name>.connection` in `config.yaml`.

| Option                  | Description                                       | Required                                        |
| ----------------------- | ------------------------------------------------- | ----------------------------------------------- |
| `type`                  | Engine type name. Must be `athena`.               | Yes                                             |
| `aws_access_key_id`     | AWS access key for the Vulcan service principal.  | Yes                                             |
| `aws_secret_access_key` | AWS secret key.                                   | Yes                                             |
| `region_name`           | AWS region. Must match the workgroup and buckets. | Yes                                             |
| `work_group`            | Athena workgroup to run queries in.               | Yes                                             |
| `s3_staging_dir`        | Athena query output location.                     | Yes                                             |
| `schema_name`           | Glue database (schema).                           | Yes                                             |
| `catalog_name`          | Glue catalog, default `awsdatacatalog`.           | No                                              |
| `s3_warehouse_location` | Base `s3://` prefix for managed table data.       | Yes; required for managed table materialization |

## Example gateway config

```yaml
default_gateway: athena   # or set explicitly on model_defaults / gateways

model_defaults:
  dialect: athena
  start: "2025-01-01"

gateways:
  athena:
    connection:
      type: athena
      aws_access_key_id: "{{ env_var('AWS_ACCESS_KEY_ID') }}"
      aws_secret_access_key: "{{ env_var('AWS_SECRET_ACCESS_KEY') }}"
      region_name: "{{ env_var('AWS_REGION', default='ap-south-1') }}"
      work_group: "{{ env_var('ATHENA_WORK_GROUP', default='primary') }}"
      s3_staging_dir: "{{ env_var('ATHENA_S3_STAGING_DIR') }}"
      schema_name: "{{ env_var('ATHENA_SCHEMA_NAME', default='<glue-database>') }}"
      catalog_name: "{{ env_var('ATHENA_CATALOG_NAME', default='awsdatacatalog') }}"
      s3_warehouse_location: "{{ env_var('ATHENA_S3_WAREHOUSE_LOCATION') }}"
    # Optional: external Postgres for plan/interval state
    # state_connection:
    #   type: postgres
    #   host: "{{ env_var('STATESTORE_HOST', default='localhost') }}"
    #   port: "{{ env_var('STATESTORE_PORT', default='5432') }}"
    #   user: vulcan
    #   password: vulcan
    #   database: statestore
    # state_schema: athena_retail
```

{% hint style="warning" %}
`s3_warehouse_location` is required for managed table materialization. Without it, the adapter cannot resolve warehouse paths.
{% endhint %}

{% hint style="info" %}
The Athena adapter can persist Vulcan's own state in **Iceberg** tables inside the warehouse by default. Alternatively, enable `state_connection` (Postgres) and `state_schema` for multi-project isolation on shared infrastructure.
{% endhint %}

## Local development

Athena has no local container to run. Development points directly at real AWS resources (a dev workgroup, Glue database, and S3 prefixes), not at a containerized stand-in. The only thing you might run locally is the optional Postgres state store, if you've opted out of the default Iceberg state tables.

Validate the connection:

```bash
vulcan migrate        # initializes state (Iceberg and/or Postgres per config)
Vulcan info
vulcan plan           # dry run against Glue; should succeed with no errors
```

If `vulcan plan` succeeds, you'll see models staged for creation.

## Production deployment

Production deployment typically projects the instance secret directly into the Vulcan resource's environment.

Apply resources in this order:

```
Athena instance secret → Git secret → config.yaml (in repo) → Vulcan domain resource (deploy.yaml)
```

| Manifest                               | Purpose                                  | Key fields                                                              |
| -------------------------------------- | ---------------------------------------- | ----------------------------------------------------------------------- |
| `athena-secret.yaml` (instance secret) | Stores AWS + Athena settings             | `AWS_*`, `ATHENA_*` keys                                                |
| `secret-git-sync.yaml`                 | Repo credentials                         | `GITSYNC_USERNAME`, `GITSYNC_PASSWORD`                                  |
| `config.yaml`                          | Project config; gateway `type: athena`   | See example above                                                       |
| `deploy.yaml` (Vulcan resource)        | Workflow + API; projects secret into env | `engine: athena`, `use.projection.secrets`, `repo.*`, `workflow`, `api` |

Example projection block (secret → env on the Vulcan resource):

```yaml
spec:
  engine: athena
  use:
    projection:
      secrets:
        - id: <workspace>:athena-secret
          contextAlias: athena
      projections:
        envVars:
          - key: AWS_ACCESS_KEY_ID
            template: "{{ secrets['athena'].AWS_ACCESS_KEY_ID | base64_decode }}"
          # ... remaining ATHENA_* and AWS_SECRET_ACCESS_KEY, AWS_REGION
```

### Before you deploy checklist

* [ ] Universal prerequisites complete (Python, Docker if using Postgres state, CLI, repo)
* [ ] `.env` has AWS + Athena variables (mirror the secret keys above)
* [ ] Optional: Postgres statestore if using `state_connection`
* [ ] `inputs.yaml` / `before_all` bootstrap aligns with your source layout
* [ ] `vulcan migrate` and `vulcan plan` succeed
* [ ] Instance secret applied (`<workspace>:athena-secret` or equivalent)
* [ ] Vulcan resource sets `engine: athena`, `repo`, `use.projection` env vars, `workflow`, `api.replicas`
* [ ] Git secret applied for repo sync
* [ ] Cron `timezone: UTC` in production; `endOn` ≥ 1 to 2 years out; `concurrencyPolicy: Forbid`

### Next step

After connection configuration is ready, choose a model strategy in [Materialization behavior](https://v2.dataos.info/references/october2026/engine-guide/athena/materialization-behavior.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://v2.dataos.info/references/october2026/engine-guide/athena/connect-to-athena.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
