Using AWS CLI with the Matomo Data Warehouse Connector
The Matomo Data Warehouse Connector allows users to automatically export raw analytics data from Matomo Cloud into data warehouses like Google BigQuery.
It removes the need for APIs or custom scripts, and supports advanced analysis by combining Matomo data with other business sources and running large-scale queries for detailed reporting. The data can also be queried directly via the AWS CLI.
This guide explains how to connect and query the S3 bucket using the Data Warehouse Connector.
Before you start
Ensure you have activated the Data Warehouse Connector feature. Follow these instructions to enable the Data Warehouse Connector in your Matomo instance.
1. Install the AWS CLI and SSM Plugin
To get started, you need two main components:
- AWS CLI: The core command-line tool for interacting with AWS services.
Read the official installation instructions here.- For Linux Ubuntu:
snap install aws-cli --classic - For MacOS: https://awscli.amazonaws.com/AWSCLIV2.pkg
- For Linux Ubuntu:
- AWS SSM Plugin: Required for managing connections using AWS Systems Manager.
- Install the Session Manager plugin for AWS CLI.
- Once both tools are installed, you can set up the website export and configure your credentials.
2. Configure Matomo Data Warehouse Connector
- In Matomo, navigate to Administration
Export > Data Warehouse Connector.
-
Select the website to export and click Submit.
-
In the Export Table Paths, take note of the domain and the following key, we will refer to this as your-domain-and-key throughout this guide:
- Scroll down the page to the Credentials section and click on Generate Credentials.
3. Configure AWS
Before running any commands, ensure the AWS CLI and Session Manager plugin are installed (see step 1).
The Data Warehouse Connector provides AWS credentials that grant access to your export bucket. These credentials are scoped to your Matomo export and do not provide general AWS access.
- Open your terminal (PowerShell, Terminal, or shell) and run:
aws configure. - Enter the credentials generated in Matomo:
PS C:\Users\user1> aws configure
AWS Access Key ID [****************4DMP]: <---- enter generated ID
AWS Secret Access Key [****************eCvg]: <---- enter access key
Default region name [eu-central-1]: <---- enter eu-central-1
Default output format [json]:` <---- enter your preference
- Access Key ID and Secret Access Key: These authenticate your requests to the S3 bucket. You must use the credentials generated in Matomo.
- Region (eu-central-1): This is where the export bucket is hosted. It must match the region provided in the Data Warehouse Connector.
- Output format (json): This controls how command results are displayed.
jsonis recommended for compatibility with scripts and tools.
Once configured, the AWS CLI stores these credentials locally and uses them for all subsequent commands.
4. Querying the bucket
When the setup is complete, you can access your exported data in the S3 bucket using the AWS CLI.
The Export Table Path in Matomo provides the full S3 path, including your domain and unique export key.
List available files
Run the following command to view available tables:
aws s3 ls s3://prod-processed-customer-exports/<your-domain-and-key>/
Example:
aws s3 ls s3://prod-processed-customer-exports/<your-domain-and-key>/
Output:
C:\Users\user1> aws s3 ls s3://prod-processed-customer-exports/<your-domain-and-key>/
PRE funnel/
PRE goal/
PRE log_abtesting/
PRE log_action/
PRE log_clickid/
PRE log_conversion/
PRE log_conversion_item/
PRE log_form/
PRE log_form_field/
PRE log_form_page/
PRE log_hsr/
PRE log_hsr_blob/
PRE log_hsr_event/
PRE log_hsr_site/
PRE log_link_visit_action/
PRE log_media/
PRE log_media_plays/
PRE log_visit/
PRE site/
PRE site_form/
2026-04-07 12:50:53 44 reservation.json
To list all files for a specific day, for example, list all log_action files:
aws s3 ls s3://prod-processed-customer-exports/<your-domain-and-key>/log_action/20260407/
Output
PS C:\Users\user1> aws s3 ls s3://prod-processed-customer-exports/<your-domain-and-key>/log_action/20260407/
2026-04-07 18:03:19 1311385 log_action-0-11625-20260406-233000-20260407-052959_part0.jsonl
2026-04-08 01:05:03 241 log_action-11625-11627-20260407-053000-20260407-112959_part0.jsonl
Download a single file
To download a file locally for a specific date:
aws s3 cp s3://prod-processed-customer-exports/<your-domain-and-key>/log_action/20260407/<filename>.jsonl ./downloads/
Example:
aws s3 ls s3://prod-processed-customer-exports/<your-domain-and-key>/log_action/20260407/log_action-0-11625-20260406-233000-20260407-052959_part0.jsonl ./downloads/
Download all files
To download all files for a specific date:
aws s3 sync s3://prod-processed-customer-exports/<your-domain-and-key>/log_action/20260407/ ./downloads/
Example:
aws s3 sync s3://prod-processed-customer-exports/<your-domain-and-key>/log_action/20260407/ ./downloads/
Once downloaded, you can import the files in a reporting tool and combine them with other business datasets for analysis.