How to use S3 Storage Lens to view storage usage and activity metrics of S3 Bucket on AWS
AWS S3 Storage Lens gives visibility into object storage usage, activity trends. It gives recommendations to improve cost-efficiency, also it applies data protection best practices. It is the first analytics service that provides a single view of object storage usage and activity across hundreds and thousands of accounts in an organization. It provides a summary of insights of S3 Buckets, detects outliers, enhances data protection, and optimizes storage costs.
S3 Storage comes up with a dashboard containing pre-configured views to visualize storage usage and activity trends. We can also export metrics in CSV or Parquet format to an S3 bucket.
In this article, we will see the existing default dashboard and metrics it has. We will also create a new dashboard with free metrics in it.
Pre-requisites
- AWS Account (Create if you don’t have one).
- Basic understanding of S3(Click here to learn about S3)
- A non-root IAM User with "S3StorageLensServiceRolePolicy" policy attached to it(click here to learn to create an IAM user).
What will we do?
- Login to AWS.
- Look at S3 through a default Storage Lens dashboard.
- Create a new dashboard.
Login to AWS
Click here to go to the Login Page. Use a non-root user to log into the account. If you use a root user, you will face issues accessing the Storage Lens service.
Once you successfully login into your AWS account you will see the main console as follows.
Look at S3 through a default Storage Lens dashboard
Storage Lens service comes under S3. Click on "Services" on the left top of the screen and search for "S3".
Here is the main dashboard of your S3 where you can see all the buckets available in your account.
In the left panel click on "Dashboards" under "Storage Lens" to go to the Storage Lens dashboard.
Now, if you tried to access the dashboard using a root-user, you will get an error as follows.
As mentioned previously, we need to use a non-root user.
To learn to create an IAM user, click here. Once you are ready with a non-root user, use it to log back to the account.
Here you can see that now I am logged in using a non-root user who has the necessary permissions for performing operations. Earlier I was logged in using a root user.
Once you log back to the account using a non-root user, you can see the existing default dashboard. The default dashboard is preconfigured by AWS Amazon S3 to help us visualize summarized insights and trends for all our account’s aggregated storage usage and activity metrics on the console.
If you have multiple accounts under your organization you can see Trends of your buckets.
You will see trends of your Buckets from different regions.
Under the storage class tab, you will see trends for the Bucket as per the Storage Class of your buckets.
Under the Bucket tab, you will see trends as per the bucket names.
Create a new dashboard
Click on the dashboard in the left panel to go to the console of Storage Lens service.
To create a new S3 Storage Lens dashboard, click on the "Create dashboard" button.
Specify a name for your dashboard and the region in which this dashboard needs to be created. If you want you can even disable the dashboard so that it doesn't display updated daily metrics. Add tags to your dashboard though this is an optional step.
While creating a dashboard you can include regions and buckets or you can exclude regions and buckets. Here I have selected "Exclude regions and buckets" -- > "Exclude Regions" and selected 2 regions to exclude. By excluding these 2 regions, buckets from these two regions will not be monitored by the dashboard.
You can choose "Free metrics" or "Advanced matrix" for your dashboard.
Click on "Create dashboard" to create your first dashboard in the S3 storage Lens service.
Here you can see that the dashboard has been created and the status of it is enabled.
When you create a new dashboard it at least takes 48 hours to reflect data into it. Since we just created the dashboard that there will be no data available in it.
If you don't want this dashboard you can delete it or disable it. To delete the dashboard click on the "Delete" button
Confirm your deletion action by entering the dashboard name in the text field, and click on the "Delete" button.
Conclusion
In this article, we saw the default dashboard and different options available in it to analyze the S3 buckets and check activity trends. We also saw the steps to create a new dashboard with free metrics.