@aws-cdk_aws-gamelift-alpha.BuildFleet

class BuildFleet (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.GameLift.Alpha.BuildFleet
Gogithub.com/aws/aws-cdk-go/awscdkgameliftalpha/v2#BuildFleet
Javasoftware.amazon.awscdk.services.gamelift.alpha.BuildFleet
Pythonaws_cdk.aws_gamelift_alpha.BuildFleet
TypeScript (source)@aws-cdk/aws-gamelift-alpha ยป BuildFleet

Implements IConstruct, IDependable, IResource, IFleet, IGrantable, IGameSessionQueueDestination, IBuildFleet

A fleet contains Amazon Elastic Compute Cloud (Amazon EC2) instances that GameLift hosts.

A fleet uses the configuration and scaling logic that you define to run your game server build. You can use a fleet directly without a queue. You can also associate multiple fleets with a GameLift queue.

For example, you can use Spot Instance fleets configured with your preferred locations, along with a backup On-Demand Instance fleet with the same locations. Using multiple Spot Instance fleets of different instance types reduces the chance of needing On-Demand Instance placement.

Example

declare const build: gamelift.Build;
// Server processes can be delcared in a declarative way through the constructor
const fleet = new gamelift.BuildFleet(this, 'Game server fleet', {
  fleetName: 'test-fleet',
  content: build,
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE),
  runtimeConfiguration: {
    serverProcesses: [{
      launchPath: '/local/game/GameLiftExampleServer.x86_64',
      parameters: '-logFile /local/game/logs/myserver1935.log -port 1935',
      concurrentExecutions: 100,
    }]
  }
});

Initializer

new BuildFleet(scope: Construct, id: string, props: BuildFleetProps)

Parameters

  • scope Construct
  • id string
  • props BuildFleetProps

Construct Props

NameTypeDescription
content๐Ÿ”นIBuildA build to be deployed on the fleet.
fleetName๐Ÿ”นstringA descriptive label that is associated with a fleet.
instanceType๐Ÿ”นInstanceTypeThe GameLift-supported Amazon EC2 instance type to use for all fleet instances.
runtimeConfiguration๐Ÿ”นRuntimeConfigurationA collection of server process configurations that describe the set of processes to run on each instance in a fleet.
description?๐Ÿ”นstringA human-readable description of the fleet.
desiredCapacity?๐Ÿ”นnumberThe number of EC2 instances that you want this fleet to host.
ingressRules?๐Ÿ”นIngressRule[]The allowed IP address ranges and port settings that allow inbound traffic to access game sessions on this fleet.
locations?๐Ÿ”นLocation[]A set of remote locations to deploy additional instances to and manage as part of the fleet.
maxSize?๐Ÿ”นnumberThe maximum number of instances that are allowed in the specified fleet location.
metricGroup?๐Ÿ”นstringThe name of an AWS CloudWatch metric group to add this fleet to.
minSize?๐Ÿ”นnumberThe minimum number of instances that are allowed in the specified fleet location.
peerVpc?๐Ÿ”นIVpcA VPC peering connection between your GameLift-hosted game servers and your other non-GameLift resources.
protectNewGameSession?๐Ÿ”นbooleanThe status of termination protection for active game sessions on the fleet.
resourceCreationLimitPolicy?๐Ÿ”นResourceCreationLimitPolicyA policy that limits the number of game sessions that an individual player can create on instances in this fleet within a specified span of time.
role?๐Ÿ”นIRoleThe IAM role assumed by GameLift fleet instances to access AWS ressources.
useCertificate?๐Ÿ”นbooleanPrompts GameLift to generate a TLS/SSL certificate for the fleet.
useSpot?๐Ÿ”นbooleanIndicates whether to use On-Demand or Spot instances for this fleet. By default, fleet use on demand capacity.

content๐Ÿ”น

Type: IBuild

A build to be deployed on the fleet.

The build must have been successfully uploaded to Amazon GameLift and be in a READY status.

This fleet setting cannot be changed once the fleet is created.


fleetName๐Ÿ”น

Type: string

A descriptive label that is associated with a fleet.

Fleet names do not need to be unique.


instanceType๐Ÿ”น

