AWS CloudFront Setup
The AWS CloudFront integration uses Real-Time Logs with Kinesis Data Streams and Firehose to forward request data to Travatar. This captures every request at the CDN edge - including cached responses.
Prerequisites
- An AWS account with a CloudFront distribution
- A Travatar account with an App ID and API Token
- Access to AWS Console (Kinesis, CloudFront, Lambda)
Architecture
CloudFront (Real-Time Logs)
↓
Kinesis Data Streams
↓
Kinesis Data Firehose
↓
Lambda (transforms records)
↓
POST → Travatar webhook
Setup Steps
1. Get Your Credentials
- Log in to app.travatar.ai
- Go to Settings → Server Tracking
- Copy your App ID and generate an API Token
2. Create Kinesis Data Stream
- Go to AWS Console → Kinesis → Data Streams
- Click Create data stream
- Name:
sst-travatar-data-stream - Leave default settings (On-demand capacity mode)
- Click Create data stream
3. Create Kinesis Data Firehose
- Go to Kinesis → Firehose
- Click Create firehose stream
- Source: Kinesis Data Streams → select
sst-travatar-data-stream - Destination: HTTP endpoint
- Name:
SST-Travatar-Firehose - HTTP endpoint URL:
https://log-tracker.travatar.ai/webhook - Add HTTP headers:
| Header | Value |
|---|---|
X-TRAVATAR-SST-TOKEN | Your API Token from step 1 |
X-TRAVATAR-SST-SOURCE | aws |
- Create an S3 backup bucket (e.g.,
sst-travatar-logs) - required for failed deliveries - Click Create Firehose
tip
If creation fails with an IAM role error, try again - AWS sometimes needs a moment to propagate the auto-created role.
4. Configure CloudFront Real-Time Logs
- Go to CloudFront → Distributions
- From the left sidebar, select Telemetry → Logs
- Click Real-time configuration tab → Create new configuration
- Name:
SST-Travatar-Configuration - Sampling rate:
100% - Fields - select at minimum:
timestampc-ipcs-methodcs-uri-stemcs-uri-querysc-statuscs-hostcs-user-agentcs-refererx-forwarded-for
- Endpoint: select
sst-travatar-data-stream - IAM role: Create new service role
- Distribution: select your distribution, cache behavior:
Default (*) - Click Create Configuration
5. Verify
- Visit your website
- Go to app.travatar.ai → AI Traffic
- Data should appear within 2-5 minutes (Kinesis adds some buffering delay)
What Data Is Collected
CloudFront Real-Time Logs provide:
| Field | Description |
|---|---|
c-ip | Client IP address |
cs-method | HTTP method (GET, POST, etc.) |
cs-uri-stem | Request path (/blog/my-article) |
cs-uri-query | Query string parameters |
cs-host | Requested hostname |
cs-user-agent | Browser or bot identifier |
cs-referer | Referring URL |
sc-status | HTTP status code |
x-forwarded-for | Original client IP behind proxies |
Troubleshooting
No data in dashboard
- Check CloudFront Real-Time Log configuration is active
- Verify Kinesis Data Stream has incoming records: Kinesis → Data Streams → Monitoring
- Check Firehose delivery errors: Firehose → Monitoring → Delivery errors
- Verify HTTP headers (
X-TRAVATAR-SST-TOKEN,X-TRAVATAR-SST-SOURCE) are correct
Delayed data
Kinesis Firehose buffers records before sending. Default buffer is 60 seconds or 1 MB - whichever comes first. You can lower the buffer interval in Firehose settings (minimum 60 seconds).
Firehose delivery failures
Check the S3 backup bucket for failed records. Common causes:
- Invalid API token →
401response - Incorrect source header →
400response