{S3}コンソールと API を使用した Amazon S3 Storage Lens の使用

-- 1. コマンド等のインストール

-- 1.1 aws cli version 2 インストール

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
aws --version


-- 2. Amazon S3 Storage Lens 設定

-- S3 Storage Lens 設定を配置する

vim a.json
{
    "Id": "slc01",
     "AccountLevel": {
        "BucketLevel": { }
     },
     "IsEnabled": true
}


aws s3control put-storage-lens-configuration \
--account-id=999999999999 \
--config-id=slc01 \
--storage-lens-configuration=file://a.json


-- S3 Storage Lens 設定を取得する

aws s3control get-storage-lens-configuration \
--account-id=999999999999 \
--config-id=slc01


-- S3 Storage Lens 設定を一覧表示する

aws s3control list-storage-lens-configurations \
--account-id=999999999999


-- 3. 動作確認

ダッシュボードの作成から 48 時間後にグラフにデータが表示されます。

 

-- 4. クリーンアップ

-- S3 Storage Lens 設定を削除する
aws s3control delete-storage-lens-configuration \
--account-id=999999999999 \
--config-id=slc01