Skip to content

EventDataStore

Source: src/AWS/CloudTrail/EventDataStore.ts

A CloudTrail Lake event data store — an immutable collection of events that can be queried with SQL via CloudTrail Lake.

Deleting an event data store schedules it for deletion (PENDING_DELETION); AWS purges it after a seven-day wait period during which it incurs no cost. If a store with the same name is still pending deletion, the reconciler restores it instead of creating a duplicate.

Basic Event Data Store

import * as AWS from "alchemy/AWS";
const store = yield* AWS.CloudTrail.EventDataStore("Lake", {
retentionPeriod: "7 days",
terminationProtectionEnabled: false,
});

Single-Region Store with Custom Selectors

const store = yield* AWS.CloudTrail.EventDataStore("S3DataEvents", {
multiRegionEnabled: false,
retentionPeriod: "30 days",
terminationProtectionEnabled: false,
advancedEventSelectors: [
{
name: "S3 data events",
fieldSelectors: [
{ field: "eventCategory", equals: ["Data"] },
{ field: "resources.type", equals: ["AWS::S3::Object"] },
],
},
],
});