Search code examples
amazon-web-servicesamazon-s3web-hostingvisitor-statistic

Using a visit counter for a site hosted in Amazon's AWS S3


I am hosting a website using Amazon S3 and Route 53 as part of their Amazon Web Services. The site is up and running fine but would like to be able to easily keep track of how many people visit the site?


Solution

  • I know you have resolved this, but I hope it will help someone else.

    Below is a copy/paste from relevant page of AWS site made on Nov 18 (use this link to page for latest version) :

    If you want to track the number of visitors who access your website, enable logging for the root domain bucket. Enabling logging is optional.

    To enable logging for your root domain bucket

    Open the Amazon S3 console at https://console.aws.amazon.com/s3/.

    Create a bucket for logging named logs.example.com in the same AWS Region that the example.com and www.example.com buckets were created in.

    Create two folders in the logs.example.com bucket; one named root, and the other named cdn. If you configure Amazon CloudFront to speed up your website, you will use the cdn folder.

    In the Bucket name list, choose your root domain bucket, choose Properties, and then choose Server access logging.

    Choose Enable logging.

    For Target bucket, choose the bucket that you created for the log files, logs.example.com.

    For Target prefix, type root/. This setting groups the log data files in the bucket in a folder named root so that they are easy to locate.

    Choose Save.

    You can now review your logs in the logs.example.com bucket, in both the root and cdn folders.