내용으로 건너뛰기

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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