Integrating with Cloudfront
This guide walks you through the process of implementing AI Bot Analytics on your Cloudfront website using AWS CloudFormation stack.
Prerequisites
- An active Writesonic account
- An existing AWS CloudFront distribution
- AWS Account with permissions to:
- Create CloudFormation stacks
- Modify CloudFront distributions
- Create IAM roles and policies
- Create S3 buckets and Kinesis streams
Phase 1: Start in Writesonic
- Head over to the AI Bot Analytics page on Writesonic and choose 'Cloudfront' as a provider
- Click on 'Continue' to initialize the integration
- Writesonic will provide you the following information that you'll need during the AWS configuration:
- CloudFormation Template File
- Writesonic API Key
Phase 2: Create CloudFormation Stack
Step 1: Access CloudFormation Service
- Log in to your AWS Management Console
- Navigate to the CloudFormation service
- Click on "Create stack" to begin the stack creation process
Step 2: Upload Template
- On the "Create stack" page, select "Upload a template file"
- Click "Choose file" and upload the CloudFormation template provided by Writesonic
- Click "Next" to proceed
Step 3: Configure Stack Details
- Specify the following stack parameters:
| Parameter | Value | Description |
|---|---|---|
| DataStreamShardCount | 1 | Number of shards for the Kinesis Data Stream |
| EnableEnhancedMonitoring | False | Enhanced monitoring setting |
| S3BucketPrefix | Your desired bucket name | Prefix for the S3 bucket that will store logs |
| WritesonicAPIKey | Your API key | API key provided by Writesonic |
| WritesonicIngestionDomain | ingestion.writesonic.com | Writesonic ingestion endpoint |
- Click "Next" after entering all parameters.
Step 4: Configure Stack Options
- Review the stack options (no additional configuration required)
- Click "Next" to continue
Step 5: Review and Create
- Review all stack configuration details
- Check the acknowledgment box confirming that CloudFormation might create IAM resources
- Click "Submit" to create the stack
Step 6: Wait for Stack Creation
- Monitor the stack creation progress in the CloudFormation console
- Wait for the status to change to "CREATE_COMPLETE"
- This process typically takes several minutes
Phase 3: Configure CloudFront Distribution Logging
Step 1: Access CloudFront Distribution
- Navigate to the CloudFront service in AWS Console
- Locate and select the CloudFront distribution you want to monitor
- Click on the "Logging" tab
Step 2: Configure Real-time Logs
- In the Logging tab, locate the "Real-time logs" section
- Click on "Edit"" to modify the configuration
Step 3: Enable Logging
- Set the Status to "Enabled"
- Select the Log configuration that was created by the CloudFormation stack
- Click "Save changes" to apply the configuration
Phase 4: Integration Verification
- After completing all the steps, the CloudFormation stack should show as "CREATE_COMPLETE"
- Real-time logs should be "Enabled" on your CloudFront distribution
- Return to AI Bot Analytics Page in Writesonic
- Click on "Verify Integration" to confirm that your Cloudfront integration is working properly
- Once verified, you'll be redirected to your analytics dashboard. The process typically finishes in 1–2 minutes but may take up to 5 minutes.
Troubleshooting
If you encounter any issues during setup:
- Stack Creation Fails: Check that your AWS account has all required permissions listed in Prerequisites
- CloudFormation Errors: Verify that all parameters are entered correctly, especially the Writesonic API Key
- Missing Log Configuration: Ensure the CloudFormation stack shows "CREATE_COMPLETE" before configuring CloudFront
- CloudFront Not Logging: Confirm that real-time logs are set to "Enabled" and the correct log configuration is selected
- Missing Data: Allow 5-10 minutes for data to begin flowing; check that your website is receiving traffic
- API Key Issues: Verify the Writesonic API Key is copied exactly as provided without extra spaces
For assistance, contact [email protected]
Important Notes
Permissions
Ensure that your AWS account has necessary permissions for:
- Creating CloudFormation stacks
- Modifying CloudFront distributions
- Creating IAM roles and policies
- Creating S3 buckets and Kinesis streams
Cost Considerations
Be aware of AWS costs associated with:
- Kinesis Data Streams (based on shard hours and PUT payload units)
- S3 storage for log data
- CloudFront real-time logs (per log line)
Monitor your AWS billing dashboard to track integration costs.
Updated about 16 hours ago
