Using Amazon Event Bridge

Using Amazon Event Bridge Extending GS2 functionality with Amazon Event Bridge.

Amazon EventBridge is one of the features provided by AWS. By using this feature, you can connect to components such as Lambda/SQS on AWS to perform additional processing triggered by events that occur in GS2.

How to use

Activate Amazon EventBridge on GS2.

img.png

First, access the AWS management console and open Amazon EventBridge. At this time, make sure to use us-east-1 (N.Verginia) as the region.

img_1.png

Select Partner event sources from the side menu.

img_2.png

Enter keywords in the search box to find Game Server Services.

img_3.png

Select Set up and you will see a simple setup process. Press the “Copy” button next to Your AWS account ID to save the account ID.

img_4.png

Go to GS2’s Management Console and select Project > Update Settings from the side menu.

img_5.png

Enable" AWS EventBridge and enter the information you just copied in the ID of the AWS account to be used for notifications. Set the AWS region for notifications to us-east-1.

This completes the configuration of EventBridge on GS2.

Configure EventBridge to handle events received from GS2 on AWS

img_6.png

The list of event sources related to GS2 created in the Partner event sources page of Amazon EventBridge has increased.

img_7.png

Open the event source details and click the button “Associate with event bus”.

img_8.png

Read the description and execute Associate.

img_9.png

When the status becomes Active, it is ready to be used.

Define event rules.

img_10.png

Select Rules from the side menu. A list of rules will be displayed, so select Create rule.

Select “Create rule”. img_11.png

Select the event source you just Associated for the Event bus and select Next.

img_12.png

Next, write the settings to filter the events received from GS2. For details, please refer to the Amazon EventBridge documentation.

This time, select All events to use all events in subsequent processing.

img_13.png

Next, configure how the received events will be used. In this case, we will use AWS Lambda, so we will set the function we want to execute in Function.

Send the events you want to subscribe to to EventBridge.

img_14.png

Create a namespace setting specifying EventBridge as the destination for completion notifications.

Confirmation of operation

img_15.png

Set up a simple function registered with AWS Lambda that simply prints the received event.

img_16.png

In this case, since we have set up the linkage to EventBridge at the time of account registration, we register the account from the management console.

img_17.png

If you check the execution log, you will see that the function is called.

img_18.png

Checking the details of the log, we can see that information about the registered account and the namespace used to create the account are passed along.

You can then rewrite the function to be registered with AWS Lambda and add any additional processing you wish. In this case, we used Python code, but AWS Lambda supports a variety of other programming languages.

GS2 also provides SDKs for various programming languages, so it is possible to call GS2 functions from AWS Lambda.