Event Archive Args
data class EventArchiveArgs(val description: Output<String>? = null, val eventPattern: Output<String>? = null, val eventSourceArn: Output<String>? = null, val name: Output<String>? = null, val retentionDays: Output<Int>? = null) : ConvertibleToJava<EventArchiveArgs>
Provides an EventBridge event archive resource.
Note: EventBridge was formerly known as CloudWatch Events. The functionality is identical.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const order = new aws.cloudwatch.EventBus("order", {name: "orders"});
const orderEventArchive = new aws.cloudwatch.EventArchive("order", {
name: "order-archive",
eventSourceArn: order.arn,
});
Content copied to clipboard
import pulumi
import pulumi_aws as aws
order = aws.cloudwatch.EventBus("order", name="orders")
order_event_archive = aws.cloudwatch.EventArchive("order",
name="order-archive",
event_source_arn=order.arn)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var order = new Aws.CloudWatch.EventBus("order", new()
{
Name = "orders",
});
var orderEventArchive = new Aws.CloudWatch.EventArchive("order", new()
{
Name = "order-archive",
EventSourceArn = order.Arn,
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
order, err := cloudwatch.NewEventBus(ctx, "order", &cloudwatch.EventBusArgs{
Name: pulumi.String("orders"),
})
if err != nil {
return err
}
_, err = cloudwatch.NewEventArchive(ctx, "order", &cloudwatch.EventArchiveArgs{
Name: pulumi.String("order-archive"),
EventSourceArn: order.Arn,
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventBus;
import com.pulumi.aws.cloudwatch.EventBusArgs;
import com.pulumi.aws.cloudwatch.EventArchive;
import com.pulumi.aws.cloudwatch.EventArchiveArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var order = new EventBus("order", EventBusArgs.builder()
.name("orders")
.build());
var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder()
.name("order-archive")
.eventSourceArn(order.arn())
.build());
}
}
Content copied to clipboard
resources:
order:
type: aws:cloudwatch:EventBus
properties:
name: orders
orderEventArchive:
type: aws:cloudwatch:EventArchive
name: order
properties:
name: order-archive
eventSourceArn: ${order.arn}
Content copied to clipboard
Example all optional arguments
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const order = new aws.cloudwatch.EventBus("order", {name: "orders"});
const orderEventArchive = new aws.cloudwatch.EventArchive("order", {
name: "order-archive",
description: "Archived events from order service",
eventSourceArn: order.arn,
retentionDays: 7,
eventPattern: JSON.stringify({
source: ["company.team.order"],
}),
});
Content copied to clipboard
import pulumi
import json
import pulumi_aws as aws
order = aws.cloudwatch.EventBus("order", name="orders")
order_event_archive = aws.cloudwatch.EventArchive("order",
name="order-archive",
description="Archived events from order service",
event_source_arn=order.arn,
retention_days=7,
event_pattern=json.dumps({
"source": ["company.team.order"],
}))
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var order = new Aws.CloudWatch.EventBus("order", new()
{
Name = "orders",
});
var orderEventArchive = new Aws.CloudWatch.EventArchive("order", new()
{
Name = "order-archive",
Description = "Archived events from order service",
EventSourceArn = order.Arn,
RetentionDays = 7,
EventPattern = JsonSerializer.Serialize(new Dictionary<string, object?>
{
["source"] = new[]
{
"company.team.order",
},
}),
});
});
Content copied to clipboard
package main
import (
"encoding/json"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cloudwatch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
order, err := cloudwatch.NewEventBus(ctx, "order", &cloudwatch.EventBusArgs{
Name: pulumi.String("orders"),
})
if err != nil {
return err
}
tmpJSON0, err := json.Marshal(map[string]interface{}{
"source": []string{
"company.team.order",
},
})
if err != nil {
return err
}
json0 := string(tmpJSON0)
_, err = cloudwatch.NewEventArchive(ctx, "order", &cloudwatch.EventArchiveArgs{
Name: pulumi.String("order-archive"),
Description: pulumi.String("Archived events from order service"),
EventSourceArn: order.Arn,
RetentionDays: pulumi.Int(7),
EventPattern: pulumi.String(json0),
})
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.EventBus;
import com.pulumi.aws.cloudwatch.EventBusArgs;
import com.pulumi.aws.cloudwatch.EventArchive;
import com.pulumi.aws.cloudwatch.EventArchiveArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var order = new EventBus("order", EventBusArgs.builder()
.name("orders")
.build());
var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder()
.name("order-archive")
.description("Archived events from order service")
.eventSourceArn(order.arn())
.retentionDays(7)
.eventPattern(serializeJson(
jsonObject(
jsonProperty("source", jsonArray("company.team.order"))
)))
.build());
}
}
Content copied to clipboard
resources:
order:
type: aws:cloudwatch:EventBus
properties:
name: orders
orderEventArchive:
type: aws:cloudwatch:EventArchive
name: order
properties:
name: order-archive
description: Archived events from order service
eventSourceArn: ${order.arn}
retentionDays: 7
eventPattern:
fn::toJSON:
source:
- company.team.order
Content copied to clipboard
Import
Using pulumi import
, import an EventBridge archive using the name
. For example:
$ pulumi import aws:cloudwatch/eventArchive:EventArchive imported_event_archive order-archive
Content copied to clipboard
Constructors
Properties
Link copied to clipboard
The description of the new event archive.
Link copied to clipboard
Instructs the new event archive to only capture events matched by this pattern. By default, it attempts to archive every event received in the event_source_arn
.
Link copied to clipboard
Event bus source ARN from where these events should be archived.
Link copied to clipboard
The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.