Integrate with Amazon EventBridge

SaaSus Platform is integrated with Amazon EventBridge. Various events that occur on the SaaSus Platform can be sent to Amazon EventBridge in the SaaS-side AWS account as a partner event source. By leveraging this, SaaS can be built with an event-driven architecture that works in conjunction with SaaSus Platform.

For example, it can be used to trigger a tenant onboarding process when a SaaS tenant is created, or to trigger the deletion of accompanying data when a user is deleted. Currently, you can retrieve events for all SaaSus APIs. Please check API Reference for the contents of each API.

How to integrate with Amazon EventBridge

Open the Event Linkage Screen of the SaaS Development Console.

1274

In the AWS Account ID section, enter the AWS account ID (the 12-digit ID of the AWS account on which the SaaS is built) to which the event is sent. Also, select the AWS region where you would like to receive notifications. Then press the Save button.

1274

A partner event path will be created on the AWS account configured above. After logging into the relevant AWS account, open the Amazon EventBridge Partner Event Source Console and verify that the Partner Event Source has been created.

2372

Select the created partner event source and "Associate with Event Bus". It will then be available for use on the Event Bus just like any other event source.

2190

Next, let's try sending an event. Open the Amazon EventBridge Bus Rules page. On this screen, you should be able to select the partner event source from earlier as an event bus.

2812

Create rules based on this event bus. Let's set it up as shown in the following screen.
First, select the SaaSus Platform event bus and click Create Rule. On each screen, try to enter the information referring to the following screen.

2818 2072 2042

In the event pattern section, first describe the following pattern to get all SaaSus Platform events. Click on the "Edit Pattern" button and enter the following JSON directly.

1550 1584
{
  "source": [{
    "prefix": "aws.partner/saasus.io"
  }]
}

In this case, all events are retrieved, but of course, you can filter events to retrieve only those for specific API calls.

In this case, let's output all events to CloudWatch Logs to see what kind of events are delivered.

2076 2086

After all settings are complete, click Create Rule and confirm that the rule has been created.

1886 2812

Now that we are ready to link events, let's send a test event: return to the SaaSus development console and click the Send Test button.

2648

If the event arrives successfully, the event should be recorded in CloudWatch Logs. Let's check it.

2710

We are now able to retrieve events in this manner.

In this case, we linked to CloudWatch Logs, but it is possible to link events to various targets such as Lambda and other APIs. This allows us to apply an event-driven architecture, separating where the SaaSus API was called from and when it was called, and what should be done as a result and when.

The "detail" entry contains a "trace_id". This is the same as the one specified at the time of the SaaSus API request or the one generated automatically, so you can trace which API call caused the event. can be traced.