Monitor S3 storage utilization and limit costs

Michael Wittig – 10 Jul 2020

S3 buckets provide infinite storage. But, you pay for storing files in your S3 buckets. To avoid a surprisingly high AWS bill, you have to monitor the storage usage of your buckets. This blog post guides you through the steps.

Avoid a surprisingly high AWS bill!

Figure out the region of your S3 bucket

An S3 bucket is located in a region. By looking at the list of your buckets, you can see where the bucket is located.

S3 bucket location

Create a CloudWatch Alarm

Each S3 bucket reports usage data to CloudWatch. Open the CloudWatch service.

  1. At the top navigation bar, select the region of your bucket.
  2. Click on Alarms in the left navigation bar.
  3. Press the Create alarm button.

Select CloudWatch region

Press the Select metric button.

Select CloudWatch metric: step 1

Search for your bucket name.

It takes 24 hours for a new bucket to appear!

Select CloudWatch metric: step 2

Click on S3 > Storage Metrics.

Select CloudWatch metric: step 3

Select the BucketSizeBytes metric for the StandardStorage type. If you use other storage types as well, repeat the procedure for every storage type. Press the Select metric button.

Select CloudWatch metric: step 4

Set the Statistic to Maximum.

Select CloudWatch metric: step 5

Set the Threshold to the storage limit that you want to monitor. You pay $0.023 per GB of standard storage (varies per region). Keep in mind that the threshold value has to be in bytes.

  1 GB =     1000000000 Bytes = $   0.023
10 GB = 10000000000 Bytes = $ 0.230
100 GB = 100000000000 Bytes = $ 2.300
1 TB = 1000000000000 Bytes = $ 23.000
10 TB = 10000000000000 Bytes = $ 230.000

Press the Next button.

Select CloudWatch metric: step 6

Do you want to receive an email or a message in Slack or Microsoft Teams if the threshold is reached?

To receive an email:

  1. Select Create a new topic.
  2. Set a topic name.
  3. Enter your email.
  4. Press the Create topic button.
  5. You will receive an email with a confirmation link to activate the email.
  6. Press the Next button.

Create email notification

To receive a message in Slack or Microsoft Teams:

  1. Add marbot to Slack or Microsoft Teams.
  2. Invite marbot to a channel.
  3. In the AWS Console, search for an existing topic marbot.
    1. If the marbot topic is found, click on it.
    2. If no topic is found, go to the channel and type:
      @marbot Create an SNS topic
      Follow the wizard and repeat the steps above.
  4. Press the Next button.

Create marbot notification

Last but not least, set an Alarm name and push the Next button.

CloudWatch Alarm name

Save by pushing the Create alarm button.

Done! You are notified if the S3 bucket storage reaches the defined threshold.

Michael Wittig

Michael Wittig

Consultant focusing on Amazon Web Services (AWS). Entrepreneur building marbot.io. Author of Amazon Web Services in Action, Rapid Docker on AWS, and cloudonaut.io.

You can contact me via Email, Twitter, and LinkedIn.

Published on

marbot teaser

Chatbot for AWS Monitoring

Configure monitoring for Amazon Web Services: CloudWatch, EC2, RDS, EB, Lambda, and more. Receive and manage alerts via Slack. Solve incidents as a team.

Slack
Add to Slack
Microsoft Teams
Add to Teams