sigur7
sigur7

Reputation: 936

Accessing and logging the amount of S3 POST/GETs by filename

I have several JSON files in an S3 bucket. I need to do a monthly count of the amount of put/gets each file receives in a month.

Can these be extracted via CSV or even accessed via an API? I have looked at Cloudwatch and there doesn't appear to be an option for this, or within the billing dashboard.

If this feature doesn't exist, are there any workarounds such as a Lamba function with a counter?

Upvotes: 0

Views: 160

Answers (2)

abiydv
abiydv

Reputation: 621

  1. Enable bucket logs under -

s3 > bucket > properties > server access logging > configure target bucket/prefix

  1. Use Athena to query this data using simple SQL statements. Read more about Athena HERE

Upvotes: 1

oradwell
oradwell

Reputation: 402

You can set up access logging for S3 buckets.

https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerLogs.html

Then you get the ability to export these logs. After that you can do anything with the logs. E.g. a bash script that can count how many requests each file gets.

https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3ExportTasksConsole.html

Upvotes: 0

Related Questions