@aws-cdk_aws-gamelift-alpha.Script

class Script (construct) ๐Ÿ”น

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

Implements IConstruct, IDependable, IResource, IScript, IGrantable

A GameLift script, that is installed and runs on instances in an Amazon GameLift fleet.

It consists of a zip file with all of the components of the realtime game server script.

See also: https://docs.aws.amazon.com/gamelift/latest/developerguide/realtime-script-uploading.html

Example

declare const bucket: s3.Bucket;
new gamelift.Script(this, 'Script', {
  content: gamelift.Content.fromBucket(bucket, "sample-asset-key")
});

Initializer

new Script(scope: Construct, id: string, props: ScriptProps)

Parameters

  • scope Construct
  • id string
  • props ScriptProps

Construct Props

NameTypeDescription
content๐Ÿ”นContentThe game content.
role?๐Ÿ”นIRoleThe IAM role assumed by GameLift to access server script in S3.
scriptName?๐Ÿ”นstringName of this realtime server script.
scriptVersion?๐Ÿ”นstringVersion of this realtime server script.

content๐Ÿ”น

Type: Content

The game content.


role?๐Ÿ”น

Type: IRole (optional, default: a role will be created with default permissions.)

The IAM role assumed by GameLift to access server script in S3.

If providing a custom role, it needs to trust the GameLift service principal (gamelift.amazonaws.com) and be granted sufficient permissions to have Read access to a specific key content into a specific S3 bucket. Below an example of required permission: { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Action": [ "s3:GetObject", "s3:GetObjectVersion" ], "Resource": "arn:aws:s3:::bucket-name/object-name" }] }

See also: https://docs.aws.amazon.com/gamelift/latest/developerguide/security_iam_id-based-policy-examples.html#security_iam_id-based-policy-examples-access-storage-loc


scriptName?๐Ÿ”น

Type: string (optional, default: No name)

Name of this realtime server script.


scriptVersion?๐Ÿ”น

Type: string (optional, default: No version)

Version of this realtime server script.

Properties

NameTypeDescription
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
grantPrincipal๐Ÿ”นIPrincipalThe principal this GameLift script is using.
node๐Ÿ”นNodeThe tree node.
role๐Ÿ”นIRoleThe IAM role GameLift assumes to acccess server script content.
scriptArn๐Ÿ”นstringThe ARN of the realtime server script.
scriptId๐Ÿ”นstringThe Identifier of the realtime server script.
stack๐Ÿ”นStackThe stack in which this resource is defined.

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.


grantPrincipal๐Ÿ”น

Type: IPrincipal

The principal this GameLift script is using.


node๐Ÿ”น

Type: Node

The tree node.


role๐Ÿ”น

Type: IRole

The IAM role GameLift assumes to acccess server script content.


scriptArn๐Ÿ”น

Type: string

The ARN of the realtime server script.


scriptId๐Ÿ”น

Type: string

The Identifier of the realtime server script.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromAsset(scope, id, path, options?)๐Ÿ”นCreate a new realtime server script from asset content.
static fromBucket(scope, id, bucket, key, objectVersion?)๐Ÿ”นCreate a new realtime server script from s3 content.
static fromScriptArn(scope, id, scriptArn)๐Ÿ”นImport a script into CDK using its ARN.
static fromScriptAttributes(scope, id, attrs)๐Ÿ”นImport an existing realtime server script from its attributes.

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


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromAsset(scope, id, path, options?)๐Ÿ”น

public static fromAsset(scope: Construct, id: string, path: string, options?: AssetOptions): Script

Parameters

  • scope Construct
  • id string
  • path string
  • options AssetOptions

Returns

  • Script

Create a new realtime server script from asset content.


static fromBucket(scope, id, bucket, key, objectVersion?)๐Ÿ”น

public static fromBucket(scope: Construct, id: string, bucket: IBucket, key: string, objectVersion?: string): Script

Parameters

  • scope Construct
  • id string
  • bucket IBucket
  • key string
  • objectVersion string

Returns

  • Script

Create a new realtime server script from s3 content.


static fromScriptArn(scope, id, scriptArn)๐Ÿ”น

public static fromScriptArn(scope: Construct, id: string, scriptArn: string): IScript

Parameters

  • scope Construct
  • id string
  • scriptArn string

Returns

  • IScript

Import a script into CDK using its ARN.


static fromScriptAttributes(scope, id, attrs)๐Ÿ”น

public static fromScriptAttributes(scope: Construct, id: string, attrs: ScriptAttributes): IScript

Parameters

  • scope Construct
  • id string
  • attrs ScriptAttributes

Returns

  • IScript

Import an existing realtime server script from its attributes.