FleetIQ makes abstraction layer Game Server Group for game hosting, and it uses Auto Scaling Group. Game server resources are registered in FleetIQ, and managed in Game Server Group.
When you create a game server group in FleetIQ, an Auto Scaling Group is created, and computing resources to allocate within the Auto Scaling Group are launched. So it’s important to allocate a group of game servers with appropriate instance types to optimize your computing resources. FleetIQ regularly evaluates each Spot instance types in the game server group list based on the prediction algorithm to calculate the feasibility for hosting the game.
Move to IAM console. (https://console.aws.amazon.com/iam/home?)
Click “Role” button on IAM console, and create new Role for EC2 use case.
Attach Permissions policies. If you search “GameLift” as a keyword, you are able to find GameLiftGameServerGroupPolicy. Also if we finish previous lab, you can find GameLiftFullAccess Role. (If not, please refer 1-4 on this lab)
Access to EC2 console (https://console.aws.amazon.com/ec2/v2/home)
Click Start Template in the left menu and create a new start template.
Configure the template as follows.
If you have conducted Windows-based labs before, in this lab, we will configure a Linux-based game server, so choose Amazon Linux2 AMI. This can show you how your architecture can be flexible. The key-pair setting is also performed to enable login.
Choose GameLiftFleetIQRole that we made previously for IAM instance Profile.
Put follow text as user data.
#!/bin/bash
sudo yum install python3 -y
sudo pip3 install boto3
sudo pip3 install requests
sudo yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_12.x | sudo -E bash
sudo yum install -y nodejs
The user data code above describes the operation to connect the Cloud9 IDE remotely when the game server is created.
Let’s make Game Server Group. You are able to try this with AWS CLI v2.
aws gamelift create-game-server-group --game-server-group-name GameServerGroups --role-arn <FleetIQFiestaRole ARN> --min-size 1 --max-size 2 --launch-template LaunchTemplateId=<LaunchTemplate ID> --instance-definitions '[{"InstanceType": "c5.large"}, {"InstanceType": "m5.large"}]' --region ap-northeast-2
Please put right information between brackets <>. Also check for region on this command.
If the creation of the game server group is too delayed, it is recommended to check the permissions.
You can also check the auto-created instance in the EC2 console. Those indicate game servers available in the game server group.
However, you can’t use FleetIQ function through the game servers yet. To use FleetIQ function, you must configure FleetIQ Lifecycle.