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.
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.
Create a CloudWatch Alarm
Each S3 bucket reports usage data to CloudWatch. Open the CloudWatch service.
- At the top navigation bar, select the region of your bucket.
- Click on Alarms in the left navigation bar.
- Press the Create alarm button.
Press the Select metric button.
Search for your bucket name.
It takes 24 hours for a new bucket to appear!
Click on S3 > Storage Metrics.
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.
Set the Statistic to Maximum.
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 |
Press the Next button.
Do you want to receive an email or a message in Slack or Microsoft Teams if the threshold is reached?
To receive an email:
- Select Create a new topic.
- Set a topic name.
- Enter your email.
- Press the Create topic button.
- You will receive an email with a confirmation link to activate the email.
- Press the Next button.
To receive a message in Slack or Microsoft Teams:
- Add marbot to Slack or Microsoft Teams.
- Invite marbot to a channel.
- In the AWS Console, search for an existing topic marbot.
- If the marbot topic is found, click on it.
- If no topic is found, go to the channel and type:
@marbot Create an SNS topic
Follow the wizard and repeat the steps above.
- Press the Next button.
Last but not least, set an Alarm name and push the Next button.
Save by pushing the Create alarm button.
Done! You are notified if the S3 bucket storage reaches the defined threshold.
Take your AWS monitoring to a new level! Chatbot for AWS Monitoring: Configure monitoring, escalate alerts, solve incidents.