diff --git a/packages/@aws-cdk/aws-gamelift/README.md b/packages/@aws-cdk/aws-gamelift/README.md index d3359c41190b7..2528789c4fbad 100644 --- a/packages/@aws-cdk/aws-gamelift/README.md +++ b/packages/@aws-cdk/aws-gamelift/README.md @@ -315,6 +315,30 @@ const fleet = new gamelift.BuildFleet(this, 'Game server fleet', { fleet.grant(role, 'gamelift:ListFleets'); ``` +### Alias + +A GameLift alias is used to abstract a fleet designation. Fleet designations +tell Amazon GameLift where to search for available resources when creating new +game sessions for players. By using aliases instead of specific fleet IDs, you +can more easily and seamlessly switch player traffic from one fleet to another +by changing the alias's target location. + +```ts +declare const fleet: gamelift.BuildFleet; + +// Add an alias to an existing fleet using a dedicated fleet method +const liveAlias = fleet.addAlias('live'); + +// You can also create a standalone alias +new gamelift.Alias(this, 'TerminalAlias', { + aliasName: 'terminal-alias', + terminalMessage: 'A terminal message', +}); +``` + +See [Add an alias to a GameLift fleet](https://docs.aws.amazon.com/gamelift/latest/developerguide/aliases-creating.html) +in the *Amazon GameLift Developer Guide*. + ### Monitoring your Fleet GameLift is integrated with CloudWatch, so you can monitor the performance of diff --git a/packages/@aws-cdk/aws-gamelift/lib/alias.ts b/packages/@aws-cdk/aws-gamelift/lib/alias.ts new file mode 100644 index 0000000000000..cdf61bd97c2a1 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/lib/alias.ts @@ -0,0 +1,244 @@ +import * as cdk from '@aws-cdk/core'; +import { Construct } from 'constructs'; +import { IFleet } from './fleet-base'; +import { CfnAlias } from './gamelift.generated'; + +/** + * Represents a Gamelift Alias for a Gamelift fleet destination. + */ +export interface IAlias extends cdk.IResource { + + /** + * The Identifier of the alias. + * + * @attribute + */ + readonly aliasId: string; + + /** + * The ARN of the alias. + * + * @attribute + */ + readonly aliasArn: string; +} + +/** + * Options for `gamelift.Alias`. + */ +export interface AliasOptions { + /** + * Description for the alias + * + * @default No description + */ + readonly description?: string; +} + +/** + * A full specification of an alias that can be used to import it fluently into the CDK application. + */ +export interface AliasAttributes { + /** + * The ARN of the alias + * + * At least one of `aliasArn` and `aliasId` must be provided. + * + * @default derived from `aliasId`. + */ + readonly aliasArn?: string; + + /** + * The identifier of the alias + * + * At least one of `aliasId` and `aliasArn` must be provided. + * + * @default derived from `aliasArn`. + */ + readonly aliasId?: string; +} + +/** + * Properties for a new Fleet alias + */ +export interface AliasProps { + /** + * Name of this alias + */ + readonly aliasName: string; + + /** + * A human-readable description of the alias + * + * @default no description + */ + readonly description?: string; + + /** + * A fleet that the alias points to. + * If specified, the alias resolves to one specific fleet. + * + * At least one of `fleet` and `terminalMessage` must be provided. + * + * @default no fleet that the alias points to. + */ + readonly fleet?: IFleet; + + /** + * The message text to be used with a terminal routing strategy. + * + * At least one of `fleet` and `terminalMessage` must be provided. + * + * @default no terminal message + */ + readonly terminalMessage?: string; +} + +/** + * Base class for new and imported GameLift Alias. + */ +export abstract class AliasBase extends cdk.Resource implements IAlias { + /** + * The Identifier of the alias. + */ + public abstract readonly aliasId: string; + /** + * The ARN of the alias + */ + public abstract readonly aliasArn: string; +} + +/** + * A Amazon GameLift alias is used to abstract a fleet designation. + * Fleet designations tell GameLift where to search for available resources when creating new game sessions for players. + * Use aliases instead of specific fleet IDs to seamlessly switch player traffic from one fleet to another by changing the alias's target location. + * + * Aliases are useful in games that don't use queues. + * Switching fleets in a queue is a simple matter of creating a new fleet, adding it to the queue, and removing the old fleet, none of which is visible to players. + * In contrast, game clients that don't use queues must specify which fleet to use when communicating with the GameLift service. + * Without aliases, a fleet switch requires updates to your game code and possibly distribution of an updated game clients to players. + * + * When updating the fleet-id an alias points to, there is a transition period of up to 2 minutes where game sessions on the alias may end up on the old fleet. + * + * @see https://docs.aws.amazon.com/gamelift/latest/developerguide/aliases-creating.html + * + * @resource AWS::GameLift::Alias + */ +export class Alias extends AliasBase { + + /** + * Import an existing alias from its identifier. + */ + static fromAliasId(scope: Construct, id: string, aliasId: string): IAlias { + return this.fromAliasAttributes(scope, id, { aliasId: aliasId }); + } + + /** + * Import an existing alias from its ARN. + */ + static fromAliasArn(scope: Construct, id: string, aliasArn: string): IAlias { + return this.fromAliasAttributes(scope, id, { aliasArn: aliasArn }); + } + + /** + * Import an existing alias from its attributes. + */ + static fromAliasAttributes(scope: Construct, id: string, attrs: AliasAttributes): IAlias { + if (!attrs.aliasId && !attrs.aliasArn) { + throw new Error('Either aliasId or aliasArn must be provided in AliasAttributes'); + } + const aliasId = attrs.aliasId ?? + cdk.Stack.of(scope).splitArn(attrs.aliasArn!, cdk.ArnFormat.SLASH_RESOURCE_NAME).resourceName; + + if (!aliasId) { + throw new Error(`No alias identifier found in ARN: '${attrs.aliasArn}'`); + } + + const aliasArn = attrs.aliasArn ?? cdk.Stack.of(scope).formatArn({ + service: 'gamelift', + resource: 'alias', + resourceName: attrs.aliasId, + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME, + }); + class Import extends AliasBase { + public readonly aliasId = aliasId!; + public readonly aliasArn = aliasArn; + + constructor(s: Construct, i: string) { + super(s, i, { + environmentFromArn: aliasArn, + }); + } + } + return new Import(scope, id); + } + + /** + * The Identifier of the alias. + */ + public readonly aliasId: string; + + /** + * The ARN of the alias. + */ + public readonly aliasArn: string; + + /** + * A fleet that the alias points to. + */ + public readonly fleet?: IFleet; + + constructor(scope: Construct, id: string, props: AliasProps) { + super(scope, id, { + physicalName: props.aliasName, + }); + + if (!cdk.Token.isUnresolved(props.aliasName)) { + if (props.aliasName.length > 1024) { + throw new Error(`Alias name can not be longer than 1024 characters but has ${props.aliasName.length} characters.`); + } + } + + if (props.description && !cdk.Token.isUnresolved(props.description)) { + if (props.description.length > 1024) { + throw new Error(`Alias description can not be longer than 1024 characters but has ${props.description.length} characters.`); + } + } + + if (!props.terminalMessage && !props.fleet) { + throw new Error('Either a terminal message or a fleet must be binded to this Alias.'); + } + + if (props.terminalMessage && props.fleet) { + throw new Error('Either a terminal message or a fleet must be binded to this Alias, not both.'); + } + + const resource = new CfnAlias(this, 'Resource', { + name: props.aliasName, + description: props.description, + routingStrategy: this.parseRoutingStrategy(props), + }); + + this.aliasId = this.getResourceNameAttribute(resource.ref); + this.aliasArn = cdk.Stack.of(scope).formatArn({ + service: 'gamelift', + resource: 'alias', + resourceName: this.aliasId, + arnFormat: cdk.ArnFormat.SLASH_RESOURCE_NAME, + }); + } + + private parseRoutingStrategy(props: AliasProps): CfnAlias.RoutingStrategyProperty { + if (props.fleet ) { + return { + fleetId: props.fleet.fleetId, + type: 'SIMPLE', + }; + } + return { + message: props.terminalMessage, + type: 'TERMINAL', + }; + } +} + diff --git a/packages/@aws-cdk/aws-gamelift/lib/fleet-base.ts b/packages/@aws-cdk/aws-gamelift/lib/fleet-base.ts index 20d515b1994ad..bf76c6078db1c 100644 --- a/packages/@aws-cdk/aws-gamelift/lib/fleet-base.ts +++ b/packages/@aws-cdk/aws-gamelift/lib/fleet-base.ts @@ -3,6 +3,7 @@ import * as ec2 from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; import * as cdk from '@aws-cdk/core'; import { Construct } from 'constructs'; +import { Alias, AliasOptions } from './alias'; import { GameLiftMetrics } from './gamelift-canned-metrics.generated'; import { CfnFleet } from './gamelift.generated'; @@ -453,6 +454,33 @@ export abstract class FleetBase extends cdk.Resource implements IFleet { private readonly locations: Location[] = []; + /** + * Defines an alias for this fleet. + * + * ```ts + * declare const fleet: gamelift.FleetBase; + * + * fleet.addAlias('Live'); + * + * // Is equivalent to + * + * new gamelift.Alias(this, 'AliasLive', { + * aliasName: 'Live', + * fleet: fleet, + * }); + * ``` + * + * @param aliasName The name of the alias + * @param options Alias options + */ + public addAlias(aliasName: string, options: AliasOptions = {}) { + return new Alias(this, `Alias${aliasName}`, { + aliasName, + fleet: this, + ...options, + }); + } + public grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant { return iam.Grant.addToPrincipal({ resourceArns: [this.fleetArn], diff --git a/packages/@aws-cdk/aws-gamelift/lib/index.ts b/packages/@aws-cdk/aws-gamelift/lib/index.ts index a6159851e5d3e..cf3f58b835042 100644 --- a/packages/@aws-cdk/aws-gamelift/lib/index.ts +++ b/packages/@aws-cdk/aws-gamelift/lib/index.ts @@ -1,3 +1,4 @@ +export * from './alias'; export * from './content'; export * from './build'; export * from './script'; diff --git a/packages/@aws-cdk/aws-gamelift/test/alias.test.ts b/packages/@aws-cdk/aws-gamelift/test/alias.test.ts new file mode 100644 index 0000000000000..f05ae593968d0 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/alias.test.ts @@ -0,0 +1,191 @@ + +import * as path from 'path'; +import { Template } from '@aws-cdk/assertions'; +import * as ec2 from '@aws-cdk/aws-ec2'; +import * as cdk from '@aws-cdk/core'; +import * as gamelift from '../lib'; + +describe('alias', () => { + + describe('new', () => { + let stack: cdk.Stack; + let fleet: gamelift.FleetBase; + + beforeEach(() => { + stack = new cdk.Stack(); + fleet = new gamelift.BuildFleet(stack, 'MyBuildFleet', { + fleetName: 'test-fleet', + content: gamelift.Build.fromAsset(stack, 'Build', path.join(__dirname, 'my-game-build')), + instanceType: ec2.InstanceType.of(ec2.InstanceClass.C4, ec2.InstanceSize.LARGE), + runtimeConfiguration: { + serverProcesses: [{ + launchPath: 'test-launch-path', + }], + }, + }); + }); + + test('default fleet alias', () => { + new gamelift.Alias(stack, 'MyAlias', { + aliasName: 'test-alias', + fleet: fleet, + }); + + Template.fromStack(stack).hasResource('AWS::GameLift::Alias', { + Properties: + { + Name: 'test-alias', + RoutingStrategy: { + FleetId: { Ref: 'MyBuildFleet0F4EADEC' }, + Type: 'SIMPLE', + }, + }, + }); + }); + + test('default terminate alias', () => { + new gamelift.Alias(stack, 'MyAlias', { + aliasName: 'test-alias', + terminalMessage: 'terminate message', + }); + + Template.fromStack(stack).hasResource('AWS::GameLift::Alias', { + Properties: + { + Name: 'test-alias', + RoutingStrategy: { + Message: 'terminate message', + Type: 'TERMINAL', + }, + }, + }); + }); + + test('with an incorrect alias name', () => { + let incorrectName = ''; + for (let i = 0; i < 1025; i++) { + incorrectName += 'A'; + } + + expect(() => new gamelift.Alias(stack, 'MyAlias', { + aliasName: incorrectName, + fleet: fleet, + })).toThrow(/Alias name can not be longer than 1024 characters but has 1025 characters./); + }); + + test('with an incorrect description', () => { + let incorrectDescription = ''; + for (let i = 0; i < 1025; i++) { + incorrectDescription += 'A'; + } + + expect(() => new gamelift.Alias(stack, 'MyAlias', { + aliasName: 'test-name', + description: incorrectDescription, + fleet: fleet, + })).toThrow(/Alias description can not be longer than 1024 characters but has 1025 characters./); + }); + + test('with none of fleet and terminalMessage properties', () => { + expect(() => new gamelift.Alias(stack, 'MyAlias', { + aliasName: 'test-name', + terminalMessage: 'a terminal message', + fleet: fleet, + })).toThrow(/Either a terminal message or a fleet must be binded to this Alias./); + }); + + test('with both fleet and terminalMessage properties', () => { + expect(() => new gamelift.Alias(stack, 'MyAlias', { + aliasName: 'test-name', + terminalMessage: 'a terminal message', + fleet: fleet, + })).toThrow(/Either a terminal message or a fleet must be binded to this Alias, not both./); + }); + }); + + describe('test import methods', () => { + test('Alias.fromAliasArn', () => { + // GIVEN + const stack2 = new cdk.Stack(); + + // WHEN + const imported = gamelift.Alias.fromAliasArn(stack2, 'Imported', 'arn:aws:gamelift:us-east-1:123456789012:alias/sample-alias-id'); + + // THEN + expect(imported.aliasArn).toEqual('arn:aws:gamelift:us-east-1:123456789012:alias/sample-alias-id'); + expect(imported.aliasId).toEqual('sample-alias-id'); + }); + + test('Alias.fromAliasId', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + const imported = gamelift.Alias.fromAliasId(stack, 'Imported', 'sample-alias-id'); + + // THEN + expect(stack.resolve(imported.aliasArn)).toStrictEqual({ + 'Fn::Join': ['', [ + 'arn:', + { Ref: 'AWS::Partition' }, + ':gamelift:', + { Ref: 'AWS::Region' }, + ':', + { Ref: 'AWS::AccountId' }, + ':alias/sample-alias-id', + ]], + }); + expect(stack.resolve(imported.aliasId)).toStrictEqual('sample-alias-id'); + }); + }); + + describe('Alias.fromAliasAttributes()', () => { + let stack: cdk.Stack; + const aliasId = 'alias-test-identifier'; + const aliasArn = `arn:aws:gamelift:alias-region:123456789012:alias/${aliasId}`; + + beforeEach(() => { + const app = new cdk.App(); + stack = new cdk.Stack(app, 'Base', { + env: { account: '111111111111', region: 'stack-region' }, + }); + }); + + describe('', () => { + test('with required attrs only', () => { + const importedFleet = gamelift.Alias.fromAliasAttributes(stack, 'ImportedAlias', { aliasArn }); + + expect(importedFleet.aliasId).toEqual(aliasId); + expect(importedFleet.aliasArn).toEqual(aliasArn); + expect(importedFleet.env.account).toEqual('123456789012'); + expect(importedFleet.env.region).toEqual('alias-region'); + }); + + test('with missing attrs', () => { + expect(() => gamelift.Alias.fromAliasAttributes(stack, 'ImportedAlias', { })) + .toThrow(/Either aliasId or aliasArn must be provided in AliasAttributes/); + }); + + test('with invalid ARN', () => { + expect(() => gamelift.Alias.fromAliasAttributes(stack, 'ImportedAlias', { aliasArn: 'arn:aws:gamelift:alias-region:123456789012:alias' })) + .toThrow(/No alias identifier found in ARN: 'arn:aws:gamelift:alias-region:123456789012:alias'/); + }); + }); + + describe('for an alias in a different account and region', () => { + let alias: gamelift.IAlias; + + beforeEach(() => { + alias = gamelift.Alias.fromAliasAttributes(stack, 'ImportedAlias', { aliasArn }); + }); + + test("the alias's region is taken from the ARN", () => { + expect(alias.env.region).toBe('alias-region'); + }); + + test("the alias's account is taken from the ARN", () => { + expect(alias.env.account).toBe('123456789012'); + }); + }); + }); +}); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/AliasDefaultTestDeployAssert722FACAF.assets.json b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/AliasDefaultTestDeployAssert722FACAF.assets.json new file mode 100644 index 0000000000000..3386ef53adb16 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/AliasDefaultTestDeployAssert722FACAF.assets.json @@ -0,0 +1,19 @@ +{ + "version": "21.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "AliasDefaultTestDeployAssert722FACAF.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/AliasDefaultTestDeployAssert722FACAF.template.json b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/AliasDefaultTestDeployAssert722FACAF.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/AliasDefaultTestDeployAssert722FACAF.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer new file mode 100755 index 0000000000000..a4f885388c109 Binary files /dev/null and b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/TestApplicationServer differ diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh new file mode 100755 index 0000000000000..1ef448e39373c --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37/install.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# make sure the gameserver is executable +/usr/bin/chmod +x /local/game/TestApplicationServer +exit 0 diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/aws-gamelift-alias.assets.json b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/aws-gamelift-alias.assets.json new file mode 100644 index 0000000000000..36782425e4097 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/aws-gamelift-alias.assets.json @@ -0,0 +1,32 @@ +{ + "version": "21.0.0", + "files": { + "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37": { + "source": { + "path": "asset.b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "e4908024ef4196d7db3a85db12e1098c88d43cc46adb561335d1712587bddc29": { + "source": { + "path": "aws-gamelift-alias.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "e4908024ef4196d7db3a85db12e1098c88d43cc46adb561335d1712587bddc29.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/aws-gamelift-alias.template.json b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/aws-gamelift-alias.template.json new file mode 100644 index 0000000000000..de8352e9c8a44 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/aws-gamelift-alias.template.json @@ -0,0 +1,200 @@ +{ + "Resources": { + "BuildServiceRole1F57E904": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "gamelift.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "BuildServiceRoleDefaultPolicyCB7101C6": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetObject", + "s3:GetObjectVersion" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "/b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "BuildServiceRoleDefaultPolicyCB7101C6", + "Roles": [ + { + "Ref": "BuildServiceRole1F57E904" + } + ] + } + }, + "Build45A36621": { + "Type": "AWS::GameLift::Build", + "Properties": { + "OperatingSystem": "AMAZON_LINUX_2", + "StorageLocation": { + "Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "Key": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", + "RoleArn": { + "Fn::GetAtt": [ + "BuildServiceRole1F57E904", + "Arn" + ] + } + } + }, + "DependsOn": [ + "BuildServiceRoleDefaultPolicyCB7101C6", + "BuildServiceRole1F57E904" + ] + }, + "BuildFleetServiceRole32D49FB4": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": [ + "ec2.amazonaws.com", + "gamelift.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + } + } + }, + "BuildFleet027ED403": { + "Type": "AWS::GameLift::Fleet", + "Properties": { + "BuildId": { + "Ref": "Build45A36621" + }, + "CertificateConfiguration": { + "CertificateType": "DISABLED" + }, + "EC2InboundPermissions": [ + { + "FromPort": 1935, + "IpRange": "0.0.0.0/0", + "Protocol": "TCP", + "ToPort": 1935 + } + ], + "EC2InstanceType": "c5.large", + "FleetType": "ON_DEMAND", + "InstanceRoleARN": { + "Fn::GetAtt": [ + "BuildFleetServiceRole32D49FB4", + "Arn" + ] + }, + "MaxSize": 1, + "MinSize": 0, + "Name": "test-fleet", + "NewGameSessionProtectionPolicy": "NoProtection", + "RuntimeConfiguration": { + "GameSessionActivationTimeoutSeconds": 300, + "MaxConcurrentGameSessionActivations": 1, + "ServerProcesses": [ + { + "ConcurrentExecutions": 1, + "LaunchPath": "/local/game/TestApplicationServer", + "Parameters": "port:1935 gameSessionLengthSeconds:20" + } + ] + } + } + }, + "FleetAlias81A5A097": { + "Type": "AWS::GameLift::Alias", + "Properties": { + "Name": "test-alias", + "RoutingStrategy": { + "FleetId": { + "Ref": "BuildFleet027ED403" + }, + "Type": "SIMPLE" + } + } + }, + "TerminalAliasF1014036": { + "Type": "AWS::GameLift::Alias", + "Properties": { + "Name": "test-alias", + "RoutingStrategy": { + "Message": "a terminal message", + "Type": "TERMINAL" + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/cdk.out b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/cdk.out new file mode 100644 index 0000000000000..8ecc185e9dbee --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/integ.json b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/integ.json new file mode 100644 index 0000000000000..bda4ab0470621 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "21.0.0", + "testCases": { + "Alias/DefaultTest": { + "stacks": [ + "aws-gamelift-alias" + ], + "assertionStack": "Alias/DefaultTest/DeployAssert", + "assertionStackName": "AliasDefaultTestDeployAssert722FACAF" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/manifest.json b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/manifest.json new file mode 100644 index 0000000000000..551eb8cb30f38 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/manifest.json @@ -0,0 +1,147 @@ +{ + "version": "21.0.0", + "artifacts": { + "aws-gamelift-alias.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "aws-gamelift-alias.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "aws-gamelift-alias": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "aws-gamelift-alias.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/e4908024ef4196d7db3a85db12e1098c88d43cc46adb561335d1712587bddc29.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "aws-gamelift-alias.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "aws-gamelift-alias.assets" + ], + "metadata": { + "/aws-gamelift-alias/Build/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildServiceRole1F57E904" + } + ], + "/aws-gamelift-alias/Build/ServiceRole/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildServiceRoleDefaultPolicyCB7101C6" + } + ], + "/aws-gamelift-alias/Build/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Build45A36621" + } + ], + "/aws-gamelift-alias/BuildFleet/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildFleetServiceRole32D49FB4" + } + ], + "/aws-gamelift-alias/BuildFleet/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "BuildFleet027ED403" + } + ], + "/aws-gamelift-alias/FleetAlias/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "FleetAlias81A5A097" + } + ], + "/aws-gamelift-alias/TerminalAlias/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TerminalAliasF1014036" + } + ], + "/aws-gamelift-alias/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/aws-gamelift-alias/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "aws-gamelift-alias" + }, + "AliasDefaultTestDeployAssert722FACAF.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "AliasDefaultTestDeployAssert722FACAF.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "AliasDefaultTestDeployAssert722FACAF": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "AliasDefaultTestDeployAssert722FACAF.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "AliasDefaultTestDeployAssert722FACAF.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "AliasDefaultTestDeployAssert722FACAF.assets" + ], + "metadata": { + "/Alias/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/Alias/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "Alias/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/tree.json b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/tree.json new file mode 100644 index 0000000000000..30ddbb4a42958 --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.js.snapshot/tree.json @@ -0,0 +1,435 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "aws-gamelift-alias": { + "id": "aws-gamelift-alias", + "path": "aws-gamelift-alias", + "children": { + "Build": { + "id": "Build", + "path": "aws-gamelift-alias/Build", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "aws-gamelift-alias/Build/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "aws-gamelift-alias/Build/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-alias/Build/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "gamelift.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "aws-gamelift-alias/Build/ServiceRole/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-alias/Build/ServiceRole/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "s3:GetObject", + "s3:GetObjectVersion" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":s3:::", + { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "/b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "BuildServiceRoleDefaultPolicyCB7101C6", + "roles": [ + { + "Ref": "BuildServiceRole1F57E904" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Content": { + "id": "Content", + "path": "aws-gamelift-alias/Build/Content", + "children": { + "Stage": { + "id": "Stage", + "path": "aws-gamelift-alias/Build/Content/Stage", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "aws-gamelift-alias/Build/Content/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-s3-assets.Asset", + "version": "0.0.0" + } + }, + "AssetBucket": { + "id": "AssetBucket", + "path": "aws-gamelift-alias/Build/AssetBucket", + "constructInfo": { + "fqn": "@aws-cdk/aws-s3.BucketBase", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-alias/Build/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::Build", + "aws:cdk:cloudformation:props": { + "operatingSystem": "AMAZON_LINUX_2", + "storageLocation": { + "bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "key": "b95e4173bc399a8f686a4951aa26e01de1ed1e9d981ee1a7f18a15512dbdcb37.zip", + "roleArn": { + "Fn::GetAtt": [ + "BuildServiceRole1F57E904", + "Arn" + ] + } + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnBuild", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.Build", + "version": "0.0.0" + } + }, + "BuildFleet": { + "id": "BuildFleet", + "path": "aws-gamelift-alias/BuildFleet", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "aws-gamelift-alias/BuildFleet/ServiceRole", + "children": { + "ImportServiceRole": { + "id": "ImportServiceRole", + "path": "aws-gamelift-alias/BuildFleet/ServiceRole/ImportServiceRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-alias/BuildFleet/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": [ + "ec2.amazonaws.com", + "gamelift.amazonaws.com" + ] + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "aws-gamelift-alias/BuildFleet/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::Fleet", + "aws:cdk:cloudformation:props": { + "buildId": { + "Ref": "Build45A36621" + }, + "certificateConfiguration": { + "certificateType": "DISABLED" + }, + "ec2InboundPermissions": [ + { + "protocol": "TCP", + "fromPort": 1935, + "toPort": 1935, + "ipRange": "0.0.0.0/0" + } + ], + "ec2InstanceType": "c5.large", + "fleetType": "ON_DEMAND", + "instanceRoleArn": { + "Fn::GetAtt": [ + "BuildFleetServiceRole32D49FB4", + "Arn" + ] + }, + "maxSize": 1, + "minSize": 0, + "name": "test-fleet", + "newGameSessionProtectionPolicy": "NoProtection", + "runtimeConfiguration": { + "gameSessionActivationTimeoutSeconds": 300, + "maxConcurrentGameSessionActivations": 1, + "serverProcesses": [ + { + "parameters": "port:1935 gameSessionLengthSeconds:20", + "launchPath": "/local/game/TestApplicationServer", + "concurrentExecutions": 1 + } + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnFleet", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.BuildFleet", + "version": "0.0.0" + } + }, + "FleetAlias": { + "id": "FleetAlias", + "path": "aws-gamelift-alias/FleetAlias", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-alias/FleetAlias/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::Alias", + "aws:cdk:cloudformation:props": { + "name": "test-alias", + "routingStrategy": { + "fleetId": { + "Ref": "BuildFleet027ED403" + }, + "type": "SIMPLE" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnAlias", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.Alias", + "version": "0.0.0" + } + }, + "TerminalAlias": { + "id": "TerminalAlias", + "path": "aws-gamelift-alias/TerminalAlias", + "children": { + "Resource": { + "id": "Resource", + "path": "aws-gamelift-alias/TerminalAlias/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::GameLift::Alias", + "aws:cdk:cloudformation:props": { + "name": "test-alias", + "routingStrategy": { + "message": "a terminal message", + "type": "TERMINAL" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.CfnAlias", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-gamelift.Alias", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "aws-gamelift-alias/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "aws-gamelift-alias/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "Alias": { + "id": "Alias", + "path": "Alias", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "Alias/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "Alias/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.161" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "Alias/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "Alias/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "Alias/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.161" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/test/integ.alias.ts b/packages/@aws-cdk/aws-gamelift/test/integ.alias.ts new file mode 100644 index 0000000000000..83570d17b9f0f --- /dev/null +++ b/packages/@aws-cdk/aws-gamelift/test/integ.alias.ts @@ -0,0 +1,56 @@ +import * as path from 'path'; +import * as ec2 from '@aws-cdk/aws-ec2'; +import * as cdk from '@aws-cdk/core'; +import { Duration } from '@aws-cdk/core'; +import { IntegTest } from '@aws-cdk/integ-tests'; +import { Construct } from 'constructs'; +import * as gamelift from '../lib'; + +class TestStack extends cdk.Stack { + constructor(scope: Construct, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const build = new gamelift.Build(this, 'Build', { + content: gamelift.Content.fromAsset(path.join(__dirname, 'my-game-build')), + operatingSystem: gamelift.OperatingSystem.AMAZON_LINUX_2, + }); + + const fleet = new gamelift.BuildFleet(this, 'BuildFleet', { + fleetName: 'test-fleet', + content: build, + ingressRules: [{ + source: gamelift.Peer.anyIpv4(), + port: gamelift.Port.tcp(1935), + }], + instanceType: ec2.InstanceType.of(ec2.InstanceClass.C5, ec2.InstanceSize.LARGE), + runtimeConfiguration: { + gameSessionActivationTimeout: Duration.seconds(300), + maxConcurrentGameSessionActivations: 1, + serverProcesses: [{ + launchPath: '/local/game/TestApplicationServer', + parameters: 'port:1935 gameSessionLengthSeconds:20', + concurrentExecutions: 1, + }], + }, + }); + + new gamelift.Alias(this, 'FleetAlias', { + aliasName: 'test-alias', + fleet: fleet, + }); + + new gamelift.Alias(this, 'TerminalAlias', { + aliasName: 'test-alias', + terminalMessage: 'a terminal message', + }); + } +} + +// Beginning of the test suite +const app = new cdk.App(); +const stack = new TestStack(app, 'aws-gamelift-alias'); +new IntegTest(app, 'Alias', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file