Skip to content
GitHubXDiscord

GameServerGroup

The GameServerGroup resource lets you manage AWS GameLift GameServerGroups for deploying and scaling game servers effectively.

Create a basic GameServerGroup with required properties and a couple of optional configurations.

import AWS from "alchemy/aws/control";
const gameServerGroup = await AWS.GameLift.GameServerGroup("myGameServerGroup", {
GameServerGroupName: "MyGameServerGroup",
InstanceDefinitions: [
{
InstanceType: "c5.large",
WeightedCapacity: "1"
}
],
RoleArn: "arn:aws:iam::123456789012:role/GameLiftServerRole",
MinSize: 1,
MaxSize: 5,
VpcSubnets: ["10.0.0.0/24"]
});

Configure a GameServerGroup with an Auto Scaling Policy and specific balancing strategy.

const advancedGameServerGroup = await AWS.GameLift.GameServerGroup("advancedGameServerGroup", {
GameServerGroupName: "AdvancedGameServerGroup",
InstanceDefinitions: [
{
InstanceType: "c5.large",
WeightedCapacity: "1"
}
],
RoleArn: "arn:aws:iam::123456789012:role/GameLiftServerRole",
AutoScalingPolicy: {
TargetValue: 50.0,
ScaleUpInterval: 60,
ScaleDownInterval: 60,
ScaleUpThreshold: 70,
ScaleDownThreshold: 30
},
BalancingStrategy: "SPOT",
VpcSubnets: ["10.0.0.0/24"]
});

Create a GameServerGroup with a protection policy to safeguard game servers from termination.

const protectedGameServerGroup = await AWS.GameLift.GameServerGroup("protectedGameServerGroup", {
GameServerGroupName: "ProtectedGameServerGroup",
InstanceDefinitions: [
{
InstanceType: "c5.large",
WeightedCapacity: "1"
}
],
RoleArn: "arn:aws:iam::123456789012:role/GameLiftServerRole",
GameServerProtectionPolicy: "FULLY_PROTECTED",
VpcSubnets: ["10.0.0.0/24"]
});

Add tags to your GameServerGroup for better management and organization.

const taggedGameServerGroup = await AWS.GameLift.GameServerGroup("taggedGameServerGroup", {
GameServerGroupName: "TaggedGameServerGroup",
InstanceDefinitions: [
{
InstanceType: "c5.large",
WeightedCapacity: "1"
}
],
RoleArn: "arn:aws:iam::123456789012:role/GameLiftServerRole",
Tags: [
{
Key: "Environment",
Value: "Production"
},
{
Key: "Game",
Value: "MyAwesomeGame"
}
]
});