class Alias (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.GameLift.Alpha.Alias |
![]() | github.com/aws/aws-cdk-go/awscdkgameliftalpha/v2#Alias |
![]() | software.amazon.awscdk.services.gamelift.alpha.Alias |
![]() | aws_cdk.aws_gamelift_alpha.Alias |
![]() | @aws-cdk/aws-gamelift-alpha ยป Alias |
Implements
IConstruct
, IDependable
, IResource
, IAlias
, IGame
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.
Example
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',
});
Initializer
new Alias(scope: Construct, id: string, props: AliasProps)
Parameters
- scope
Construct
- id
string
- props
Alias
Props
Construct Props
Name | Type | Description |
---|---|---|
alias | string | Name of this alias. |
description? | string | A human-readable description of the alias. |
fleet? | IFleet | A fleet that the alias points to. If specified, the alias resolves to one specific fleet. |
terminal | string | The message text to be used with a terminal routing strategy. |
aliasName
Type:
string
Name of this alias.
description?
Type:
string
(optional, default: no description)
A human-readable description of the alias.
fleet?
Type:
IFleet
(optional, default: no fleet that the alias points to.)
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.
terminalMessage?
Type:
string
(optional, default: no terminal message)
The message text to be used with a terminal routing strategy.
At least one of fleet
and terminalMessage
must be provided.
Properties
Name | Type | Description |
---|---|---|
alias | string | The ARN of the alias. |
alias | string | The Identifier of the alias. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
resource | string | The ARN to put into the destination field of a game session queue. |
stack | Stack | The stack in which this resource is defined. |
fleet? | IFleet | A fleet that the alias points to. |
aliasArn
Type:
string
The ARN of the alias.
aliasId
Type:
string
The Identifier of the alias.
env
Type:
Resource
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.
node
Type:
Node
The tree node.
resourceArnForDestination
Type:
string
The ARN to put into the destination field of a game session queue.
stack
Type:
Stack
The stack in which this resource is defined.
fleet?
Type:
IFleet
(optional)
A fleet that the alias points to.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import an existing alias from its ARN. |
static from | Import an existing alias from its attributes. |
static from | Import an existing alias from its identifier. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
).
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromAliasArn(scope, id, aliasArn)
public static fromAliasArn(scope: Construct, id: string, aliasArn: string): IAlias
Parameters
- scope
Construct
- id
string
- aliasArn
string
Returns
Import an existing alias from its ARN.
static fromAliasAttributes(scope, id, attrs)
public static fromAliasAttributes(scope: Construct, id: string, attrs: AliasAttributes): IAlias
Parameters
- scope
Construct
- id
string
- attrs
Alias
Attributes
Returns
Import an existing alias from its attributes.
static fromAliasId(scope, id, aliasId)
public static fromAliasId(scope: Construct, id: string, aliasId: string): IAlias
Parameters
- scope
Construct
- id
string
- aliasId
string
Returns
Import an existing alias from its identifier.