@aws-cdk/aws-gamelift-alpha 2.49.1-alpha.0 → 2.51.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,408 @@
1
+ import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
2
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
3
+ import * as iam from 'aws-cdk-lib/aws-iam';
4
+ import * as cdk from 'aws-cdk-lib';
5
+ import { Construct } from 'constructs';
6
+ import { CfnFleet } from 'aws-cdk-lib/aws-gamelift';
7
+ /**
8
+ * Current resource capacity settings in a specified fleet or location.
9
+ * The location value might refer to a fleet's remote location or its home Region.
10
+ */
11
+ export interface LocationCapacity {
12
+ /**
13
+ * The number of Amazon EC2 instances you want to maintain in the specified fleet location.
14
+ * This value must fall between the minimum and maximum size limits.
15
+ *
16
+ * @default the default value is 0
17
+ */
18
+ readonly desiredCapacity?: number;
19
+ /**
20
+ * The maximum number of instances that are allowed in the specified fleet location.
21
+ *
22
+ * @default the default value is 1
23
+ */
24
+ readonly maxSize?: number;
25
+ /**
26
+ * The minimum number of instances that are allowed in the specified fleet location.
27
+ *
28
+ * @default the default value is 0
29
+ */
30
+ readonly minSize?: number;
31
+ }
32
+ /**
33
+ * A remote location where a multi-location fleet can deploy EC2 instances for game hosting.
34
+ */
35
+ export interface Location {
36
+ /**
37
+ * An AWS Region code
38
+ */
39
+ readonly region: string;
40
+ /**
41
+ * Current resource capacity settings in a specified fleet or location.
42
+ * The location value might refer to a fleet's remote location or its home Region.
43
+ *
44
+ * @default no capacity settings on the specified location
45
+ */
46
+ readonly capacity?: LocationCapacity;
47
+ }
48
+ /**
49
+ * Configuration of a fleet server process
50
+ */
51
+ export interface ServerProcess {
52
+ /**
53
+ * The number of server processes using this configuration that run concurrently on each instance.
54
+ * Minimum is `1`
55
+ *
56
+ * @default 1
57
+ */
58
+ readonly concurrentExecutions?: number;
59
+ /**
60
+ * The location of a game build executable or the Realtime script file that contains the Init() function. Game builds and Realtime scripts are installed on instances at the root:
61
+ * - Windows (custom game builds only): `C:\game`. Example: `C:\game\MyGame\server.exe`
62
+ * - Linux: `/local/game`. Examples: `/local/game/MyGame/server.exe` or `/local/game/MyRealtimeScript.js`
63
+ */
64
+ readonly launchPath: string;
65
+ /**
66
+ * An optional list of parameters to pass to the server executable or Realtime script on launch.
67
+ *
68
+ * @default no parameters
69
+ */
70
+ readonly parameters?: string;
71
+ }
72
+ /**
73
+ * A collection of server process configurations that describe the set of processes to run on each instance in a fleet.
74
+ * Server processes run either an executable in a custom game build or a Realtime Servers script.
75
+ * GameLift launches the configured processes, manages their life cycle, and replaces them as needed.
76
+ * Each instance checks regularly for an updated runtime configuration.
77
+ *
78
+ * A GameLift instance is limited to 50 processes running concurrently.
79
+ * To calculate the total number of processes in a runtime configuration, add the values of the `ConcurrentExecutions` parameter for each `ServerProcess`.
80
+ *
81
+ * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-multiprocess.html
82
+ */
83
+ export interface RuntimeConfiguration {
84
+ /**
85
+ * The maximum amount of time allowed to launch a new game session and have it report ready to host players.
86
+ * During this time, the game session is in status `ACTIVATING`.
87
+ *
88
+ * If the game session does not become active before the timeout, it is ended and the game session status is changed to `TERMINATED`.
89
+ *
90
+ * @default by default game session activation timeout is 300 seconds
91
+ */
92
+ readonly gameSessionActivationTimeout?: cdk.Duration;
93
+ /**
94
+ * The number of game sessions in status `ACTIVATING` to allow on an instance.
95
+ *
96
+ * This setting limits the instance resources that can be used for new game activations at any one time.
97
+ *
98
+ * @default no limit
99
+ */
100
+ readonly maxConcurrentGameSessionActivations?: number;
101
+ /**
102
+ * A collection of server process configurations that identify what server processes to run on each instance in a fleet.
103
+ */
104
+ readonly serverProcesses: ServerProcess[];
105
+ }
106
+ /**
107
+ * A policy that limits the number of game sessions a player can create on the same fleet.
108
+ * This optional policy gives game owners control over how players can consume available game server resources.
109
+ * A resource creation policy makes the following statement: "An individual player can create a maximum number of new game sessions within a specified time period".
110
+ *
111
+ * The policy is evaluated when a player tries to create a new game session.
112
+ * For example, assume you have a policy of 10 new game sessions and a time period of 60 minutes.
113
+ * On receiving a `CreateGameSession` request, Amazon GameLift checks that the player (identified by CreatorId) has created fewer than 10 game sessions in the past 60 minutes.
114
+ */
115
+ export interface ResourceCreationLimitPolicy {
116
+ /**
117
+ * The maximum number of game sessions that an individual can create during the policy period.
118
+ *
119
+ * @default no limit on the number of game sessions that an individual can create during the policy period
120
+ */
121
+ readonly newGameSessionsPerCreator?: number;
122
+ /**
123
+ * The time span used in evaluating the resource creation limit policy.
124
+ *
125
+ * @default no policy period
126
+ */
127
+ readonly policyPeriod?: cdk.Duration;
128
+ }
129
+ /**
130
+ * Represents a Gamelift fleet
131
+ */
132
+ export interface IFleet extends cdk.IResource, iam.IGrantable {
133
+ /**
134
+ * The Identifier of the fleet.
135
+ *
136
+ * @attribute
137
+ */
138
+ readonly fleetId: string;
139
+ /**
140
+ * The ARN of the fleet.
141
+ *
142
+ * @attribute
143
+ */
144
+ readonly fleetArn: string;
145
+ /**
146
+ * Grant the `grantee` identity permissions to perform `actions`.
147
+ */
148
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
149
+ /**
150
+ * Return the given named metric for this fleet.
151
+ */
152
+ metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
153
+ /**
154
+ * Instances with `ACTIVE` status, which means they are running active server processes.
155
+ * The count includes idle instances and those that are hosting one or more game sessions.
156
+ * This metric measures current total instance capacity.
157
+ *
158
+ * This metric can be used with automatic scaling.
159
+ */
160
+ metricActiveInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
161
+ /**
162
+ * Percentage of all active instances that are idle (calculated as IdleInstances / ActiveInstances).
163
+ * This metric can be used for automatic scaling.
164
+ */
165
+ metricPercentIdleInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
166
+ /**
167
+ * Target number of active instances that GameLift is working to maintain in the fleet.
168
+ * With automatic scaling, this value is determined based on the scaling policies currently in force.
169
+ * Without automatic scaling, this value is set manually.
170
+ * This metric is not available when viewing data for fleet metric groups.
171
+ */
172
+ metricDesiredInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
173
+ /**
174
+ * Active instances that are currently hosting zero (0) game sessions.
175
+ * This metric measures capacity that is available but unused.
176
+ * This metric can be used with automatic scaling.
177
+ */
178
+ metricIdleInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
179
+ /**
180
+ * Number of spot instances that have been interrupted.
181
+ */
182
+ metricInstanceInterruptions(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
183
+ /**
184
+ * Maximum number of instances that are allowed for the fleet.
185
+ * A fleet's instance maximum determines the capacity ceiling during manual or automatic scaling up.
186
+ * This metric is not available when viewing data for fleet metric groups.
187
+ */
188
+ metricMaxInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
189
+ /**
190
+ * Minimum number of instances allowed for the fleet.
191
+ * A fleet's instance minimum determines the capacity floor during manual or automatic scaling down.
192
+ * This metric is not available when viewing data for fleet metric groups.
193
+ */
194
+ metricMinInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
195
+ }
196
+ /**
197
+ * Properties for a new Gamelift fleet
198
+ */
199
+ export interface FleetProps {
200
+ /**
201
+ * A descriptive label that is associated with a fleet. Fleet names do not need to be unique.
202
+ */
203
+ readonly fleetName: string;
204
+ /**
205
+ * A human-readable description of the fleet.
206
+ *
207
+ * @default no description is provided
208
+ */
209
+ readonly description?: string;
210
+ /**
211
+ * Indicates whether to use On-Demand or Spot instances for this fleet.
212
+ * By default, fleet use on demand capacity.
213
+ *
214
+ * This property cannot be changed after the fleet is created.
215
+ *
216
+ * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-ec2-instances.html#gamelift-ec2-instances-spot
217
+ *
218
+ * @default Gamelift fleet use on demand capacity
219
+ */
220
+ readonly useSpot?: boolean;
221
+ /**
222
+ * Prompts GameLift to generate a TLS/SSL certificate for the fleet.
223
+ * GameLift uses the certificates to encrypt traffic between game clients and the game servers running on GameLift.
224
+ *
225
+ * You can't change this property after you create the fleet.
226
+ *
227
+ * Additionnal info:
228
+ * AWS Certificate Manager (ACM) certificates expire after 13 months.
229
+ * Certificate expiration can cause fleets to fail, preventing players from connecting to instances in the fleet.
230
+ * We recommend you replace fleets before 13 months, consider using fleet aliases for a smooth transition.
231
+ *
232
+ * @default TLS/SSL certificate are generated for the fleet
233
+ */
234
+ readonly useCertificate?: boolean;
235
+ /**
236
+ * The IAM role assumed by GameLift fleet instances to access AWS ressources.
237
+ * 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).
238
+ * If providing a custom role, it needs to trust the GameLift service principal (gamelift.amazonaws.com).
239
+ * No permission is required by default.
240
+ *
241
+ * This property cannot be changed after the fleet is created.
242
+ *
243
+ * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-resources.html
244
+ *
245
+ * @default - a role will be created with default trust to Gamelift service principal.
246
+ */
247
+ readonly role?: iam.IRole;
248
+ /**
249
+ * A VPC peering connection between your GameLift-hosted game servers and your other non-GameLift resources.
250
+ * 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.
251
+ * You can establish VPC peering with any resources that run on AWS and are managed by an AWS account that you have access to.
252
+ * The VPC must be in the same Region as your fleet.
253
+ *
254
+ * Warning:
255
+ * Be sure to create a VPC Peering authorization through Gamelift Service API.
256
+ *
257
+ * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html
258
+ *
259
+ * @default no vpc peering
260
+ */
261
+ readonly peerVpc?: ec2.IVpc;
262
+ /**
263
+ * The name of an AWS CloudWatch metric group to add this fleet to.
264
+ * A metric group is used to aggregate the metrics for multiple fleets.
265
+ * You can specify an existing metric group name or set a new name to create a new metric group.
266
+ * A fleet can be included in only one metric group at a time.
267
+ *
268
+ * @default Fleet metrics are aggregated with other fleets in the default metric group
269
+ */
270
+ readonly metricGroup?: string;
271
+ /**
272
+ * The GameLift-supported Amazon EC2 instance type to use for all fleet instances.
273
+ * Instance type determines the computing resources that will be used to host your game servers, including CPU, memory, storage, and networking capacity.
274
+ *
275
+ * @see http://aws.amazon.com/ec2/instance-types/ for detailed descriptions of Amazon EC2 instance types.
276
+ */
277
+ readonly instanceType: ec2.InstanceType;
278
+ /**
279
+ * The number of EC2 instances that you want this fleet to host.
280
+ * When creating a new fleet, GameLift automatically sets this value to "1" and initiates a single instance.
281
+ * Once the fleet is active, update this value to trigger GameLift to add or remove instances from the fleet.
282
+ *
283
+ * @default Default capacity is 0
284
+ */
285
+ readonly desiredCapacity?: number;
286
+ /**
287
+ * The minimum number of instances that are allowed in the specified fleet location.
288
+ *
289
+ * @default the default is 0
290
+ */
291
+ readonly minSize?: number;
292
+ /**
293
+ * The maximum number of instances that are allowed in the specified fleet location.
294
+ *
295
+ * @default the default is 1
296
+ */
297
+ readonly maxSize?: number;
298
+ /**
299
+ * The status of termination protection for active game sessions on the fleet.
300
+ * By default, new game sessions are protected and cannot be terminated during a scale-down event.
301
+ *
302
+ * @default true - Game sessions in `ACTIVE` status cannot be terminated during a scale-down event.
303
+ */
304
+ readonly protectNewGameSession?: boolean;
305
+ /**
306
+ * A collection of server process configurations that describe the set of processes to run on each instance in a fleet.
307
+ * Server processes run either an executable in a custom game build or a Realtime Servers script.
308
+ * GameLift launches the configured processes, manages their life cycle, and replaces them as needed.
309
+ * Each instance checks regularly for an updated runtime configuration.
310
+ *
311
+ * A GameLift instance is limited to 50 processes running concurrently.
312
+ * To calculate the total number of processes in a runtime configuration, add the values of the ConcurrentExecutions parameter for each ServerProcess.
313
+ *
314
+ * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-multiprocess.html
315
+ */
316
+ readonly runtimeConfiguration: RuntimeConfiguration;
317
+ /**
318
+ * A set of remote locations to deploy additional instances to and manage as part of the fleet.
319
+ * This parameter can only be used when creating fleets in AWS Regions that support multiple locations.
320
+ * 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`.
321
+ * To create a fleet with instances in the home region only, omit this parameter.
322
+ *
323
+ * @default Create a fleet with instances in the home region only
324
+ */
325
+ readonly locations?: Location[];
326
+ /**
327
+ * 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.
328
+ *
329
+ * @default No resource creation limit policy
330
+ */
331
+ readonly resourceCreationLimitPolicy?: ResourceCreationLimitPolicy;
332
+ }
333
+ /**
334
+ * A full specification of a fleet that can be used to import it fluently into the CDK application.
335
+ */
336
+ export interface FleetAttributes {
337
+ /**
338
+ * The ARN of the fleet
339
+ *
340
+ * At least one of `fleetArn` and `fleetId` must be provided.
341
+ *
342
+ * @default derived from `fleetId`.
343
+ */
344
+ readonly fleetArn?: string;
345
+ /**
346
+ * The identifier of the fleet
347
+ *
348
+ * At least one of `fleetId` and `fleetArn` must be provided.
349
+ *
350
+ * @default derived from `fleetArn`.
351
+ */
352
+ readonly fleetId?: string;
353
+ /**
354
+ * The IAM role assumed by GameLift fleet instances to access AWS ressources.
355
+ *
356
+ * @default the imported fleet cannot be granted access to other resources as an `iam.IGrantable`.
357
+ */
358
+ readonly role?: iam.IRole;
359
+ }
360
+ /**
361
+ * Base class for new and imported GameLift fleet.
362
+ */
363
+ export declare abstract class FleetBase extends cdk.Resource implements IFleet {
364
+ /**
365
+ * Import an existing fleet from its attributes.
366
+ */
367
+ static fromFleetAttributes(scope: Construct, id: string, attrs: FleetAttributes): IFleet;
368
+ /**
369
+ * The Identifier of the fleet.
370
+ */
371
+ abstract readonly fleetId: string;
372
+ /**
373
+ * The ARN of the fleet.
374
+ */
375
+ abstract readonly fleetArn: string;
376
+ /**
377
+ * The principal this GameLift fleet is using.
378
+ */
379
+ abstract readonly grantPrincipal: iam.IPrincipal;
380
+ private readonly locations;
381
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
382
+ metric(metricName: string, props?: cloudwatch.MetricOptions): cloudwatch.Metric;
383
+ metricActiveInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
384
+ metricPercentIdleInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
385
+ metricDesiredInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
386
+ metricIdleInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
387
+ metricInstanceInterruptions(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
388
+ metricMaxInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
389
+ metricMinInstances(props?: cloudwatch.MetricOptions): cloudwatch.Metric;
390
+ private cannedMetric;
391
+ /**
392
+ * Adds a remote locations to deploy additional instances to and manage as part of the fleet.
393
+ *
394
+ * @param region The AWS region to add
395
+ */
396
+ addLocation(region: string, desiredCapacity?: number, minSize?: number, maxSize?: number): void;
397
+ /**
398
+ * Adds a remote locations to deploy additional instances to and manage as part of the fleet.
399
+ *
400
+ * @param location The location to add
401
+ */
402
+ addInternalLocation(location: Location): void;
403
+ protected parseResourceCreationLimitPolicy(props: FleetProps): CfnFleet.ResourceCreationLimitPolicyProperty | undefined;
404
+ protected parseLocations(): CfnFleet.LocationConfigurationProperty[] | undefined;
405
+ protected parseLocationCapacity(capacity?: LocationCapacity): CfnFleet.LocationCapacityProperty | undefined;
406
+ protected parseRuntimeConfiguration(props: FleetProps): CfnFleet.RuntimeConfigurationProperty | undefined;
407
+ protected warnVpcPeeringAuthorizations(scope: Construct): void;
408
+ }