# Amazon Athena

Amazon Athena is a serverless query service that makes it easy to analyze data stored in Amazon S3. As a scheduler environment in Paradime, Athena enables deploying dbt™ in production with [Bolt](https://docs.paradime.io/app-help/documentation/bolt).

{% hint style="warning" %}
**IP RESTRICTIONS**

Make sure to allow traffic from one of the Paradime IPs in your firewall depending on the data location selected.

👉 See also: [Paradime IP addresses](https://docs.paradime.io/app-help/developers/ip-restrictions).
{% endhint %}

### Setup Instructions

1. Click **Settings** in the top menu bar of the Paradime interface to access **Account Settings**
2. In the left sidebar, click "**Connections**"
3. Click "**Add New**" next to the **Bolt Schedules** section
4. Select "**Amazon Athena**"
5. In the **Profile Configuration** field, add at least these required parameters. For additional configuration options, see the [Profile Fields Reference](#profile-fields-reference) section.

```yaml
s3_staging_dir: s3://analytics-staging/athena/query-results/   # Store query results
s3_data_dir: s3://analytics-data/raw/                          # Raw data location
s3_data_naming: table_unique                                   # Unique table naming
region_name: us-west-2                                         # AWS region
database: analytics_prod                                       # Production database
num_retries: 3                                                 # Query retry attempts
```

{% hint style="info" %}
After adding the configuration, ensure it's properly formatted using a YAML formatter like [YAML Formatter](https://jsonformatter.org/yaml-formatter).
{% endhint %}

6. Provide a dbt™ **Profile Name** (This should match with the profile name set in your `dbt_project.yml`).
7. In the **Target** field, enter "**`prod`**". This is the default target your dbt™ project will use for your [Bolt Schedules.](https://docs.paradime.io/app-help/documentation/bolt)
8. The "**Schema**" field is pre-configured, but you can change it to specify the schema where dbt will build objects.
9. The "**Threads**" value is pre-configured to 1, but you can adjust this number to specify how many parallel operations your dbt project can run.

***

### Example Profile Configuration

<figure><img src="https://2337193041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHET0AD04uHMgdeLAjptq%2Fuploads%2Fpxrzv9wuLpwtCVPAQUsQ%2Fimage.png?alt=media&#x26;token=84d2bb33-cf3c-4024-b226-68e5c641a0c6" alt=""><figcaption></figcaption></figure>

***

### Profile Fields Reference

<table><thead><tr><th width="201">Field</th><th width="192">Description</th><th width="165">Example</th><th width="101">Default</th><th width="121">Required</th></tr></thead><tbody><tr><td>s3_staging_dir</td><td>S3 bucket location where Athena will store query results</td><td><code>s3://my-bucket/athena/staging/</code></td><td>None</td><td>✅</td></tr><tr><td>s3_data_dir</td><td>S3 bucket location where Athena will store table data</td><td><code>s3://my-bucket/athena/data/</code></td><td>None</td><td>✅</td></tr><tr><td>s3_data_naming</td><td>Naming convention used when writing to S3</td><td><code>table_unique</code></td><td>None</td><td>❌</td></tr><tr><td>region_name</td><td>AWS region where your Athena instance is located</td><td><code>us-east-1</code></td><td>None</td><td>✅</td></tr><tr><td>database</td><td>Name of the Athena database to connect to</td><td><code>analytics_db</code></td><td>None</td><td>✅</td></tr><tr><td>schema</td><td>Default schema where dbt will build objects. <br><br>This is configured in the UI "Schema" field</td><td><code>reporting</code></td><td>None</td><td>✅</td></tr><tr><td>aws_profile_name</td><td>Profile name from your AWS shared credentials file</td><td><code>default</code></td><td>None</td><td>❌</td></tr><tr><td>threads</td><td>Number of concurrent operations. <br><br>This is configured in the UI "Threads" field</td><td><code>4</code></td><td><code>1</code></td><td>❌</td></tr><tr><td>num_retries</td><td>Number of times to retry a failed query before failing</td><td><code>3</code></td><td><code>5</code></td><td>❌</td></tr></tbody></table>

***

{% hint style="info" %}

#### Important Notes

* All S3 paths should end with a forward slash (/)
* The AWS credentials can be configured through environment variables, AWS credentials file, or IAM roles
  {% endhint %}
