Search code examples
amazon-web-servicesamazon-s3amazon-cloudfront

AWS S3 how to get prefix cost in period


I have a bucket that receives something around 20 new prefixes in a day.

The prefixes have files that are our products, and we need to know how much each product costs to keep on air.

I was researching how to get the total cost of each product (storage and data transfer) with 'Cost Explorer' and 'CloudWatch'.

The first does not seems to help me, while cloudwatch does have prefix or tags options, but I need to previously specify which prefix to watch over.

Is there a way to get this cost without previous configuration?


Solution

  • Cost is easy, since it is based on volume of data. Use Amazon S3 Inventory to obtain a daily listing of content.

    Access costs is not available broken down by prefix. Instead, use Amazon S3 Server Access Logging to break down access by object and, therefore, by prefix. Then allocate the billed data transfer costs amongst prefixes. Use Bytes Sent to determine volume.