- Newest
- Most votes
- Most comments
Thank you for the detailed description.
As you've already mentioned, you can only create scheduled rules using the default event bus [1]. And there's no other obvious solution to run Lambda periodically.
In my opinion, it doesn't really matter on which bus we associate with a scheduled rule, as it will not look into the bus events. In your case, it would be possible for Lambda to publish events onto the other custom bus after being triggered from the default bus.
As Weidi correctly mentioned, even though the lambda gets triggered by a scheduler event on the default bus, the lambda can put events on any custom bus
You can take a look at this workshop https://catalog.us-east-1.prod.workshops.aws/workshops/63320e83-6abc-493d-83d8-f822584fb3cb/en-US for hands-on labs on Eventbridge.
An example of Python code that puts events in a custom event bus called Orders is available in the lab:
import boto3 client = boto3.client('events')
event_bus_name = 'Orders' source = 'com.aws.orders' detail_type = 'Order Notification' detail = '{"category":"lab-supplies","value":415,"location":"eu-west"}'
try: response = client.put_events( Entries=[ { 'Source': source, 'DetailType': detail_type, 'Detail': detail, 'EventBusName': event_bus_name } ] ) print('Event sent to the event bus ' + event_bus_name) print('EventID is ' + response['Entries'][0]['EventId']) except Exception as e: print(e)
A Javascript example from the same lab is below:
// ES6+ example import { EventBridgeClient, PutEventsCommand } from "@aws-sdk/client-eventbridge"; const client = new EventBridgeClient(); const params = { Entries: [ { Detail: { "category": "lab-supplies", "value": 415, "location": "eu-west" }, DetailType: "Order Notification", EventBusName: "Orders", Source: "com.aws.orders" } ] }; const command = new PutEventsCommand(params); const response = await client.send(command);
Relevant content
- Accepted Answerasked 2 years ago
- Accepted Answerasked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago