1 Answer
- Newest
- Most votes
- Most comments
0
If you prefer the Athena route then you can use something like this (you can easily subdivide the results however you want, in the following example I subdivide by the storage tier):
SELECT format_datetime(line_item_usage_start_date,
'M/d/y') AS "Day", line_item_resource_id AS "Bucket",
CASE
WHEN line_item_usage_type LIKE '%TimedStorage-Byte%' THEN
'Standard'
WHEN line_item_usage_type LIKE '%TimedStorage-SIA%' THEN
'Infrequent Access'
WHEN line_item_usage_type LIKE '%TimedStorage-Glacier%' THEN
'Glacier'
WHEN line_item_usage_type LIKE '%TimedStorage-RRS%' THEN
'Reduced Redundancy'
ELSE 'Other'
END AS "Tier", sum(line_item_usage_amount) *30 AS "Storage IN GB", sum(line_item_unblended_cost) AS "Unblended Cost"
FROM customer_cur_data.customer_all
WHERE line_item_product_code = 'AmazonS3'
AND line_item_usage_type LIKE '%TimedStorage%'
AND line_item_usage_start_date = timestamp '2020-08-31'
GROUP BY 1, 2, 3
ORDER BY 2, 1, 3
In the Where
section you would need to modify line_item_usage_start_date = timestamp '2020-08-31'
to be whatever range or value you want. Also in the Select
modify the sum(line_item_usage_amount) *30
to multiply by the actual number of days in the month (Feb would multiply by 28). The sum of unblended cost is just that day's cost. Multiply by the same number of days in the month to project the monthly cost given that amount of storage.
answered 4 years ago
Relevant content
- asked 2 months ago
- asked 3 years ago
- asked 6 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 3 years ago