Upload a Realtime Servers script to Amazon GameLift
When you're ready to deploy Realtime Servers for your game, upload completed Realtime server script files to Amazon GameLift. Do this by creating a Amazon GameLift script resource and specifying the location of your script files. You can also update server script files that are already deployed by uploading new files for an existing script resource.
When you create a new script resource, Amazon GameLift assigns it a unique script ID (for example,
script-1111aaaa-22bb-33cc-44dd-5555eeee66ff
) and uploads a copy of the
script files. Upload time depends on the size of your script files and on your connection
speed.
After you create the script resource, Amazon GameLift deploys the script with a new Realtime Servers fleet.
Amazon GameLift installs your server script onto each instance in the fleet, placing the script files
in /local/game
.
To troubleshoot fleet activation problems related to the server script, see Debug Amazon GameLift fleet issues.
Package script files
Your server script can include one or more files combined into a single .zip file for uploading. The .zip file must contain all files that your script needs to run.
You can store your zipped script files in either a local file directory or in an Amazon Simple Storage Service (Amazon S3) bucket.
Upload script files from a local directory
If you have your script files stored locally, you can upload them to Amazon GameLift from there.
To create the script resource, use either the Amazon GameLift console or the Amazon Command Line Interface (Amazon CLI)
Upload script files from Amazon S3
You can store your script files in an Amazon S3 bucket and upload them to Amazon GameLift from there. When you create your script, you specify the S3 bucket location and Amazon GameLift retrieves your script files from Amazon S3.
To create a script resource
-
Store your script files in an S3 bucket. Create a .zip file containing your server script files and upload it to an S3 bucket in an Amazon Web Services account that you control. Take note of the object URI—you need this when creating a Amazon GameLift script.
Note
Amazon GameLift doesn't support uploading from S3 buckets with names that contain a period (.).
-
Give Amazon GameLift access to your script files. To create an Amazon Identity and Access Management (IAM) role that allows Amazon GameLift to access the S3 bucket containing your server script, follow the instructions in Set up an IAM service role for Amazon GameLift. After you create the new role, take note of its name, which you need when creating a script.
-
Create a script. Use the Amazon GameLift console or the Amazon CLI to create a new script record. To make this request, you must have the IAM
PassRole
permission, as described in IAM permission examples for Amazon GameLift.
Update script files
You can update the metadata for a script resource using either the Amazon GameLift console or
the update-script
Amazon CLI command.
You can also update the script content for a script resource. Amazon GameLift deploys script content to all fleet instances that use the updated script resource. When the updated script is deployed, instances use it when starting new game sessions. Game sessions that are already running at the time of the update don't use the updated script.
To update script files
-
For script files stored locally, to upload the updated script .zip file, use either the Amazon GameLift console or the update-script command.
-
For script files stored in an Amazon S3 bucket, upload the updated script files to the S3 bucket. Amazon GameLift periodically checks for updated script files and retrieves them directly from the S3 bucket.