View a markdown version of this page

AWS::EventsV2::EventSource - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

This is the new Amazon CloudFormation Template Reference Guide. Please update your bookmarks and links. For help getting started with CloudFormation, see the Amazon CloudFormation User Guide.

AWS::EventsV2::EventSource

Resource schema for AWS::EventsV2::EventSource. A managed event source that forwards Amazon service events or partner events onto a custom event bus.

Syntax

To declare this entity in your Amazon CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::EventsV2::EventSource", "Properties" : { "Configuration" : EventSourceConfiguration, "Description" : String, "EventBusArn" : String, "Name" : String, "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::EventsV2::EventSource Properties: Configuration: EventSourceConfiguration Description: String EventBusArn: String Name: String Tags: - Tag

Properties

Configuration

The event source configuration. Specify exactly one of AwsServiceEventsConfiguration or PartnerEventsConfiguration.

Required: Yes

Type: EventSourceConfiguration

Update requires: No interruption

Description

A description of the event source. Control characters and Unicode line separators are not allowed.

Required: No

Type: String

Pattern: ^[^\u0000-\u001F\u007F-\u009F\u2028\u2029]*(?![\s\S])

Maximum: 512

Update requires: No interruption

EventBusArn

The ARN of the custom event bus the event source forwards onto.

Required: Yes

Type: String

Pattern: ^arn:aws(-[a-z0-9]+)*:events:[a-z][a-z0-9]*(-[a-z0-9]+)*:([0-9]{12}):event-busv2\/[A-Za-z0-9][\.\-_A-Za-z0-9]{0,255}\/[a-z0-9]{25}$

Minimum: 1

Maximum: 1011

Update requires: Replacement

Name

The name of the event source. The first character must be alphanumeric; the remaining characters may also include '.', '-', and '_'. Names cannot begin with the reserved aws. prefix.

Required: Yes

Type: String

Pattern: ^(?!aws\.)[A-Za-z0-9][\.\-_A-Za-z0-9]*$

Minimum: 1

Maximum: 256

Update requires: Replacement

Tags

An array of key-value pairs to apply to the event source. You can apply a maximum of 50 tags.

For more information about tagging, see Resource tag.

Required: No

Type: Array of Tag

Maximum: 50

Update requires: No interruption

Return values

Ref

When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the event source Amazon Resource Name (ARN), such as arn:aws:events:us-east-1:123456789012:event-sourcev2/aws.service/s3-events/a1b2c3d4e5f6g7h8i9j0k1l2m.

For more information about using the Ref function, see Ref.

Fn::GetAtt

The Fn::GetAtt intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.

For more information about using Fn::GetAtt, see Fn::GetAtt.

CreationTime

The time the event source was created, as an ISO 8601 timestamp.

EventSourceArn

The Amazon Resource Name (ARN) of the event source.

LastModifiedTime

The time the event source was last modified, as an ISO 8601 timestamp.

Revoked

Whether the event bus owner has revoked this event source. Revocation is permanent. You can delete a revoked event source, but you can't update it.

State

The current lifecycle state of the event source, such as ACTIVE. The Revoked attribute, not the state, indicates whether the event bus owner has revoked the event source.

Examples

The following examples forward events to a custom event bus.

Forward all events from an Amazon EventBridge service source

The following example forwards all Amazon S3 events from the account's default event bus to a custom event bus.

JSON

{ "Resources": { "S3EventSource": { "Type": "Amazon::EventsV2::EventSource", "Properties": { "Name": "s3-events", "EventBusArn": "arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m", "Configuration": { "AwsServiceEventsConfiguration": { "AwsService": "aws.s3" } } } } } }

YAML

Resources: S3EventSource: Type: Amazon::EventsV2::EventSource Properties: Name: s3-events EventBusArn: arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m Configuration: AwsServiceEventsConfiguration: AwsService: aws.s3

Filter forwarded events and set a failure destination

The following example forwards only matching Amazon S3 events and sends undeliverable events to an Amazon SQS queue.

JSON

{ "Resources": { "S3EventSource": { "Type": "Amazon::EventsV2::EventSource", "Properties": { "Name": "s3-object-created", "EventBusArn": "arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m", "Configuration": { "AwsServiceEventsConfiguration": { "AwsService": "aws.s3", "Pattern": "{\"detail-type\":[\"Object Created\"]}", "OnFailureConfiguration": { "Arn": "arn:aws:sqs:us-east-1:123456789012:event-source-dlq" } } } } } } }

YAML

Resources: S3EventSource: Type: Amazon::EventsV2::EventSource Properties: Name: s3-object-created EventBusArn: arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m Configuration: AwsServiceEventsConfiguration: AwsService: aws.s3 Pattern: '{"detail-type":["Object Created"]}' OnFailureConfiguration: Arn: arn:aws:sqs:us-east-1:123456789012:event-source-dlq

Forward a partner event source

The following example forwards events from a partner event source through a managed partner event bus.

JSON

{ "Resources": { "PartnerEventSource": { "Type": "Amazon::EventsV2::EventSource", "Properties": { "Name": "example-partner-source", "EventBusArn": "arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m", "Configuration": { "PartnerEventsConfiguration": { "PartnerEventSourceArn": "arn:aws:events:us-east-1::event-source/aws.partner/examplepartner.com/1234567890/example-source" } } } } } }

YAML

Resources: PartnerEventSource: Type: Amazon::EventsV2::EventSource Properties: Name: example-partner-source EventBusArn: arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m Configuration: PartnerEventsConfiguration: PartnerEventSourceArn: arn:aws:events:us-east-1::event-source/aws.partner/examplepartner.com/1234567890/example-source