Type: InstanceType

The GameLift-supported Amazon EC2 instance type to use for all fleet instances.

Instance type determines the computing resources that will be used to host your game servers, including CPU, memory, storage, and networking capacity.

See also: [http://aws.amazon.com/ec2/instance-types/ for detailed descriptions of Amazon EC2 instance types.](http://aws.amazon.com/ec2/instance-types/ for detailed descriptions of Amazon EC2 instance types.)


runtimeConfiguration๐Ÿ”น

Type: RuntimeConfiguration

A collection of server process configurations that describe the set of processes to run on each instance in a fleet.

Server processes run either an executable in a custom game build or a Realtime Servers script. GameLift launches the configured processes, manages their life cycle, and replaces them as needed. Each instance checks regularly for an updated runtime configuration.

A GameLift instance is limited to 50 processes running concurrently. To calculate the total number of processes in a runtime configuration, add the values of the ConcurrentExecutions parameter for each ServerProcess.

See also: https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-multiprocess.html


description?๐Ÿ”น

Type: string (optional, default: no description is provided)

A human-readable description of the fleet.


desiredCapacity?๐Ÿ”น

Type: number (optional, default: Default capacity is 0)

The number of EC2 instances that you want this fleet to host.

When creating a new fleet, GameLift automatically sets this value to "1" and initiates a single instance. Once the fleet is active, update this value to trigger GameLift to add or remove instances from the fleet.


ingressRules?๐Ÿ”น

Type: IngressRule[] (optional, default: no inbound traffic allowed)

The allowed IP address ranges and port settings that allow inbound traffic to access game sessions on this fleet.

This property must be set before players can connect to game sessions.


locations?๐Ÿ”น

Type: Location[] (optional, default: Create a fleet with instances in the home region only)

A set of remote locations to deploy additional instances to and manage as part of the fleet.

This parameter can only be used when creating fleets in AWS Regions that support multiple locations. You can add any GameLift-supported AWS Region as a remote location, in the form of an AWS Region code such as us-west-2. To create a fleet with instances in the home region only, omit this parameter.


maxSize?๐Ÿ”น

Type: number (optional, default: the default is 1)

The maximum number of instances that are allowed in the specified fleet location.


metricGroup?๐Ÿ”น

Type: string (optional, default: Fleet metrics are aggregated with other fleets in the default metric group)

The name of an AWS CloudWatch metric group to add this fleet to.

A metric group is used to aggregate the metrics for multiple fleets. You can specify an existing metric group name or set a new name to create a new metric group. A fleet can be included in only one metric group at a time.


minSize?๐Ÿ”น

Type: number (optional, default: the default is 0)

The minimum number of instances that are allowed in the specified fleet location.


peerVpc?๐Ÿ”น

Type: IVpc (optional, default: no vpc peering)

A VPC peering connection between your GameLift-hosted game servers and your other non-GameLift resources.

Use Amazon Virtual Private Cloud (VPC) peering connections to enable your game servers to communicate directly and privately with your other AWS resources, such as a web service or a repository. You can establish VPC peering with any resources that run on AWS and are managed by an AWS account that you have access to. The VPC must be in the same Region as your fleet.

Warning: Be sure to create a VPC Peering authorization through Gamelift Service API.

See also: https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html


protectNewGameSession?๐Ÿ”น

Type: boolean (optional, default: true - Game sessions in ACTIVE status cannot be terminated during a scale-down event.)

The status of termination protection for active game sessions on the fleet.

By default, new game sessions are protected and cannot be terminated during a scale-down event.


resourceCreationLimitPolicy?๐Ÿ”น

Type: ResourceCreationLimitPolicy (optional, default: No resource creation limit policy)

A policy that limits the number of game sessions that an individual player can create on instances in this fleet within a specified span of time.


role?๐Ÿ”น

Type: IRole (optional, default: a role will be created with default trust to Gamelift service principal.)

The IAM role assumed by GameLift fleet instances to access AWS ressources.

With a role set, any application that runs on an instance in this fleet can assume the role, including install scripts, server processes, and daemons (background processes). If providing a custom role, it needs to trust the GameLift service principal (gamelift.amazonaws.com). No permission is required by default.

This property cannot be changed after the fleet is created.

See also: https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-resources.html


useCertificate?๐Ÿ”น

Type: boolean (optional, default: TLS/SSL certificate are generated for the fleet)

Prompts GameLift to generate a TLS/SSL certificate for the fleet.

GameLift uses the certificates to encrypt traffic between game clients and the game servers running on GameLift.

You can't change this property after you create the fleet.

Additionnal info: AWS Certificate Manager (ACM) certificates expire after 13 months. Certificate expiration can cause fleets to fail, preventing players from connecting to instances in the fleet. We recommend you replace fleets before 13 months, consider using fleet aliases for a smooth transition.


useSpot?๐Ÿ”น

Type: boolean (optional, default: Gamelift fleet use on demand capacity)

Indicates whether to use On-Demand or Spot instances for this fleet. By default, fleet use on demand capacity.

This property cannot be changed after the fleet is created.

See also: https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-ec2-instances.html#gamelift-ec2-instances-spot

Properties

NameTypeDescription
content๐Ÿ”นIBuildThe build content of the fleet.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
fleetArn๐Ÿ”นstringThe ARN of the fleet.
fleetId๐Ÿ”นstringThe Identifier of the fleet.
grantPrincipal๐Ÿ”นIPrincipalThe principal this GameLift fleet is using.
node๐Ÿ”นNodeThe tree node.
resourceArnForDestination๐Ÿ”นstringThe ARN to put into the destination field of a game session queue.
role๐Ÿ”นIRoleThe IAM role GameLift assumes by fleet instances to access AWS ressources.
stack๐Ÿ”นStackThe stack in which this resource is defined.

content๐Ÿ”น

Type: IBuild

The build content of the fleet.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


fleetArn๐Ÿ”น

Type: string

The ARN of the fleet.


fleetId๐Ÿ”น

Type: string

The Identifier of the fleet.


grantPrincipal๐Ÿ”น

Type: IPrincipal

The principal this GameLift fleet is using.


node๐Ÿ”น

Type: Node

The tree node.


resourceArnForDestination๐Ÿ”น

Type: string

The ARN to put into the destination field of a game session queue.


role๐Ÿ”น

Type: IRole

The IAM role GameLift assumes by fleet instances to access AWS ressources.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addAlias(aliasName, options?)๐Ÿ”นDefines an alias for this fleet.
addIngressRule(source, port)๐Ÿ”นAdds an ingress rule to allow inbound traffic to access game sessions on this fleet.
addInternalLocation(location)๐Ÿ”นAdds a remote locations to deploy additional instances to and manage as part of the fleet.
addLocation(region, desiredCapacity?, minSize?, maxSize?)๐Ÿ”นAdds a remote locations to deploy additional instances to and manage as part of the fleet.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
grant(grantee, ...actions)๐Ÿ”นGrant the grantee identity permissions to perform actions.
metric(metricName, props?)๐Ÿ”นReturn the given named metric for this fleet.
metricActiveInstances(props?)๐Ÿ”นInstances with ACTIVE status, which means they are running active server processes.
metricDesiredInstances(props?)๐Ÿ”นTarget number of active instances that GameLift is working to maintain in the fleet.
metricIdleInstances(props?)๐Ÿ”นActive instances that are currently hosting zero (0) game sessions.
metricInstanceInterruptions(props?)๐Ÿ”นNumber of spot instances that have been interrupted.
metricMaxInstances(props?)๐Ÿ”นMaximum number of instances that are allowed for the fleet.
metricMinInstances(props?)๐Ÿ”นMinimum number of instances allowed for the fleet.
metricPercentIdleInstances(props?)๐Ÿ”นPercentage of all active instances that are idle (calculated as IdleInstances / ActiveInstances).
toString()๐Ÿ”นReturns a string representation of this construct.
static fromBuildFleetArn(scope, id, buildFleetArn)๐Ÿ”นImport an existing fleet from its ARN.
static fromBuildFleetId(scope, id, buildFleetId)๐Ÿ”นImport an existing fleet from its identifier.

addAlias(aliasName, options?)๐Ÿ”น

public addAlias(aliasName: string, options?: AliasOptions): Alias

Parameters

  • aliasName string โ€” The name of the alias.
  • options AliasOptions โ€” Alias options.

Returns

  • Alias

Defines an alias for this fleet.

declare const fleet: gamelift.FleetBase;

fleet.addAlias('Live');

// Is equivalent to

new gamelift.Alias(this, 'AliasLive', {
  aliasName: 'Live',
  fleet: fleet,
});

addIngressRule(source, port)๐Ÿ”น

public addIngressRule(source: IPeer, port: Port): void

Parameters

  • source IPeer โ€” A range of allowed IP addresses.
  • port Port โ€” The port range used for ingress traffic.

Adds an ingress rule to allow inbound traffic to access game sessions on this fleet.


addInternalLocation(location)๐Ÿ”น

public addInternalLocation(location: Location): void

Parameters

  • location Location โ€” The location to add.

Adds a remote locations to deploy additional instances to and manage as part of the fleet.


addLocation(region, desiredCapacity?, minSize?, maxSize?)๐Ÿ”น

public addLocation(region: string, desiredCapacity?: number, minSize?: number, maxSize?: number): void

Parameters

  • region string โ€” The AWS region to add.
  • desiredCapacity number
  • minSize number
  • maxSize number

Adds a remote locations to deploy additional instances to and manage as part of the fleet.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


grant(grantee, ...actions)๐Ÿ”น

public grant(grantee: IGrantable, ...actions: string[]): Grant

Parameters

  • grantee IGrantable
  • actions string

Returns

  • Grant

Grant the grantee identity permissions to perform actions.


metric(metricName, props?)๐Ÿ”น

public metric(metricName: string, props?: MetricOptions): Metric

Parameters

  • metricName string
  • props MetricOptions

Returns

  • Metric

Return the given named metric for this fleet.


metricActiveInstances(props?)๐Ÿ”น

public metricActiveInstances(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Instances with ACTIVE status, which means they are running active server processes.

The count includes idle instances and those that are hosting one or more game sessions. This metric measures current total instance capacity.

This metric can be used with automatic scaling.


metricDesiredInstances(props?)๐Ÿ”น

public metricDesiredInstances(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Target number of active instances that GameLift is working to maintain in the fleet.

With automatic scaling, this value is determined based on the scaling policies currently in force. Without automatic scaling, this value is set manually. This metric is not available when viewing data for fleet metric groups.


metricIdleInstances(props?)๐Ÿ”น

public metricIdleInstances(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Active instances that are currently hosting zero (0) game sessions.

This metric measures capacity that is available but unused. This metric can be used with automatic scaling.


metricInstanceInterruptions(props?)๐Ÿ”น

public metricInstanceInterruptions(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Number of spot instances that have been interrupted.


metricMaxInstances(props?)๐Ÿ”น

public metricMaxInstances(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Maximum number of instances that are allowed for the fleet.

A fleet's instance maximum determines the capacity ceiling during manual or automatic scaling up. This metric is not available when viewing data for fleet metric groups.


metricMinInstances(props?)๐Ÿ”น

public metricMinInstances(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Minimum number of instances allowed for the fleet.

A fleet's instance minimum determines the capacity floor during manual or automatic scaling down. This metric is not available when viewing data for fleet metric groups.


metricPercentIdleInstances(props?)๐Ÿ”น

public metricPercentIdleInstances(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Percentage of all active instances that are idle (calculated as IdleInstances / ActiveInstances).

This metric can be used for automatic scaling.


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromBuildFleetArn(scope, id, buildFleetArn)๐Ÿ”น

public static fromBuildFleetArn(scope: Construct, id: string, buildFleetArn: string): IBuildFleet

Parameters

  • scope Construct
  • id string
  • buildFleetArn string

Returns

  • IBuildFleet

Import an existing fleet from its ARN.


static fromBuildFleetId(scope, id, buildFleetId)๐Ÿ”น

public static fromBuildFleetId(scope: Construct, id: string, buildFleetId: string): IBuildFleet

Parameters

  • scope Construct
  • id string
  • buildFleetId string

Returns

  • IBuildFleet

Import an existing fleet from its identifier.