قالب وردپرس درنا توس
Home / Tips and Tricks / Enable and view request statistics for an AWS S3 bucket in CloudWatch – CloudSavvy IT

Enable and view request statistics for an AWS S3 bucket in CloudWatch – CloudSavvy IT

AWS logo

S3 comes with some basic bucket size and object count analyzes, which are free and automatically calculated. However, if you want to view more detailed analytics for S3 requests, you must enable request statistics.

Enable metrics

To see request statistics, you must enable them for each bucket. These are not free like the standard statistics: the paid tier of CloudWatch costs $ 0.30 per stat. Unfortunately, each S3 bucket can add up to 1

6 different request stats, and they are all constantly active. This brings the cost to $ 5 per bucket, possibly less depending on whether or not you use certain options.

To enable it, go to the Statistics tab for your bucket:

bucket statistics

You will see the standard statistics and at the bottom there is a button ‘View additional graphs’:

view additional charts

Click “Create Filter” to create a filter that enables request statistics.

You can limit this to a specific subset of items, or simply select ‘This filter applies to all objects in the bucket’.

create filter

Once that’s done, the request statistics will be sent to CloudWatch. It may take a while, so grab a coffee and get back to it.

Using metrics in CloudWatch

Visit the CloudWatch Management Console to get started.

You need to create a new dashboard and add a widget to it. You can choose any type of chart, but for simple case statistics, line charts generally work best.

Select S3 for the metrics:

And then ‘Request statistics per filter’.

You will then see a list of statistics available to you from the buckets for which you have enabled request statistics. Two of the most useful are BytesDownloaded and BytesUploaded, which track raw data usage. You can graph them over time and add this chart to your dashboard.

By default, the graph shows the average data usage. You are probably interested in the total data usage, so under “Graphed Metrics” you can change the metric to “Sum”, which adds up all the requests for the specified period. This works best when set for a long period of time, such as an hour or day.

Of course, like all CloudWatch metrics, you can set automatic alarms for when usage gets unexpectedly high, and use those alarms for other events in your account as well.

Source link