Design your backend service
We recommend that you implement a backend service that authenticates your players and communicates with the Amazon GameLift API. By implementing a custom backend service, you can:
-
Customize authentication for your players.
-
Control how GameLift matches and starts game sessions.
-
Use your player database for player attributes such as skill rating for matchmaking instead of trusting the client.
The following diagram shows some possible combinations of Amazon Web Services that you can use to create a backend service. For example, Elastic Load Balancing plus Amazon Elastic Compute Cloud (Amazon EC2), Amazon Elastic Container Service (Amazon ECS), or Amazon Elastic Kubernetes Service (Amazon EKS). Or, Amazon API Gateway plus Amazon Lambda. Or, Amazon AppSync plus Lambda.

You can also build a serverless backend using API Gateway, Lambda, and Amazon DynamoDB. If you need more control, then you can build container-based backends using an Application Load Balancer and Amazon ECS or Amazon EKS. You can also host your backend application directly with EC2 instances behind an Application Load Balancer. Then, you can use Amazon EC2 Auto Scaling groups to scale the capacity. You can also use Amazon AppSync to build a GraphQL-based backend for your game using WebSockets.
For an example implementation with a serverless backend, see Multiplayer Session-based Game Hosting on Amazon
Authenticating your players
You can use Amazon Cognito to authenticate your game clients. To manage the lifecycle and properties of your player identities, use Amazon Cognito user pools. To integrate your custom identities and external identities, use Amazon Cognito identity pools.
If you prefer, build a custom identity solution and host it on Amazon. You can also use Lambda authorizers for custom authorization logic with API Gateway.
GameLift hosting provides player session IDs, which you can use to make sure that players join the correct game server.
Additional resources:
-
Using identity pools (federated identities) (Amazon Cognito Developer Guide)
-
Getting started with user pools (Amazon Cognito Developer Guide)
-
How to Set Up Player Authentication with Amazon Cognito
(Amazon for Games Blog)