Deploy a Matchmaking Sample App using AWS SAM
Overview
In this documentation, you will learn how to build, test and deploy an application using the AWS Serverless Application Model (AWS SAM). The serverless application used in this documentation is a matchmaking sample application. This documentation will teach you how to test your application locally before deploying to AWS.
Prerequisites
Tools and Configuration
Ensure you have the following tools and permissions before you begin:
- An Amazon Web Services (AWS) Account or Sub-Account
- AWS Command Line Interface (AWS CLI) with administrator permissions
- Access to your AWS Access Key and Secret
- AWS Serverless Application Model Command Line Interface (AWS SAM CLI)
- Docker installed to run the serverless application locally
- Created a cluster in AWS ElastiCache (Redis)
- Downloaded and cloned the Matchmaking Sample App for your preferred programming language
Server SDK Language | Link |
---|---|
Golang | AccelByte Cloud Golang SDK |
Python | AccelByte Cloud Python SDK |
Environment Variables Setup
To fill out the environment variables, follow the steps below.
Ensure you have set up your Game Namespace or create a new one if you have not done so already.
In your Game Namespace, create an OAuth Client for your Game Client set as Confidential type.
IMPORTANTDon't forget to save the Game Client ID and Game Client Secret somewhere safe. This will be used in the AWS Serverless Application Model Template.
Once the client is created, give it the following permissions:
Permission Tag Permission NAMESPACE:{namespace}:SESSION [READ] NAMESPACE:{namespace}:DSM:SERVER [CREATE UPDATE] NAMESPACE:{namespace}:DSM:SESSION [CREATE READ UPDATE DELETE] In your Game Namespace, create an IAM Client for your Game Client and set it as Confidential type.
IMPORTANTDon't forget to save the IAM Client ID and IAM Client Secret somewhere safe. This will be used in the AWS Serverless Application Model (SAM) Template.
Once your client is created, give it the following permissions:
Permission Tag Permission ROLE [READ] NOTEIf you need more information on how to set up your Game Client and IAM Client, see AccelByte Cloud's Client documentation.
Dedicated Server Deployment (DSMC Deployment)
Create a Dedicated Server Deployment and save the Deployment Name. This will be used later in DSMC_DEPLOYMENT variables in the AWS SAM Template.
IMPORTANTWhen you are setting up your Dedicated Server in the Admin Portal, make sure to set the Buffer Count value to 0—in Accelbyte's Matchmaking, only one Dedicated Server is needed, and is spawned when a session is created.
If you fail to set the Buffer Count to 0, you will receive a server already claimed error.
Create a Matchmaking Ruleset in the Admin Portal. Save the Game Mode name as it will be used in the GAME_MODE and SESSION_BROWSER_MODE variables in the AWS SAM Template.