AWS Certified DevOps Engineer – ProfessionalMonitoring and LoggingMedium
A global e-commerce company uses Amazon CloudFront to distribute its web content. They need to monitor user behavior analytics, such as page views, unique visitors, and geographic distribution, for their marketing and product teams. The solution must be serverless, scalable, and enable ad-hoc querying of historical data without managing complex infrastructure.
- AEnable CloudFront access logs, deliver them to an S3 bucket, and use Amazon Athena to query the logs.
- BIntegrate CloudFront with AWS AppSync to capture client-side events and store them in Amazon DynamoDB for analysis.
- CImplement custom Lambda@Edge functions to capture user data and push it to Amazon Kinesis Data Firehose, then to Amazon Redshift.
- DConfigure CloudFront to send real-time logs to CloudWatch Logs, then use CloudWatch Logs Insights for analysis.
Show answer & explanationAnswer & explanation
Correct answer: A. Enable CloudFront access logs, deliver them to an S3 bucket, and use Amazon Athena to query the logs.
CloudFront access logs contain rich information about user requests, including IP addresses, user agents, and requested URLs. Delivering these logs to S3 is cost-effective for long-term storage, and Amazon Athena provides a serverless, scalable way to perform ad-hoc SQL queries directly against the S3 data, perfectly fitting the requirements for user behavior analytics.
Why the other options are wrong
- B. AppSync is for GraphQL APIs and real-time data, not directly for processing CloudFront access logs for analytics, and DynamoDB is not ideal for ad-hoc analytical queries on large datasets.
- C. This is an overly complex and expensive solution for collecting data already available in access logs, requiring custom code and managing a Redshift cluster.
- D. While CloudWatch Logs Insights can query logs, CloudFront real-time logs to CloudWatch Logs can incur higher costs for large volumes and S3+Athena is generally more cost-effective for large-scale historical access log analysis.
CloudFront Access Logs with Athena
CloudFront access logs provide detailed records of every user request, which can be stored in S3 and queried serverlessly using Amazon Athena for analytics.
- Logs contain IP address, user agent, requested URL, and more.
- Stored in S3, enabling cost-effective long-term retention.
- Athena allows ad-hoc SQL queries directly on S3 data.
- Serverless and scalable solution for web analytics.
Memory trick: CloudFront's 'S3-Athena' combo unlocks web visitor secrets.