1. Packages
  2. AWS Classic
  3. API Docs
  4. cloudwatch
  5. EventArchive

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.13.2 published on Thursday, Dec 7, 2023 by Pulumi

aws.cloudwatch.EventArchive

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.13.2 published on Thursday, Dec 7, 2023 by Pulumi

    Provides an EventBridge event archive resource.

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

    Example all optional arguments

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const orderEventBus = new aws.cloudwatch.EventBus("orderEventBus", {});
    const orderEventArchive = new aws.cloudwatch.EventArchive("orderEventArchive", {
        description: "Archived events from order service",
        eventSourceArn: orderEventBus.arn,
        retentionDays: 7,
        eventPattern: JSON.stringify({
            source: ["company.team.order"],
        }),
    });
    
    import pulumi
    import json
    import pulumi_aws as aws
    
    order_event_bus = aws.cloudwatch.EventBus("orderEventBus")
    order_event_archive = aws.cloudwatch.EventArchive("orderEventArchive",
        description="Archived events from order service",
        event_source_arn=order_event_bus.arn,
        retention_days=7,
        event_pattern=json.dumps({
            "source": ["company.team.order"],
        }))
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var orderEventBus = new Aws.CloudWatch.EventBus("orderEventBus");
    
        var orderEventArchive = new Aws.CloudWatch.EventArchive("orderEventArchive", new()
        {
            Description = "Archived events from order service",
            EventSourceArn = orderEventBus.Arn,
            RetentionDays = 7,
            EventPattern = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["source"] = new[]
                {
                    "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 {
    		orderEventBus, err := cloudwatch.NewEventBus(ctx, "orderEventBus", nil)
    		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, "orderEventArchive", &cloudwatch.EventArchiveArgs{
    			Description:    pulumi.String("Archived events from order service"),
    			EventSourceArn: orderEventBus.Arn,
    			RetentionDays:  pulumi.Int(7),
    			EventPattern:   pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.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 orderEventBus = new EventBus("orderEventBus");
    
            var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder()        
                .description("Archived events from order service")
                .eventSourceArn(orderEventBus.arn())
                .retentionDays(7)
                .eventPattern(serializeJson(
                    jsonObject(
                        jsonProperty("source", jsonArray("company.team.order"))
                    )))
                .build());
    
        }
    }
    
    resources:
      orderEventBus:
        type: aws:cloudwatch:EventBus
      orderEventArchive:
        type: aws:cloudwatch:EventArchive
        properties:
          description: Archived events from order service
          eventSourceArn: ${orderEventBus.arn}
          retentionDays: 7
          eventPattern:
            fn::toJSON:
              source:
                - company.team.order
    

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var orderEventBus = new Aws.CloudWatch.EventBus("orderEventBus");
    
        var orderEventArchive = new Aws.CloudWatch.EventArchive("orderEventArchive", new()
        {
            EventSourceArn = orderEventBus.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 {
    		orderEventBus, err := cloudwatch.NewEventBus(ctx, "orderEventBus", nil)
    		if err != nil {
    			return err
    		}
    		_, err = cloudwatch.NewEventArchive(ctx, "orderEventArchive", &cloudwatch.EventArchiveArgs{
    			EventSourceArn: orderEventBus.Arn,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.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 orderEventBus = new EventBus("orderEventBus");
    
            var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder()        
                .eventSourceArn(orderEventBus.arn())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_aws as aws
    
    order_event_bus = aws.cloudwatch.EventBus("orderEventBus")
    order_event_archive = aws.cloudwatch.EventArchive("orderEventArchive", event_source_arn=order_event_bus.arn)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const orderEventBus = new aws.cloudwatch.EventBus("orderEventBus", {});
    const orderEventArchive = new aws.cloudwatch.EventArchive("orderEventArchive", {eventSourceArn: orderEventBus.arn});
    
    resources:
      orderEventBus:
        type: aws:cloudwatch:EventBus
      orderEventArchive:
        type: aws:cloudwatch:EventArchive
        properties:
          eventSourceArn: ${orderEventBus.arn}
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var orderEventBus = new Aws.CloudWatch.EventBus("orderEventBus");
    
        var orderEventArchive = new Aws.CloudWatch.EventArchive("orderEventArchive", new()
        {
            Description = "Archived events from order service",
            EventSourceArn = orderEventBus.Arn,
            RetentionDays = 7,
            EventPattern = JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["source"] = new[]
                {
                    "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 {
    		orderEventBus, err := cloudwatch.NewEventBus(ctx, "orderEventBus", nil)
    		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, "orderEventArchive", &cloudwatch.EventArchiveArgs{
    			Description:    pulumi.String("Archived events from order service"),
    			EventSourceArn: orderEventBus.Arn,
    			RetentionDays:  pulumi.Int(7),
    			EventPattern:   pulumi.String(json0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.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 orderEventBus = new EventBus("orderEventBus");
    
            var orderEventArchive = new EventArchive("orderEventArchive", EventArchiveArgs.builder()        
                .description("Archived events from order service")
                .eventSourceArn(orderEventBus.arn())
                .retentionDays(7)
                .eventPattern(serializeJson(
                    jsonObject(
                        jsonProperty("source", jsonArray("company.team.order"))
                    )))
                .build());
    
        }
    }
    
    import pulumi
    import json
    import pulumi_aws as aws
    
    order_event_bus = aws.cloudwatch.EventBus("orderEventBus")
    order_event_archive = aws.cloudwatch.EventArchive("orderEventArchive",
        description="Archived events from order service",
        event_source_arn=order_event_bus.arn,
        retention_days=7,
        event_pattern=json.dumps({
            "source": ["company.team.order"],
        }))
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const orderEventBus = new aws.cloudwatch.EventBus("orderEventBus", {});
    const orderEventArchive = new aws.cloudwatch.EventArchive("orderEventArchive", {
        description: "Archived events from order service",
        eventSourceArn: orderEventBus.arn,
        retentionDays: 7,
        eventPattern: JSON.stringify({
            source: ["company.team.order"],
        }),
    });
    
    resources:
      orderEventBus:
        type: aws:cloudwatch:EventBus
      orderEventArchive:
        type: aws:cloudwatch:EventArchive
        properties:
          description: Archived events from order service
          eventSourceArn: ${orderEventBus.arn}
          retentionDays: 7
          eventPattern:
            fn::toJSON:
              source:
                - company.team.order
    

    Create EventArchive Resource

    new EventArchive(name: string, args: EventArchiveArgs, opts?: CustomResourceOptions);
    @overload
    def EventArchive(resource_name: str,
                     opts: Optional[ResourceOptions] = 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)
    @overload
    def EventArchive(resource_name: str,
                     args: EventArchiveArgs,
                     opts: Optional[ResourceOptions] = 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.
    
    
    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.

    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

    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
    

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.13.2 published on Thursday, Dec 7, 2023 by Pulumi