Monitor and troubleshoot your CloudFront and MediaTailor integration
AWS Elemental MediaTailor integration with Amazon CloudFront requires ongoing monitoring and troubleshooting to maintain optimal performance. After implementing your CloudFront and MediaTailor integration, monitor performance and prepare to troubleshoot any issues. The content delivery network (CDN) provides tools to help you understand how your distribution performs and identify potential problems.
Setting up monitoring for your integration
Implement these monitoring strategies to track the performance of your CloudFront and MediaTailor integration:
To set up monitoring for your CloudFront and MediaTailor integration
-
Enable CloudFront standard logging:
-
In the CloudFront console, select your distribution.
-
Choose the Logs tab.
-
Under Standard logs, choose Edit.
-
Select On and configure an Amazon S3 bucket for log storage.
-
Choose Save changes.
-
-
Set up CloudFront real-time logs:
-
In the CloudFront console, select your distribution.
-
Choose the Logs tab.
-
Under Real-time logs, choose Edit.
-
Select On and configure an Amazon Kinesis Data Streams or Amazon Data Firehose delivery stream.
-
Include these fields in your log configuration:
-
time-to-first-byte
- Response time -
sc-status
- HTTP status code -
c-ip
- Viewer IP address -
cs-uri-stem
- Request URI path -
cs-user-agent
- User agent -
x-edge-result-type
- Result type (Hit, Miss, Error)
-
-
Choose Save changes.
-
-
Create CloudWatch dashboards:
-
In the CloudWatch console, choose Dashboards.
-
Choose Create dashboard.
-
Add widgets for these CloudFront metrics:
-
Requests
-
BytesDownloaded
-
4xxErrorRate
-
5xxErrorRate
-
TotalErrorRate
-
CacheHitRate
-
-
-
Set up CloudWatch alarms:
-
In the CloudWatch console, choose Alarms.
-
Choose Create alarm.
-
Create alarms for these conditions:
-
5xxErrorRate > 1% for 5 minutes
-
4xxErrorRate greater than 5% for 5 minutes
-
CacheHitRate less than 80% for 30 minutes
-
-
Monitoring MQAR performance
When using MQAR, monitoring helps you understand how CloudFront selects between your origins and whether the quality scores meet expectations. Real-time logs show these decisions as they happen.
To monitor MQAR performance
-
Enable real-time logs for your CloudFront distribution.
-
Include these fields in your log configuration:
-
r-host
- The hostname of the selected origin -
sr-reason
- The reason for origin selection -
x-edge-mqcs
- The media quality confidence score
-
-
Set up a log destination in Amazon Kinesis Data Streams or Amazon Data Firehose.
-
Create dashboards or alerts based on these metrics to monitor quality scores and origin selection decisions.
Example Sample CloudWatch dashboard for MQAR monitoring
Create a CloudWatch dashboard with these metrics:
-
Origin selection counts by Region
-
Average quality scores over time
-
Failover events
-
4xx and 5xx error rates by origin
For more information about setting up real-time logs, see Real-time logs in the CloudFront developer guide.
Troubleshooting common issues
Issues can arise with your CloudFront and MediaTailor integration even with careful planning. Understanding common problems and solutions helps you resolve issues quickly and minimize viewer impact.
If you encounter issues with your CloudFront and MediaTailor integration, check these common problems and solutions:
- Manifest caching issues
-
Symptom: Stale manifests or ads not updating
Solution: Verify you're using the
CachingDisabled
cache policy for multivariant playlist, media playlist, and MPD paths. Check that your configuration forwards query parameters correctly. - CORS errors
-
Symptom: Browser console shows CORS errors when accessing content
Solution: Configure a response headers policy with appropriate CORS headers and associate it with your cache behavior.
- MQAR not working
-
Symptom: Origin selection ignores quality scores
Solution: Check that you've enabled the Media quality score option in your origin group settings. Verify you're not using Lambda@Edge origin-facing triggers.
- Ad insertion failures
-
Symptom: Ads not inserting properly
Solution: Verify your MediaTailor configuration points to your CloudFront distribution for content segment prefix. Check that your setup forwards all required headers.
For more complex issues, you can use these troubleshooting approaches:
-
Check CloudFront distribution logs for error patterns
-
Use browser developer tools to inspect network requests
-
Compare manifest content from MediaTailor directly compared to content delivered through CloudFront
-
Test with a simple player that supports detailed logging
For more troubleshooting assistance, see the Troubleshooting section in the MediaTailor user guide.
Troubleshooting workflow
Follow this systematic approach to troubleshoot issues with your CloudFront and MediaTailor integration:
To troubleshoot CloudFront and MediaTailor integration issues
-
Identify the specific issue:
-
Determine if the issue affects all viewers or only some
-
Identify which content types are affected (manifests, segments, or both)
-
Note any error messages or symptoms
-
-
Check CloudFront logs:
-
Look for error status codes (4xx or 5xx)
-
Check cache hit/miss patterns
-
Verify that requests are being routed to the correct origin
-
-
Verify configuration:
-
Check cache behaviors for correct path patterns
-
Verify cache policies are correctly applied
-
Confirm that origin request policies are forwarding necessary headers
-
-
Test direct access:
-
Try accessing content directly from MediaTailor (bypassing CloudFront)
-
Compare responses between direct access and CloudFront access
-
-
Implement solution:
-
Apply the appropriate fix based on your findings
-
Test to verify the issue is resolved
-
Document the issue and solution for future reference
-
Next steps
After setting up monitoring and troubleshooting for your CloudFront and MediaTailor integration, consider these next steps:
-
Implement automated deployment using AWS CloudFormation (see Automate MediaTailor and CDN with AWS CloudFormation)
-
Create runbooks for common operational scenarios and troubleshooting procedures
-
Set up automated remediation for common issues