How do I find the cost of my Amazon S3 buckets?

4 minute read
0

I want to know the cost of each Amazon Simple Storage Service (Amazon S3) bucket in my account or in an AWS Region. Or, my Amazon S3 storage costs for a particular Region went up, and I want to know which bucket is driving that increased cost. How can I do that?

Short description

To check which Amazon S3 bucket is increasing your storage cost, perform the following steps:

1.    Add a common tag to each bucket.

2.    Activate the tag as a cost allocation tag.

Important: All tags can take up to 24 hours to appear in the Billing and Cost Management console.

3.    Use the AWS Cost Explorer to create an AWS Cost and Usage Report for your tag.

Note: Cost allocation tags don't show you costs that you incurred before you set up the tags.

Resolution

Before you begin, your AWS Identity and Access Management (IAM) policy must have permissions to do the following:

Tip: Avoid using your AWS account root user for this solution. Instead, use an IAM user or role with the permissions that you need.

Adding a common tag to each bucket

1.    Open the Amazon S3 console.

2.    From the list of buckets, choose the bucket that you want to track costs for.

3.    Choose the Properties view.

4.    Scroll down and choose Tags.

5.    Choose Edit.

6.    Choose Add Tag.

7.    For Key, enter a name for the tag that you'll add to all the buckets that you want to track costs for. For example, enter "S3-Bucket-Name".

8.    For Value, enter the name of the bucket.

9.    Repeat Steps 1 through 7 for all the buckets that you want to track costs.

Activating the tag as a cost allocation tag

1.    Open the Billing and Cost Management console.

2.    From the navigation pane, choose Cost allocation tags.

3.    In the search bar, enter the name of the tag that you created for your buckets. For example, type "S3-Bucket-Name".

4.    Select the tag.

5.    Choose Activate.

Use the AWS Cost Explorer to create a cost report for the tag

1.    Open the Billing and Cost Management console.

2.    From the navigation pane, choose Cost Explorer.

3.    Choose Launch Cost Explorer.

4.    From the navigation pane, choose Reports.

5.    Choose New report.

6.    For Report Templates, select Cost & Usage report, and then choose Create Report.

7.    Under Filters, for Service, select S3 (Simple Storage Service). Then, choose Apply filters.

8.    For Tag, select the tag that you created. For example, select S3-Bucket-Name. Then, check each bucket that you want to track costs on, and choose Apply filters.

Note: If you don't see your tag in the filter list, it's likely that the tag was recently created and applied to a bucket. Wait 24 hours, and then try creating the report again.

9.    Under Advanced options, confirm that Show only untagged resources is unchecked.

10.    From the top of the graph, choose Group by, and then select the tag that you created.

11.    Choose Save as.

12.    Enter a title for your cost report.

13.    Choose Save Report.

After you create the cost report, use the report to review the cost of each bucket marked with the cost allocation tag that you created.

Note: You can set up a daily or hourly AWS Cost and Usage Report report to get more Amazon S3 billing details. However, these reports don't show you who made requests to your buckets. To see where requests to your bucket are coming from, enable either object-level logging or server access logging. To get more information on certain Amazon S3 billing items, you must enable logging ahead of time. Then, you'll have logs that contain Amazon S3 request details.


Related information

Billing and usage reporting for S3 buckets

Monthly cost allocation report

AWS OFFICIAL
AWS OFFICIALUpdated 2 years ago