スキップしてコンテンツを表示

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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