# BaseArchiveProps

The event archive base properties.

Used as argument in: [IEventBus.archive](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.IEventBus.html#archive)

- Source: [`aws-events/lib/archive.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-events/lib/archive.ts#L16)
- Type last changed: v2.214.0 · 2 Sep 2025

## Example

TypeScript:

```ts
const bus = new events.EventBus(this, 'bus', {
  eventBusName: 'MyCustomEventBus',
  description: 'MyCustomEventBus',
});

bus.archive('MyArchive', {
  archiveName: 'MyCustomEventBusArchive',
  description: 'MyCustomerEventBus Archive',
  eventPattern: {
    account: [Stack.of(this).account],
  },
  retention: Duration.days(365),
});
```

Python:

```python
bus = events.EventBus(self, "bus",
    event_bus_name="MyCustomEventBus",
    description="MyCustomEventBus"
)

bus.archive("MyArchive",
    archive_name="MyCustomEventBusArchive",
    description="MyCustomerEventBus Archive",
    event_pattern=events.EventPattern(
        account=[Stack.of(self).account]
    ),
    retention=Duration.days(365)
)
```

Java:

```java
EventBus bus = EventBus.Builder.create(this, "bus")
        .eventBusName("MyCustomEventBus")
        .description("MyCustomEventBus")
        .build();

bus.archive("MyArchive", BaseArchiveProps.builder()
        .archiveName("MyCustomEventBusArchive")
        .description("MyCustomerEventBus Archive")
        .eventPattern(EventPattern.builder()
                .account(List.of(Stack.of(this).getAccount()))
                .build())
        .retention(Duration.days(365))
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var bus = new EventBus(this, "bus", new EventBusProps {
    EventBusName = "MyCustomEventBus",
    Description = "MyCustomEventBus"
});

bus.Archive("MyArchive", new BaseArchiveProps {
    ArchiveName = "MyCustomEventBusArchive",
    Description = "MyCustomerEventBus Archive",
    EventPattern = new EventPattern {
        Account = new [] { Stack.Of(this).Account }
    },
    Retention = Duration.Days(365)
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
bus := events.NewEventBus(this, jsii.String("bus"), &EventBusProps{
	EventBusName: jsii.String("MyCustomEventBus"),
	Description: jsii.String("MyCustomEventBus"),
})

bus.archive(jsii.String("MyArchive"), &BaseArchiveProps{
	ArchiveName: jsii.String("MyCustomEventBusArchive"),
	Description: jsii.String("MyCustomerEventBus Archive"),
	EventPattern: &EventPattern{
		Account: []*string{
			awscdk.*stack_Of(this).Account,
		},
	},
	Retention: awscdk.Duration_Days(jsii.Number(365)),
})
```

## Properties

- `archiveName`: string — The name of the archive.

  **Default:** Automatically generated

- `description`: string = none — A description for the archive.

- `eventPattern`: [EventPattern](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.EventPattern.html) (required) — An event pattern to use to filter events sent to the archive.

- `kmsKey`: [IKey](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kms.IKey.html) — The customer managed key that encrypts this archive.

  **Default:** Use an AWS managed key

- `retention`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Infinite — The number of days to retain events for.

  Default value is 0. If set to 0, events are retained indefinitely.
