跳至內容

how to query in cloud watch to get the details of Non current version bytes.

0

hello all, I want to know the data size of Non current version bytes for a specific bucket and folder. I have checked in cloud watch but I didn't get a correct filter and query. Requesting someone to provide a proper query to get the details of non current version in cloud watch.

1 個回答
0
已接受的答案

You can refer to the S3 storage metrics provided by CloudWatch, like BucketSizeBytes and NumberOfObjects,but these metrics might not offer the granularity you want, as they are for the entire bucket and don't distinguish between current and non-current versions.However, you can use a combination of S3, S3 Inventory, and possibly Athena to get the details of non current versions. Here are the steps:

  1. Go to the S3 bucket, under the Management tab, set up an inventory which includes the IsLatest and Size fields and export S3 Inventory to a location.
  2. Once you have the inventory files in S3, you can set up an Athena table to query these files.
    • Using Athena, you can then query for all the objects where IsLatest is false (meaning they are non-current versions), sum up their sizes, and filter by the specific folder if needed.

Here is an example athena query:

SELECT SUM(size) as TotalNonCurrentVersionBytes
FROM s3_inventory_table
WHERE is_latest = 'false' AND key LIKE 'your-folder-name/%';

This would give you the total size of non-current version bytes for the specified folder.

AWS
已回答 2 年前
專家
已審閱 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。