Amazon Athena

Learn how to connect Amazon Athena and Apache Iceberg data to GrowthLoop

GrowthLoop connects directly to Amazon Athena so you can build and activate audiences from customer data in Amazon S3. Athena uses the AWS Glue Data Catalog for table metadata, and GrowthLoop stores its snapshot state as Apache Iceberg tables in an S3 location that you control.

Prerequisites

Before connecting Athena, make sure you have:

  • An AWS account with access to Amazon Athena, AWS Glue, IAM, and Amazon S3.
  • Customer tables or views registered in an AWS Glue Data Catalog and queryable from Athena.
  • Permission to create an S3 bucket or dedicated prefixes for Athena query results and GrowthLoop Iceberg tables.
  • Permission to create an IAM user and access key for GrowthLoop.

Use the same AWS Region for Athena, the Glue Data Catalog, and the S3 bucket. Record the Region name, such as us-east-1, because you will enter it in GrowthLoop.

Set up Amazon S3

Create two dedicated prefixes in an S3 bucket. You can use one bucket for both prefixes:

S3 locationPurposeExample
Athena query resultsStores the results and metadata generated when Athena runs queries.s3://your-bucket/athena-results/
Iceberg table rootStores GrowthLoop-managed Iceberg snapshot tables.s3://your-bucket/growthloop-iceberg/
  1. Open the Amazon S3 console.
  2. Click Create bucket.
  3. Enter a bucket name and select the same AWS Region that you will use for Athena.
  4. Keep Block all public access enabled.
  5. Click Create bucket.

You do not need to create empty folders in advance. Save both complete s3:// URIs, including the trailing slash.

Configure an Athena workgroup

  1. Open the Amazon Athena console.
  2. Select the AWS Region that contains your Glue catalog and S3 bucket.
  3. In the left navigation, click Workgroups.
  4. Create a workgroup or select an existing workgroup such as primary.
  5. Configure the workgroup to use Athena engine version 3.
  6. Under Query result configuration, enter your query-results prefix, such as s3://your-bucket/athena-results/.
  7. Save the workgroup and record its name.

GrowthLoop sends the query-results URI with each connection. If your workgroup overrides client-side query-result settings, configure the workgroup with the same accessible S3 location. Learn more in the AWS guide to Athena query-result locations.

Create the snapshot database

GrowthLoop needs a writable Glue database for its Iceberg snapshot tables. flywheel_system is the recommended name.

  1. Open Athena query editor.
  2. Select your workgroup and the AwsDataCatalog data source.
  3. Run the following statement:
CREATE DATABASE IF NOT EXISTS flywheel_system;

GrowthLoop creates and manages the required Iceberg tables inside this database. Athena creates Iceberg v2 tables and stores their data under the Iceberg S3 root that you provide. For more information, review Create Iceberg tables in Athena.

Create an IAM user for GrowthLoop

Create a dedicated IAM user instead of sharing a person's AWS credentials.

  1. Open the AWS IAM console.
  2. In the left navigation, click Users, then click Create user.
  3. Enter a descriptive name such as growthloop-athena and create the user.
  4. Grant the user permission to:
    • Run and inspect queries in the selected Athena workgroup.
    • List the data catalogs available in the selected Region.
    • Read database, table, view, and partition metadata from AWS Glue.
    • Read the source-table S3 locations that you want to use in GrowthLoop.
    • Create, update, and delete tables in the flywheel_system Glue database.
    • Read and write the Athena query-results and GrowthLoop Iceberg S3 prefixes.
  5. Open the user's Security credentials tab.
  6. Under Access keys, click Create access key.
  7. Select Third-party service, acknowledge the recommendation, and create the key.
  8. Securely save the Access key ID and Secret access key. AWS displays the secret only once.
📘

Note

If AWS Lake Formation governs your catalog or S3 locations, grant the IAM user the corresponding Lake Formation permissions as well. IAM permissions alone do not override Lake Formation access controls.

Example IAM policy

