Querying Access Logs on AWS

My favorite type of webapp is a static one.

Here are a few reasons:

“How easy, Max?”

Very easy, I’ll show you how!

To take an example, maxmautner.com is hosted on Amazon S3 behind Cloudfront.

In order to track the amount of traffic your website receives you can use a 3rd party analytics provider like Google Analytics.

Tools like Google Analytics suffer from a couple big problems:

However there is an approach that is even easier/more accurate.

Enabling Cloudfront Access Logs

I’ve enabled a feature of Cloudfront to log all requests to logfiles on S3:

Enable Access Logs to S3 for a Cloudfront Distribution

Log files will appear in your designated location on S3:

View Access Logs on S3

There are a couple techniques for making use of the data that you are now collecting:

I’ll be showing how to perform both approaches:

Using Athena to Query Access Logs

Using Redshift to Query Access Logs

A demo with maxmautner.com data

Want me to complete the blog post? Let me know!