Builds a game server, running on ECS Fargate.
This is designed to run as cheaply as possible, which means some availability and reliability has been sacrificed.
Default configuration: Single AZ with a Single Public Subnet Fargate Spot capacity provider EFS General performance file system for storage
import { GameServer } from '@raykrueger/cdk-game-server'
new GameServer(scope: Construct, id: string, props: GameServerProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
GameServerProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: GameServerProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
public toString(): string
Returns a string representation of this construct.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
import { GameServer } from '@raykrueger/cdk-game-server'
GameServer.isConstruct(x: any)
Checks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
- Type: any
Any object.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
cluster |
aws-cdk-lib.aws_ecs.ICluster |
No description. |
containerEnv |
{[ key: string ]: string} |
No description. |
containerInsights |
boolean |
No description. |
containerSecrets |
{[ key: string ]: aws-cdk-lib.aws_ecs.Secret} |
No description. |
cpu |
number |
No description. |
gamePorts |
GamePort[] |
No description. |
image |
aws-cdk-lib.aws_ecs.ContainerImage |
No description. |
memoryLimitMiB |
number |
No description. |
mountTarget |
MountOptions |
No description. |
service |
aws-cdk-lib.aws_ecs.IService |
No description. |
useSpot |
boolean |
No description. |
additionalArgs |
string[] |
No description. |
autoShutdownConfig |
AutoShutdownProps |
No description. |
discord |
DiscordCommandOptions |
No description. |
dnsConfig |
DomainProps |
No description. |
enableExecuteCommand |
boolean |
No description. |
logging |
aws-cdk-lib.aws_ecs.LogDriver |
No description. |
steamArgs |
string |
No description. |
vpc |
aws-cdk-lib.aws_ec2.IVpc |
No description. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly cluster: ICluster;
- Type: aws-cdk-lib.aws_ecs.ICluster
public readonly containerEnv: {[ key: string ]: string};
- Type: {[ key: string ]: string}
public readonly containerInsights: boolean;
- Type: boolean
public readonly containerSecrets: {[ key: string ]: Secret};
- Type: {[ key: string ]: aws-cdk-lib.aws_ecs.Secret}
public readonly cpu: number;
- Type: number
public readonly gamePorts: GamePort[];
- Type: GamePort[]
public readonly image: ContainerImage;
- Type: aws-cdk-lib.aws_ecs.ContainerImage
public readonly memoryLimitMiB: number;
- Type: number
public readonly mountTarget: MountOptions;
- Type: MountOptions
public readonly service: IService;
- Type: aws-cdk-lib.aws_ecs.IService
public readonly useSpot: boolean;
- Type: boolean
public readonly additionalArgs: string[];
- Type: string[]
public readonly autoShutdownConfig: AutoShutdownProps;
- Type: AutoShutdownProps
public readonly discord: DiscordCommandOptions;
- Type: DiscordCommandOptions
public readonly dnsConfig: DomainProps;
- Type: DomainProps
public readonly enableExecuteCommand: boolean;
- Type: boolean
public readonly logging: LogDriver;
- Type: aws-cdk-lib.aws_ecs.LogDriver
public readonly steamArgs: string;
- Type: string
public readonly vpc: IVpc;
- Type: aws-cdk-lib.aws_ec2.IVpc
import { AutoShutdownProps } from '@raykrueger/cdk-game-server'
const autoShutdownProps: AutoShutdownProps = { ... }
Name | Type | Description |
---|---|---|
cpuUtilizationMin |
number |
No description. |
evaluationPeriods |
number |
No description. |
public readonly cpuUtilizationMin: number;
- Type: number
public readonly evaluationPeriods: number;
- Type: number
import { DiscordCommandOptions } from '@raykrueger/cdk-game-server'
const discordCommandOptions: DiscordCommandOptions = { ... }
Name | Type | Description |
---|---|---|
commandName |
string |
No description. |
secretName |
string |
No description. |
public readonly commandName: string;
- Type: string
public readonly secretName: string;
- Type: string
import { DomainProps } from '@raykrueger/cdk-game-server'
const domainProps: DomainProps = { ... }
Name | Type | Description |
---|---|---|
domainName |
string |
No description. |
hostzedZone |
string |
No description. |
assumedRole |
string |
No description. |
public readonly domainName: string;
- Type: string
public readonly hostzedZone: string;
- Type: string
public readonly assumedRole: string;
- Type: string
import { GamePort } from '@raykrueger/cdk-game-server'
const gamePort: GamePort = { ... }
Name | Type | Description |
---|---|---|
portNumber |
number |
No description. |
protocol |
aws-cdk-lib.aws_ecs.Protocol |
No description. |
public readonly portNumber: number;
- Type: number
public readonly protocol: Protocol;
- Type: aws-cdk-lib.aws_ecs.Protocol
import { GameServerProps } from '@raykrueger/cdk-game-server'
const gameServerProps: GameServerProps = { ... }
Name | Type | Description |
---|---|---|
gamePorts |
GamePort[] |
No description. |
image |
aws-cdk-lib.aws_ecs.ContainerImage |
The container image to run. |
mountTarget |
MountOptions |
No description. |
additionalArgs |
string[] |
No description. |
autoShutdownConfig |
AutoShutdownProps |
No description. |
containerEnv |
{[ key: string ]: string} |
No description. |
containerInsights |
boolean |
Do we want to enable Cloudwatch Container Insights, and incur additional cost? |
containerSecrets |
{[ key: string ]: aws-cdk-lib.aws_ecs.Secret} |
No description. |
cpu |
number |
vCpu amout to be granted to ECS Fargate task. |
discord |
DiscordCommandOptions |
No description. |
dnsConfig |
DomainProps |
No description. |
enableExecuteCommand |
boolean |
No description. |
logging |
aws-cdk-lib.aws_ecs.LogDriver |
Logging driver to use. |
memoryLimitMiB |
number |
Memory limit in 1024 incrmements. |
useSpot |
boolean |
No description. |
vpc |
aws-cdk-lib.aws_ec2.IVpc |
Provide an existing VPC to deploy into. |
public readonly gamePorts: GamePort[];
- Type: GamePort[]
public readonly image: ContainerImage;
- Type: aws-cdk-lib.aws_ecs.ContainerImage
The container image to run.
public readonly mountTarget: MountOptions;
- Type: MountOptions
public readonly additionalArgs: string[];
- Type: string[]
public readonly autoShutdownConfig: AutoShutdownProps;
- Type: AutoShutdownProps
public readonly containerEnv: {[ key: string ]: string};
- Type: {[ key: string ]: string}
public readonly containerInsights: boolean;
- Type: boolean
- Default: false
Do we want to enable Cloudwatch Container Insights, and incur additional cost?
public readonly containerSecrets: {[ key: string ]: Secret};
- Type: {[ key: string ]: aws-cdk-lib.aws_ecs.Secret}
public readonly cpu: number;
- Type: number
- Default: DEFAULT_VCPU
vCpu amout to be granted to ECS Fargate task.
public readonly discord: DiscordCommandOptions;
- Type: DiscordCommandOptions
public readonly dnsConfig: DomainProps;
- Type: DomainProps
public readonly enableExecuteCommand: boolean;
- Type: boolean
public readonly logging: LogDriver;
- Type: aws-cdk-lib.aws_ecs.LogDriver
- Default: undefined
Logging driver to use.
The Cloudwatch logging driver will incur addtional costs.
Example
logging: new ecs.AwsLogDriver({ streamPrefix: 'EventDemo' })
public readonly memoryLimitMiB: number;
- Type: number
- Default: DEFAULT_VCPU
Memory limit in 1024 incrmements.
public readonly useSpot: boolean;
- Type: boolean
public readonly vpc: IVpc;
- Type: aws-cdk-lib.aws_ec2.IVpc
Provide an existing VPC to deploy into.
If none is given a default ec2.VPC
will be created.
import { MountOptions } from '@raykrueger/cdk-game-server'
const mountOptions: MountOptions = { ... }
Name | Type | Description |
---|---|---|
mountTarget |
string |
No description. |
aclGroupId |
number |
No description. |
aclUserId |
number |
No description. |
public readonly mountTarget: string;
- Type: string
public readonly aclGroupId: number;
- Type: number
public readonly aclUserId: number;
- Type: number