Use the following policy as a starting point. Replace the AWS Region, account ID, workgroup, bucket name, source database, source prefixes, and snapshot database with your values. Narrow the resources further when your AWS security standards require it.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "RunAthenaQueries",
      "Effect": "Allow",
      "Action": [
        "athena:GetDataCatalog",
        "athena:GetDatabase",
        "athena:GetQueryExecution",
        "athena:GetQueryResults",
        "athena:GetTableMetadata",
        "athena:GetWorkGroup",
        "athena:ListDataCatalogs",
        "athena:ListDatabases",
        "athena:ListTableMetadata",
        "athena:StartQueryExecution",
        "athena:StopQueryExecution"
      ],
      "Resource": "*"
    },
    {
      "Sid": "ReadGlueCatalog",
      "Effect": "Allow",
      "Action": [
        "glue:BatchGetPartition",
        "glue:GetDatabase",
        "glue:GetDatabases",
        "glue:GetPartition",
        "glue:GetPartitions",
        "glue:GetTable",
        "glue:GetTables"
      ],
      "Resource": [
        "arn:aws:glue:AWS_REGION:AWS_ACCOUNT_ID:catalog",
        "arn:aws:glue:AWS_REGION:AWS_ACCOUNT_ID:database/SOURCE_DATABASE",
        "arn:aws:glue:AWS_REGION:AWS_ACCOUNT_ID:table/SOURCE_DATABASE/*",
        "arn:aws:glue:AWS_REGION:AWS_ACCOUNT_ID:database/flywheel_system",
        "arn:aws:glue:AWS_REGION:AWS_ACCOUNT_ID:table/flywheel_system/*"
      ]
    },
    {
      "Sid": "ManageSnapshotGlueTables",
      "Effect": "Allow",
      "Action": [
        "glue:BatchCreatePartition",
        "glue:BatchDeletePartition",
        "glue:CreatePartition",
        "glue:CreateTable",
        "glue:DeletePartition",
        "glue:DeleteTable",
        "glue:UpdatePartition",
        "glue:UpdateTable"
      ],
      "Resource": [
        "arn:aws:glue:AWS_REGION:AWS_ACCOUNT_ID:catalog",
        "arn:aws:glue:AWS_REGION:AWS_ACCOUNT_ID:database/flywheel_system",
        "arn:aws:glue:AWS_REGION:AWS_ACCOUNT_ID:table/flywheel_system/*"
      ]
    },
    {
      "Sid": "ListAthenaBuckets",
      "Effect": "Allow",
      "Action": [
        "s3:GetBucketLocation",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::SOURCE_BUCKET",
        "arn:aws:s3:::YOUR_BUCKET"
      ]
    },
    {
      "Sid": "ReadSourceData",
      "Effect": "Allow",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::SOURCE_BUCKET/SOURCE_PREFIX/*"
    },
    {
      "Sid": "ManageGrowthLoopData",
      "Effect": "Allow",
      "Action": [
        "s3:AbortMultipartUpload",
        "s3:DeleteObject",
        "s3:GetObject",
        "s3:ListMultipartUploadParts",
        "s3:PutObject"
      ],
      "Resource": [
        "arn:aws:s3:::YOUR_BUCKET/athena-results/*",
        "arn:aws:s3:::YOUR_BUCKET/growthloop-iceberg/*"
      ]
    }
  ]
}
⚠️

Warning

If your source data or S3 prefixes use an AWS KMS customer-managed key, also grant the IAM user the required KMS permissions on that key.

Connect Athena in GrowthLoop

  1. Sign in to GrowthLoop.
  2. Select Amazon Athena when you create a Source.
  3. Enter the connection settings:
GrowthLoop fieldWhat to enter
NameA recognizable name for this Source, such as Production Athena.
DescriptionAn optional description of the data available through the Source.
AWS RegionThe Region containing your Athena workgroup and Glue catalog, such as us-east-1.
Athena query results S3 URIThe complete query-results prefix, such as s3://your-bucket/athena-results/.
Athena workgroupThe workgroup that GrowthLoop should use, such as primary.
Iceberg table S3 rootThe complete writable Iceberg prefix, such as s3://your-bucket/growthloop-iceberg/.
AWS Access Key IDThe access key ID for the dedicated IAM user.
AWS Secret Access KeyThe secret access key for the dedicated IAM user.
AWS Session TokenEnter a session token only when you are using temporary AWS credentials. Leave it blank for a standard IAM user access key.
Dataset for snapshotsThe Glue database GrowthLoop will use for managed Iceberg tables. Use flywheel_system unless you created a different database.
  1. Click Check credentials.
  2. Continue when GrowthLoop confirms the connection.

Add an Athena dataset

  1. Select your Athena Source.
  2. Select Table or View as the dataset source type.
  3. Select a dataset. GrowthLoop displays datasets as catalog->database, such as AwsDataCatalog->analytics.
  4. Select a table or view.
  5. Enter a GrowthLoop dataset name and optional description.
  6. Select the unique key and any other fields required by your data model.
  7. Save the dataset.

The connection can discover multiple Athena data catalogs that the IAM user can access. You select the catalog and Glue database for each GrowthLoop dataset instead of locking the entire Source to one catalog.

Verify the setup

Confirm the following before building your first audience:

  • Check credentials succeeds in GrowthLoop.
  • Your Glue databases appear in the dataset selector.
  • Your Athena tables and views appear after you select a dataset.
  • A simple query runs successfully in Athena with the GrowthLoop IAM user's permissions.
  • GrowthLoop can create Iceberg tables under the configured snapshot database and S3 root.

Congratulations! Your Athena Source is ready for building audiences in GrowthLoop.

📘

Note

Experiencing any issues? Reach out to us at [email protected] and we'll help resolve the matter.


What’s Next

Add your first customer dataset after connecting Athena.

Did this page help you?