Enabling Amazon EventBridge - AWS CloudFormation

Enabling Amazon EventBridge

CloudFormation sends events to Amazon EventBridge by default. Specify the rules and targets to match to the events using the CloudFormation console and AWS Command Line Interface (AWS CLI).

When EventBridge receives an event, it applies a rule to route the event to a target. Rules match events to target based on either the structure of the event or on a schedule.

AWS Management Console

  1. To get started, log in to the EventBridge console.

  2. From the navigation pane, select Rules.

  3. Select Create rule.

  4. From the Create rule page, enter the following:

    1. Enter a name and description for the rule.

    2. For Define pattern, choose Event pattern.

      Select, Pre-defined pattern by service followed by, AWS, CloudFormation, and your event type.

    3. For Select event bus, choose AWS default event bus. You can only create scheduled rules on the default event bus.

    4. For Select targets, choose Batch job queue and specify the following fields appropriately:

      • Job queue: Enter the Amazon Resource Name (ARN) of the job queue to schedule your job in.

      • Job definition: Enter the name and revision or full ARN of the job definition to use for your job.

      • Job name: Enter a name for your job.

      • Array size: (Optional) Enter an array size for your job to run more than one copy.

      • Job attempts: (Optional) Enter the number of times to retry your job if it fails.

  5. For Batch job queue target types, EventBridge needs permission to send events to the target. EventBridge can create the IAM role needed for your rule to run. Do one of these things:

    • To create an IAM role automatically, choose Create a new role for this specific resource.

    • To use an IAM role that you created before, choose Use existing role.

  6. For Retry policy and dead-letter queue:, under Retry policy:

    1. For Maximum age of event, enter a value between 1 minute (00:01) and 24 hours (24:00).

    2. For Retry attempts, enter a number between 0 and 185.

  7. For Dead-letter queue, choose whether to use a standard Amazon SQS queue as a dead-letter queue. EventBridge sends events that match this rule to the dead-letter queue if it can't deliver them to the target. Do one of the following:

    • Choose None to not use a dead-letter queue.

    • Choose Select an Amazon SQS queue in the current AWS account to use as the dead-letter queue and then select the queue to use from the drop down list.

    • Choose Select an Amazon SQS queue in an other AWS account as a dead-letter queue and then enter the ARN of the queue to use. You must attach a resource-based policy to the queue that grants EventBridge permission to send messages to it.

  8. (Optional) Enter one or more tags for the rule.

  9. Choose Create.

EventBridge Event pattern

The following are examples event patterns used in the EventBridge console. Use these to create rules and send notifications.

Resource status event

The following example sends a notification to Amazon EventBridge when an event causes a change in the resource status.


                        Resource status event.

Stack status event

The following example sends a notification to Amazon EventBridge when an event causes a change in the stack status.


                        Stack status event.

Drift detection status event

The following example sends a notification to Amazon EventBridge when drift detection identifies a status event.


                        Drift detection status event.

StackSet status event

The following example sends a notification to Amazon EventBridge when an event causes a change in the StackSet status.


                        StackSet status event.

StackSet stack instance status event

The following example sends a notification to Amazon EventBridge when an event causes a change in the StackSet stack instance status.


                        StackSet stack instance status event.

StackSet operation status event

The following example sends a notification to Amazon EventBridge when an event causes a change in the StackSet operation status.


                        StackSet operation status event.

AWS CLI

Use the create-stack, update-stack, and delete-stack to send the generated events to Amazon EventBridge.

The following example creates a stack and sends a notification to Amazon EventBridge .

aws cloudformation create-stack --stack-name myteststack --template-body file://sampletemplate.json --parameters ParameterKey=KeyPairName,ParameterValue=TestKey ParameterKey=SubnetIDs,ParameterValue=SubnetID1\\,SubnetID2

The following example updates a stack and sends a notification to Amazon EventBridge .

aws cloudformation update-stack --stack-name myteststack --template-url https://s3.amazonaws.com/sample/sampletemplate.json --parameters ParameterKey=KeyPairName,ParameterValue=SampleKeyPair ParameterKey=SubnetIDs,ParameterValue=SampleSubnetID1\\,SampleSubnetID2

The following example deletes a stack and sends a notification to Amazon EventBridge .

aws cloudformation delete-stack --stack-name myteststack

The following example detects drift on a stack and sends a notification to Amazon EventBridge.

aws cloudformation detect-stack-drift --stack-name myteststack

Amazon EventBridge permissions

AWS CloudFormation doesn't require any additional permissions to deliver events to Amazon EventBridge.

The events contain information which is already available through CloudFormation's API operations.

Amazon EventBridge troubleshooting

For information about how to troubleshoot EventBridge, see Troubleshooting Amazon EventBridge in the Amazon EventBridge User Guide.