1. Packages
  2. AWS
  3. API Docs
  4. cloudwatch
  5. EventArchive
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

aws.cloudwatch.EventArchive

Explore with Pulumi AI

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    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,
    });
    
    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)
    
    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
    	})
    }
    
    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,
        });
    
    });
    
    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());
    
        }
    }
    
    resources:
      order:
        type: aws:cloudwatch:EventBus
        properties:
          name: orders
      orderEventArchive:
        type: aws:cloudwatch:EventArchive
        name: order
        properties:
          name: order-archive
          eventSourceArn: ${order.arn}
    

    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"],
        }),
    });
    
    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"],
        }))
    
    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
    	})
    }
    
    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",
                },
            }),
        });
    
    });
    
    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());
    
        }
    }
    
    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
    

    Create EventArchive Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new EventArchive(name: string, args: EventArchiveArgs, opts?: CustomResourceOptions);
    @overload
    def EventArchive(resource_name: str,
                     args: EventArchiveArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def EventArchive(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     event_source_arn: Optional[str] = None,
                     description: Optional[str] = None,
                     event_pattern: Optional[str] = None,
                     name: Optional[str] = None,
                     retention_days: Optional[int] = None)
    func NewEventArchive(ctx *Context, name string, args EventArchiveArgs, opts ...ResourceOption) (*EventArchive, error)
    public EventArchive(string name, EventArchiveArgs args, CustomResourceOptions? opts = null)
    public EventArchive(String name, EventArchiveArgs args)
    public EventArchive(String name, EventArchiveArgs args, CustomResourceOptions options)
    
    type: aws:cloudwatch:EventArchive
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args EventArchiveArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args EventArchiveArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args EventArchiveArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EventArchiveArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EventArchiveArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var eventArchiveResource = new Aws.CloudWatch.EventArchive("eventArchiveResource", new()
    {
        EventSourceArn = "string",
        Description = "string",
        EventPattern = "string",
        Name = "string",
        RetentionDays = 0,
    });
    
    example, err := cloudwatch.NewEventArchive(ctx, "eventArchiveResource", &cloudwatch.EventArchiveArgs{
    	EventSourceArn: pulumi.String("string"),
    	Description:    pulumi.String("string"),
    	EventPattern:   pulumi.String("string"),
    	Name:           pulumi.String("string"),
    	RetentionDays:  pulumi.Int(0),
    })
    
    var eventArchiveResource = new EventArchive("eventArchiveResource", EventArchiveArgs.builder()
        .eventSourceArn("string")
        .description("string")
        .eventPattern("string")
        .name("string")
        .retentionDays(0)
        .build());
    
    event_archive_resource = aws.cloudwatch.EventArchive("eventArchiveResource",
        event_source_arn="string",
        description="string",
        event_pattern="string",
        name="string",
        retention_days=0)
    
    const eventArchiveResource = new aws.cloudwatch.EventArchive("eventArchiveResource", {
        eventSourceArn: "string",
        description: "string",
        eventPattern: "string",
        name: "string",
        retentionDays: 0,
    });
    
    type: aws:cloudwatch:EventArchive
    properties:
        description: string
        eventPattern: string
        eventSourceArn: string
        name: string
        retentionDays: 0
    

    EventArchive Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The EventArchive resource accepts the following input properties:

    EventSourceArn string
    Event bus source ARN from where these events should be archived.
    Description string
    The description of the new event archive.
    EventPattern string
    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.
    Name string
    The name of the new event archive. The archive name cannot exceed 48 characters.
    RetentionDays int
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    EventSourceArn string
    Event bus source ARN from where these events should be archived.
    Description string
    The description of the new event archive.
    EventPattern string
    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.
    Name string
    The name of the new event archive. The archive name cannot exceed 48 characters.
    RetentionDays int
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    eventSourceArn String
    Event bus source ARN from where these events should be archived.
    description String
    The description of the new event archive.
    eventPattern String
    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.
    name String
    The name of the new event archive. The archive name cannot exceed 48 characters.
    retentionDays Integer
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    eventSourceArn string
    Event bus source ARN from where these events should be archived.
    description string
    The description of the new event archive.
    eventPattern string
    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.
    name string
    The name of the new event archive. The archive name cannot exceed 48 characters.
    retentionDays number
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    event_source_arn str
    Event bus source ARN from where these events should be archived.
    description str
    The description of the new event archive.
    event_pattern str
    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.
    name str
    The name of the new event archive. The archive name cannot exceed 48 characters.
    retention_days int
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    eventSourceArn String
    Event bus source ARN from where these events should be archived.
    description String
    The description of the new event archive.
    eventPattern String
    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.
    name String
    The name of the new event archive. The archive name cannot exceed 48 characters.
    retentionDays Number
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the EventArchive resource produces the following output properties:

    Arn string
    The Amazon Resource Name (ARN) of the event archive.
    Id string
    The provider-assigned unique ID for this managed resource.
    Arn string
    The Amazon Resource Name (ARN) of the event archive.
    Id string
    The provider-assigned unique ID for this managed resource.
    arn String
    The Amazon Resource Name (ARN) of the event archive.
    id String
    The provider-assigned unique ID for this managed resource.
    arn string
    The Amazon Resource Name (ARN) of the event archive.
    id string
    The provider-assigned unique ID for this managed resource.
    arn str
    The Amazon Resource Name (ARN) of the event archive.
    id str
    The provider-assigned unique ID for this managed resource.
    arn String
    The Amazon Resource Name (ARN) of the event archive.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing EventArchive Resource

    Get an existing EventArchive resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: EventArchiveState, opts?: CustomResourceOptions): EventArchive
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            description: Optional[str] = None,
            event_pattern: Optional[str] = None,
            event_source_arn: Optional[str] = None,
            name: Optional[str] = None,
            retention_days: Optional[int] = None) -> EventArchive
    func GetEventArchive(ctx *Context, name string, id IDInput, state *EventArchiveState, opts ...ResourceOption) (*EventArchive, error)
    public static EventArchive Get(string name, Input<string> id, EventArchiveState? state, CustomResourceOptions? opts = null)
    public static EventArchive get(String name, Output<String> id, EventArchiveState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Arn string
    The Amazon Resource Name (ARN) of the event archive.
    Description string
    The description of the new event archive.
    EventPattern string
    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.
    EventSourceArn string
    Event bus source ARN from where these events should be archived.
    Name string
    The name of the new event archive. The archive name cannot exceed 48 characters.
    RetentionDays int
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    Arn string
    The Amazon Resource Name (ARN) of the event archive.
    Description string
    The description of the new event archive.
    EventPattern string
    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.
    EventSourceArn string
    Event bus source ARN from where these events should be archived.
    Name string
    The name of the new event archive. The archive name cannot exceed 48 characters.
    RetentionDays int
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    arn String
    The Amazon Resource Name (ARN) of the event archive.
    description String
    The description of the new event archive.
    eventPattern String
    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.
    eventSourceArn String
    Event bus source ARN from where these events should be archived.
    name String
    The name of the new event archive. The archive name cannot exceed 48 characters.
    retentionDays Integer
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    arn string
    The Amazon Resource Name (ARN) of the event archive.
    description string
    The description of the new event archive.
    eventPattern string
    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.
    eventSourceArn string
    Event bus source ARN from where these events should be archived.
    name string
    The name of the new event archive. The archive name cannot exceed 48 characters.
    retentionDays number
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    arn str
    The Amazon Resource Name (ARN) of the event archive.
    description str
    The description of the new event archive.
    event_pattern str
    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.
    event_source_arn str
    Event bus source ARN from where these events should be archived.
    name str
    The name of the new event archive. The archive name cannot exceed 48 characters.
    retention_days int
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.
    arn String
    The Amazon Resource Name (ARN) of the event archive.
    description String
    The description of the new event archive.
    eventPattern String
    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.
    eventSourceArn String
    Event bus source ARN from where these events should be archived.
    name String
    The name of the new event archive. The archive name cannot exceed 48 characters.
    retentionDays Number
    The maximum number of days to retain events in the new event archive. By default, it archives indefinitely.

    Import

    Using pulumi import, import an EventBridge archive using the name. For example:

    $ pulumi import aws:cloudwatch/eventArchive:EventArchive imported_event_archive order-archive
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi