Skip to content

StorageLensConfiguration

Source: src/AWS/S3Control/StorageLensConfiguration.ts

An Amazon S3 Storage Lens configuration — an account-wide (or organization-wide) storage analytics dashboard aggregating usage and activity metrics across buckets, with optional daily export to S3 or CloudWatch.

Free-metrics dashboard over the whole account

import * as S3Control from "alchemy/AWS/S3Control";
const lens = yield* S3Control.StorageLensConfiguration("account-lens", {});

Dashboard scoped to specific buckets

const lens = yield* S3Control.StorageLensConfiguration("data-lens", {
include: {
Buckets: [bucket.bucketArn],
},
});

Advanced metrics with S3 export

const lens = yield* S3Control.StorageLensConfiguration("advanced-lens", {
accountLevel: {
ActivityMetrics: { IsEnabled: true },
BucketLevel: {
ActivityMetrics: { IsEnabled: true },
},
},
dataExport: {
S3BucketDestination: {
Format: "CSV",
OutputSchemaVersion: "V_1",
AccountId: accountId,
Arn: reportBucket.bucketArn,
},
},
});

Disable a dashboard without deleting it

const lens = yield* S3Control.StorageLensConfiguration("account-lens", {
isEnabled: false,
});