- Le plus récent
- Le plus de votes
- La plupart des commentaires
Hello,
If I understood correctly, you have a S3 Bucket with objects in Standard Storage Class, and a Bucket with Objects in Glacier, and you want to get the cost for each bucket. You are correct in using Cost Allocation Tags per bucket: https://docs.aws.amazon.com/AmazonS3/latest/userguide/CostAllocTagging.html
I did a simple test, I created 2 buckets, copied a bunch or large objects each and moving all the objects in one of the buckets to Glacier. I then added the same tag (Cost Allocation Tag enabled) to both bucket but with different values (EG standard, glacier).
The day after I could see in Cost Explorer the cost related to the buckets, I set S3 as Filter and as Dimension my tag.
You can also use Cost and Usage Report (CUR - https://aws.amazon.com/aws-cost-management/aws-cost-and-usage-reporting/ ) if you need a more programmatic way to achieve the same result:
This is a basic query to find the data:
SELECT line_item_resource_id, resource_tags_user_gio_inc_cost_allocation_cost_center, SUM(line_item_unblended_cost) AS cost
FROM cur
WHERE
year = '2024'
AND month = '1'
AND line_item_line_item_type = 'Usage'
AND line_item_product_code LIKE '%S3'
AND (resource_tags_user_gio_inc_cost_allocation_cost_center = 's3glacier' OR resource_tags_user_gio_inc_cost_allocation_cost_center = 's3standard')
GROUP BY 1,2
ORDER BY 3 DESC
line_item_resource_id | resource_tags_user_gio_inc_cost_allocation_cost_center | cost |
---|---|---|
mybucket-glacier | s3glacier | 0.133245255 |
mybuket-standard | s3standard | 0.077734254 |
Contenus pertinents
- Réponse acceptéedemandé il y a un an
- demandé il y a un an
- demandé il y a un mois
- demandé il y a 4 mois
- AWS OFFICIELA mis à jour il y a 3 ans