Skip to content

Resource: awsCloudwatchEventArchive

Provides an EventBridge event archive resource.

\~> Note: EventBridge was formerly known as CloudWatch Events. The functionality is identical.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCloudwatchEventBusOrder =
  new aws.cloudwatchEventBus.CloudwatchEventBus(this, "order", {
    name: "orders",
  });
const awsCloudwatchEventArchiveOrder =
  new aws.cloudwatchEventArchive.CloudwatchEventArchive(this, "order_1", {
    eventSourceArn: awsCloudwatchEventBusOrder.arn,
    name: "order-archive",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCloudwatchEventArchiveOrder.overrideLogicalId("order");

Example all optional arguments

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCloudwatchEventBusOrder =
  new aws.cloudwatchEventBus.CloudwatchEventBus(this, "order", {
    name: "orders",
  });
const awsCloudwatchEventArchiveOrder =
  new aws.cloudwatchEventArchive.CloudwatchEventArchive(this, "order_1", {
    description: "Archived events from order service",
    eventPattern: '${jsonencode({\n    source = ["company.team.order"]\n  })}',
    eventSourceArn: awsCloudwatchEventBusOrder.arn,
    name: "order-archive",
    retentionDays: 7,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsCloudwatchEventArchiveOrder.overrideLogicalId("order");

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the new event archive. The archive name cannot exceed 48 characters.
  • eventSourceArn - (Required) Event bus source ARN from where these events should be archived.
  • description - (Optional) The description of the new event archive.
  • eventPattern - (Optional) Instructs the new event archive to only capture events matched by this pattern. By default, it attempts to archive every event received in the eventSourceArn.
  • retentionDays - (Optional) The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name (ARN) of the event archive.

Import

Event Archive can be imported using their name, for example

$ terraform import aws_cloudwatch_event_archive.imported_event_archive order-archive