Using 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.
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.
Select Partner event sources from the side menu.
Enter keywords in the search box to find Game Server Services.
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.
Go to GS2’s Management Console and select Project > Update Settings from the side menu.
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
The list of event sources related to GS2 created in the Partner event sources page of Amazon EventBridge has increased.
Open the event source details and click the button “Associate with event bus”.
Read the description and execute Associate.
When the status becomes Active, it is ready to be used.
Define event rules.
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.
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.
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.
Create a namespace setting specifying EventBridge as the destination for completion notifications.
Confirmation of operation
Set up a simple function registered with AWS Lambda that simply prints the received event.
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.
If you check the execution log, you will see that the function is called.
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.