Skip to content

Latest commit

 

History

History
782 lines (488 loc) · 26.4 KB

API.md

File metadata and controls

782 lines (488 loc) · 26.4 KB

API Reference

Constructs

GameServer

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

Initializers

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.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
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.

xRequired
  • Type: any

Any object.


Properties

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.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


clusterRequired
public readonly cluster: ICluster;
  • Type: aws-cdk-lib.aws_ecs.ICluster

containerEnvRequired
public readonly containerEnv: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

containerInsightsRequired
public readonly containerInsights: boolean;
  • Type: boolean

containerSecretsRequired
public readonly containerSecrets: {[ key: string ]: Secret};
  • Type: {[ key: string ]: aws-cdk-lib.aws_ecs.Secret}

cpuRequired
public readonly cpu: number;
  • Type: number

gamePortsRequired
public readonly gamePorts: GamePort[];

imageRequired
public readonly image: ContainerImage;
  • Type: aws-cdk-lib.aws_ecs.ContainerImage

memoryLimitMiBRequired
public readonly memoryLimitMiB: number;
  • Type: number

mountTargetRequired
public readonly mountTarget: MountOptions;

serviceRequired
public readonly service: IService;
  • Type: aws-cdk-lib.aws_ecs.IService

useSpotRequired
public readonly useSpot: boolean;
  • Type: boolean

additionalArgsOptional
public readonly additionalArgs: string[];
  • Type: string[]

autoShutdownConfigOptional
public readonly autoShutdownConfig: AutoShutdownProps;

discordOptional
public readonly discord: DiscordCommandOptions;

dnsConfigOptional
public readonly dnsConfig: DomainProps;

enableExecuteCommandOptional
public readonly enableExecuteCommand: boolean;
  • Type: boolean

loggingOptional
public readonly logging: LogDriver;
  • Type: aws-cdk-lib.aws_ecs.LogDriver

steamArgsOptional
public readonly steamArgs: string;
  • Type: string

vpcOptional
public readonly vpc: IVpc;
  • Type: aws-cdk-lib.aws_ec2.IVpc

Structs

AutoShutdownProps

Initializer

import { AutoShutdownProps } from '@raykrueger/cdk-game-server'

const autoShutdownProps: AutoShutdownProps = { ... }

Properties

Name Type Description
cpuUtilizationMin number No description.
evaluationPeriods number No description.

cpuUtilizationMinOptional
public readonly cpuUtilizationMin: number;
  • Type: number

evaluationPeriodsOptional
public readonly evaluationPeriods: number;
  • Type: number

DiscordCommandOptions

Initializer

import { DiscordCommandOptions } from '@raykrueger/cdk-game-server'

const discordCommandOptions: DiscordCommandOptions = { ... }

Properties

Name Type Description
commandName string No description.
secretName string No description.

commandNameRequired
public readonly commandName: string;
  • Type: string

secretNameRequired
public readonly secretName: string;
  • Type: string

DomainProps

Initializer

import { DomainProps } from '@raykrueger/cdk-game-server'

const domainProps: DomainProps = { ... }

Properties

Name Type Description
domainName string No description.
hostzedZone string No description.
assumedRole string No description.

domainNameRequired
public readonly domainName: string;
  • Type: string

hostzedZoneRequired
public readonly hostzedZone: string;
  • Type: string

assumedRoleOptional
public readonly assumedRole: string;
  • Type: string

GamePort

Initializer

import { GamePort } from '@raykrueger/cdk-game-server'

const gamePort: GamePort = { ... }

Properties

Name Type Description
portNumber number No description.
protocol aws-cdk-lib.aws_ecs.Protocol No description.

portNumberRequired
public readonly portNumber: number;
  • Type: number

protocolRequired
public readonly protocol: Protocol;
  • Type: aws-cdk-lib.aws_ecs.Protocol

GameServerProps

Initializer

import { GameServerProps } from '@raykrueger/cdk-game-server'

const gameServerProps: GameServerProps = { ... }

Properties

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.

gamePortsRequired
public readonly gamePorts: GamePort[];

imageRequired
public readonly image: ContainerImage;
  • Type: aws-cdk-lib.aws_ecs.ContainerImage

The container image to run.


mountTargetRequired
public readonly mountTarget: MountOptions;

additionalArgsOptional
public readonly additionalArgs: string[];
  • Type: string[]

autoShutdownConfigOptional
public readonly autoShutdownConfig: AutoShutdownProps;

containerEnvOptional
public readonly containerEnv: {[ key: string ]: string};
  • Type: {[ key: string ]: string}

containerInsightsOptional
public readonly containerInsights: boolean;
  • Type: boolean
  • Default: false

Do we want to enable Cloudwatch Container Insights, and incur additional cost?


containerSecretsOptional
public readonly containerSecrets: {[ key: string ]: Secret};
  • Type: {[ key: string ]: aws-cdk-lib.aws_ecs.Secret}

cpuOptional
public readonly cpu: number;
  • Type: number
  • Default: DEFAULT_VCPU

vCpu amout to be granted to ECS Fargate task.

https://aws.amazon.com/fargate/pricing/


discordOptional
public readonly discord: DiscordCommandOptions;

dnsConfigOptional
public readonly dnsConfig: DomainProps;

enableExecuteCommandOptional
public readonly enableExecuteCommand: boolean;
  • Type: boolean

loggingOptional
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' })
memoryLimitMiBOptional
public readonly memoryLimitMiB: number;
  • Type: number
  • Default: DEFAULT_VCPU

Memory limit in 1024 incrmements.

https://aws.amazon.com/fargate/pricing/


useSpotOptional
public readonly useSpot: boolean;
  • Type: boolean

vpcOptional
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.


MountOptions

Initializer

import { MountOptions } from '@raykrueger/cdk-game-server'

const mountOptions: MountOptions = { ... }

Properties

Name Type Description
mountTarget string No description.
aclGroupId number No description.
aclUserId number No description.

mountTargetRequired
public readonly mountTarget: string;
  • Type: string

aclGroupIdOptional
public readonly aclGroupId: number;
  • Type: number

aclUserIdOptional
public readonly aclUserId: number;
  • Type: number