How to restart a GameLift Realtime server instance on command

0

We're building a (web) game using AWS GameLift with a "Realtime server" for the multiplayer backend.

We'd like to update any instances of the script in our fleet when a new version of the script is available (either directly or after a timeout), so that the script can be updated. However, we haven't found any mechanism to do so.

Updating the script itself doesn't cause any restarts. We can manually kill the server by calling process.exit(0);, but outside of a cron job inside the realtime script, this is pretty cumbersome to trigger remotely (not to mention hard to do securely).

An option is to destroy the fleet altogether and create a new one, but that requires a lot of fleet permission management, as well as updating the fleet ID's where they're used (mostly in the "classic" backend that logs in players and connects them to the fleet).

Is there any way to restart Realtime server instances by an (external) trigger? Or to call any functions in the script externally at all?

Bas
asked a month ago472 views
1 Answer
0

Hi Bas,

Yes, updating a script will not terminate existing game sessions, but the new version of the script will be used for new game sessions. If you would like to terminate existing game sessions (processes) during an update, there might be a risk of interrupting existing players in the game session, so it's not ideal in some use cases. If it is required by your use case, then the way is like what you described, which is to remotely trigger the script to end the process (and potentially handle player interruptions before termination).

The other option will be to scale down the number of instances to 0 and scale up again, which might take several minutes to complete.

Creating a new fleet will also work, and for this option, you can use the Alias feature to simplify the process. An Amazon GameLift alias is used to abstract a fleet designation, you can use an Alias that points to a fleet when creating game sessions/using game session queues, and to shift the traffic to a new fleet you can simple update the Alias. See details: https://docs.aws.amazon.com/gamelift/latest/developerguide/aliases-creating.html

AWS
fzehao
answered 23 days ago