Skip to main content

Connect Amazon Athena

Your environment(s) must be on a supported release track to use the Amazon Athena connection.

Connect dbt to Amazon's Athena interactive query service to build your dbt project. The following are the required and optional fields for configuring the Athena connection:

FieldOptionDescriptionTypeRequired?Example
AWS region nameregion_nameAWS region of your Athena instanceStringRequiredeu-west-1
Database (catalog)databaseSpecify the database (Data catalog) to build models into (lowercase only)StringRequiredawsdatacatalog
AWS S3 staging directorys3_staging_dirS3 location to store Athena query results and metadataStringRequireds3://bucket/dbt/
Athena workgroupwork_groupIdentifier of Athena workgroupStringOptionalmy-custom-workgroup
Athena Spark workgroupspark_work_groupIdentifier of Athena Spark workgroup for running Python modelsStringOptionalmy-spark-workgroup
AWS S3 data directorys3_data_dirPrefix for storing tables, if different from the connection's s3_staging_dirStringOptionals3://bucket2/dbt/
AWS S3 data naming conventions3_data_namingHow to generate table paths in s3_data_dirStringOptionalschema_table_unique
AWS S3 temp tables prefixs3_tmp_table_dirPrefix for storing temporary tables, if different from the connection's s3_data_dirStringOptionals3://bucket3/dbt/
Poll intervalpoll_intervalInterval in seconds to use for polling the status of query results in AthenaIntegerOptional5
Query retriesnum_retriesNumber of times to retry a failing queryIntegerOptional3
Boto3 retriesnum_boto3_retriesNumber of times to retry boto3 requests (for example, deleting S3 files for materialized tables)IntegerOptional5
Iceberg retriesnum_iceberg_retriesNumber of times to retry iceberg commit queries to fix ICEBERG_COMMIT_ERRORIntegerOptional0
Loading table...

Development credentials

Enter your development (not deployment) credentials with the following fields:

FieldOptionDescriptionTypeRequiredExample
AWS Access Key IDaws_access_key_idAccess key ID of the user performing requestsStringRequiredAKIAIOSFODNN7EXAMPLE
AWS Secret Access Keyaws_secret_access_keySecret access key of the user performing requestsStringRequiredwJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
SchemaschemaSpecify the schema (Athena database) to build models into (lowercase only)StringRequireddbt
ThreadsthreadsIntegerOptional3
Loading table...

Temporary credentials

If you prefer to not store long-lived IAM user AWS Access Key ID and AWS Secret Access Key in the dbt platform, you can use aws_session_token, which is part of temporary AWS Security Token Service (STS) credentials, instead. This approach mirrors a user or role’s long-term permissions.

To use temporary credentials:

  1. Enter the AWS Access Key ID and AWS Secret Access Key in the development environment settings in the dbt platform user interface (UI).

  2. Since the aws_session_token isn't available as a UI field in dbt platform, add it using Extended attributes in the environment settings or dbt platform profiles.

    When you set the aws_session_token in Extended attributes, the key is case-sensitive and must be exactly aws_session_token.

    For example, you can use an environment variable so the token isn't stored in the text box UI:

    aws_session_token: '{{ env_var(''DBT_ENV_AWS_SESSION_TOKEN'') }}'
  3. Assign DBT_ENV_AWS_SESSION_TOKEN for each environment. Since temporary credentials expire, you need to refresh your STS credentials and update the environment (or the variable value) before expiration.

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

0
Loading