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::Subscriber
Resource type definition for AWS::EventsV2::Subscriber, an Amazon EventBridge subscription that delivers events from an event bus to a target. Canonical identity is the combination of bus, name, and target. Replacement uses delete_then_create.
Syntax
To declare this entity in your Amazon CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::EventsV2::Subscriber", "Properties" : { "BatchConfiguration" :BatchConfiguration, "Description" :String, "EventBusArn" :String, "FilterConfiguration" :FilterConfiguration, "InvokeConfiguration" :InvokeConfiguration, "LogConfiguration" :LogConfiguration, "Name" :String, "OnFailureConfiguration" :OnFailureConfiguration, "PointInTimeConfiguration" :PointInTimeConfiguration, "ResumePosition" :String, "RetryPolicy" :RetryPolicy, "StartingPosition" :String, "State" :String, "Tags" :[ Tag, ... ], "Transformer" :Transformer, "Type" :String} }
YAML
Type: AWS::EventsV2::Subscriber Properties: BatchConfiguration:BatchConfigurationDescription:StringEventBusArn:StringFilterConfiguration:FilterConfigurationInvokeConfiguration:InvokeConfigurationLogConfiguration:LogConfigurationName:StringOnFailureConfiguration:OnFailureConfigurationPointInTimeConfiguration:PointInTimeConfigurationResumePosition:StringRetryPolicy:RetryPolicyStartingPosition:StringState:StringTags:- TagTransformer:TransformerType:String
Properties
BatchConfiguration-
Configuration for batching events into a single delivery to the target.
Required: No
Type: BatchConfiguration
Update requires: No interruption
Description-
A description of the subscriber. Control characters and Unicode line separators are not allowed.
Required: No
Type: String
Pattern:
^[^\u0000-\u001F\u007F-\u009F\u2028\u2029]*(?![\s\S])Maximum:
512Update requires: No interruption
EventBusArn-
The ARN of the event bus this subscriber belongs to.
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:
1Maximum:
1011Update requires: Replacement
FilterConfiguration-
Configuration for filtering which events are delivered to the target. An event must match every filter to be delivered.
Required: No
Type: FilterConfiguration
Update requires: No interruption
InvokeConfiguration-
Configuration for how the subscriber invokes its target, including the target ARN, the IAM role used to invoke it, and, optionally, the target-specific parameters object that matches the target type.
Required: Yes
Type: InvokeConfiguration
Update requires: No interruption
LogConfiguration-
Delivery logging configuration for the subscriber.
Required: No
Type: LogConfiguration
Update requires: No interruption
Name-
The name of the subscriber. The first character must be alphanumeric; the remaining characters may also include '.', '-', and '_'.
Required: Yes
Type: String
Pattern:
^[A-Za-z0-9][\.\-_A-Za-z0-9]*$Minimum:
1Maximum:
256Update requires: Replacement
OnFailureConfiguration-
The destination for events that could not be delivered to the target.
Required: No
Type: OnFailureConfiguration
Update requires: No interruption
PointInTimeConfiguration-
The point in time to start delivering events from. Used when StartingPosition is POINT_IN_TIME.
Required: No
Type: PointInTimeConfiguration
Update requires: Replacement
ResumePosition-
Resume-time control, never returned by the service. Applied only when an update transitions State from STOPPED to RUNNING: LAST_PROCESSED (default) resumes from the last processed event, LATEST skips to the newest. Ignored on create and on any update that does not perform that transition.
Required: No
Type: String
Allowed values:
LAST_PROCESSED | LATESTUpdate requires: No interruption
RetryPolicy-
The retry policy for failed deliveries to the target.
Required: No
Type: RetryPolicy
Update requires: No interruption
StartingPosition-
Where the subscriber starts reading events: LATEST starts from the newest events; POINT_IN_TIME starts from the point specified in PointInTimeConfiguration.
Required: No
Type: String
Allowed values:
LATEST | POINT_IN_TIMEUpdate requires: Replacement
State-
The run state of the subscriber. Events are delivered only while the state is RUNNING. Setting the state to STOPPED pauses delivery. When an update sets a stopped subscriber back to RUNNING, ResumePosition controls where delivery resumes.
Required: No
Type: String
Allowed values:
RUNNING | STOPPEDUpdate requires: No interruption
-
An array of key-value pairs to apply to the subscriber. You can apply a maximum of 50 tags.
For more information about tagging, see Resource tag.
Required: No
Type: Array of Tag
Maximum:
50Update requires: No interruption
Transformer-
Configuration for transforming events before delivery to the target.
Required: No
Type: Transformer
Update requires: No interruption
Type-
The delivery ordering mode of the subscriber. FIFO delivers events in order within an event group; UNORDERED delivers without an ordering guarantee.
Required: No
Type: String
Allowed values:
FIFO | UNORDEREDUpdate requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref function, Ref returns the subscriber Amazon Resource Name (ARN), such as arn:aws:events:us-east-1:123456789012:subscriber/orders-to-queue/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.
BusName-
The name of the event bus that this subscriber belongs to.
CreationTime-
The time the subscriber was created, as an ISO 8601 timestamp.
LastModifiedTime-
The time the subscriber was last modified, as an ISO 8601 timestamp.
SubscriberArn-
The Amazon Resource Name (ARN) of the subscriber.
Examples
The following examples deliver events from an event bus to a target.
Create a minimal subscriber
The following example delivers events to an Amazon SQS queue by using an IAM role.
JSON
{ "Resources": { "OrdersSubscriber": { "Type": "Amazon::EventsV2::Subscriber", "Properties": { "Name": "orders-to-queue", "EventBusArn": "arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m", "InvokeConfiguration": { "TargetArn": "arn:aws:sqs:us-east-1:123456789012:orders-queue", "RoleArn": "arn:aws:iam::123456789012:role/EventBridgeInvokeSqs" } } } } }
YAML
Resources: OrdersSubscriber: Type: Amazon::EventsV2::Subscriber Properties: Name: orders-to-queue EventBusArn: arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m InvokeConfiguration: TargetArn: arn:aws:sqs:us-east-1:123456789012:orders-queue RoleArn: arn:aws:iam::123456789012:role/EventBridgeInvokeSqs
Create a filtered subscriber with batching and retries
The following example delivers matching events to a Lambda function. It batches events, retries failures, sends undeliverable events to an Amazon SQS queue, and logs errors.
JSON
{ "Resources": { "OrdersSubscriber": { "Type": "Amazon::EventsV2::Subscriber", "Properties": { "Name": "orders-to-function", "EventBusArn": "arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m", "Type": "UNORDERED", "InvokeConfiguration": { "TargetArn": "arn:aws:lambda:us-east-1:123456789012:function:ProcessOrders", "RoleArn": "arn:aws:iam::123456789012:role/EventBridgeInvokeLambda", "LambdaParameters": { "InvocationType": "REQUEST_RESPONSE" } }, "FilterConfiguration": { "Filters": [ { "Pattern": "{\"detail-type\":[\"Order Placed\"]}", "Scope": "DATA" } ] }, "BatchConfiguration": { "MaxBatchSize": 10, "MaxBatchWindowInSeconds": 5 }, "RetryPolicy": { "MaxRetryAttempts": 10, "MaxEventAgeInSeconds": 3600, "RetryStrategy": "ALL" }, "OnFailureConfiguration": { "Arn": "arn:aws:sqs:us-east-1:123456789012:orders-dlq" }, "LogConfiguration": { "Level": "ERROR", "IncludePayload": "ON_ERROR_ONLY" } } } } }
YAML
Resources: OrdersSubscriber: Type: Amazon::EventsV2::Subscriber Properties: Name: orders-to-function EventBusArn: arn:aws:events:us-east-1:123456789012:event-busv2/orders-event-bus/a1b2c3d4e5f6g7h8i9j0k1l2m Type: UNORDERED InvokeConfiguration: TargetArn: arn:aws:lambda:us-east-1:123456789012:function:ProcessOrders RoleArn: arn:aws:iam::123456789012:role/EventBridgeInvokeLambda LambdaParameters: InvocationType: REQUEST_RESPONSE FilterConfiguration: Filters: - Pattern: '{"detail-type":["Order Placed"]}' Scope: DATA BatchConfiguration: MaxBatchSize: 10 MaxBatchWindowInSeconds: 5 RetryPolicy: MaxRetryAttempts: 10 MaxEventAgeInSeconds: 3600 RetryStrategy: ALL OnFailureConfiguration: Arn: arn:aws:sqs:us-east-1:123456789012:orders-dlq LogConfiguration: Level: ERROR IncludePayload: ON_ERROR_ONLY