# Amazon Athena

## Set up an Amazon Athena data connection

When inside a workbook, click **View** > **Databases**, then click the **+** icon and follow the on-screen instructions. For more information on how to configure Amazon Athena and how to generate access keys, click [here](https://docs.aws.amazon.com/athena/latest/ug/what-is.html). Make sure the IAM user associated with the credentials has write access to the specified output bucket/folder. The output folder is used to write results of your query to and is ideally separated from the main data in the bucket.

Note: the output bucket should be an s3 url, meaning it should start with `s3://`

<figure><img src="/files/TJhaRiZLXU3xXayZ5OJ6" alt=""><figcaption></figcaption></figure>

For detailed instructions, see [Connect your data to DataLab](/connect-to-data/connect-your-data-to-workspace.md).

## Query the database

You can now query Amazon Athena with a [SQL cell](/work/sql-cell.md). Select it in the **Select source** dropdown in the top left corner of a SQL cell, or select the sample Amazon Athena connection.

<figure><img src="/files/DBCa2T458ehtVbq7a0ky" alt=""><figcaption><p>Example of a SQL cell using the <code>MyAthena</code> connection. The query result is available as <code>df1</code>.</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://datalab-docs.datacamp.com/connect-to-data/athena.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
