Build

class aws_cdk.aws_gamelift_alpha.Build(scope, id, *, content, build_name=None, build_version=None, operating_system=None, role=None, server_sdk_version=None)

Bases: BuildBase

(experimental) A GameLift build, 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 game server build.

See:

https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-build-cli-uploading.html

Stability:

experimental

Resource:

AWS::GameLift::Build

ExampleMetadata:

infused

Example:

# bucket: s3.Bucket

build = gamelift.Build(self, "Build",
    content=gamelift.Content.from_bucket(bucket, "sample-asset-key")
)

CfnOutput(self, "BuildArn", value=build.build_arn)
CfnOutput(self, "BuildId", value=build.build_id)
Parameters:
  • scope (Construct) –

  • id (str) –

  • content (Content) – (experimental) The game build file storage.

  • build_name (Optional[str]) – (experimental) Name of this build. Default: No name

  • build_version (Optional[str]) – (experimental) Version of this build. Default: No version

  • operating_system (Optional[OperatingSystem]) – (experimental) The operating system that the game server binaries are built to run on. Default: No version

  • role (Optional[IRole]) – (experimental) The IAM role assumed by GameLift to access server build 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” }] } Default: - a role will be created with default permissions.

  • server_sdk_version (Optional[str]) – (experimental) A server SDK version you used when integrating your game server build with Amazon GameLift. Default: - 4.0.2

Stability:

experimental

Methods

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

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

build_arn

(experimental) The ARN of the build.

Stability:

experimental

build_id

(experimental) The Identifier of the build.

Stability:

experimental

env

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.

grant_principal

(experimental) The principal this GameLift Build is using.

Stability:

experimental

node

The tree node.

role

(experimental) The IAM role GameLift assumes to acccess server build content.

Stability:

experimental

stack

The stack in which this resource is defined.

Static Methods

classmethod from_asset(scope, id, path, *, deploy_time=None, readers=None, source_kms_key=None, asset_hash=None, asset_hash_type=None, bundling=None, exclude=None, follow_symlinks=None, ignore_mode=None)

(experimental) Create a new Build from asset content.

Parameters:
  • scope (Construct) –

  • id (str) –

  • path (str) –

  • deploy_time (Optional[bool]) – Whether or not the asset needs to exist beyond deployment time; i.e. are copied over to a different location and not needed afterwards. Setting this property to true has an impact on the lifecycle of the asset, because we will assume that it is safe to delete after the CloudFormation deployment succeeds. For example, Lambda Function assets are copied over to Lambda during deployment. Therefore, it is not necessary to store the asset in S3, so we consider those deployTime assets. Default: false

  • readers (Optional[Sequence[IGrantable]]) – A list of principals that should be able to read this asset from S3. You can use asset.grantRead(principal) to grant read permissions later. Default: - No principals that can read file asset.

  • source_kms_key (Optional[IKey]) – The ARN of the KMS key used to encrypt the handler code. Default: - the default server-side encryption with Amazon S3 managed keys(SSE-S3) key will be used.

  • asset_hash (Optional[str]) – Specify a custom hash for this asset. If assetHashType is set it must be set to AssetHashType.CUSTOM. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated. Default: - based on assetHashType

  • asset_hash_type (Optional[AssetHashType]) – Specifies the type of hash to calculate for this asset. If assetHash is configured, this option must be undefined or AssetHashType.CUSTOM. Default: - the default is AssetHashType.SOURCE, but if assetHash is explicitly specified this value defaults to AssetHashType.CUSTOM.

  • bundling (Union[BundlingOptions, Dict[str, Any], None]) – Bundle the asset by executing a command in a Docker container or a custom bundling provider. The asset path will be mounted at /asset-input. The Docker container is responsible for putting content at /asset-output. The content at /asset-output will be zipped and used as the final asset. Default: - uploaded as-is to S3 if the asset is a regular file or a .zip file, archived into a .zip file and uploaded to S3 otherwise

  • exclude (Optional[Sequence[str]]) – File paths matching the patterns will be excluded. See ignoreMode to set the matching behavior. Has no effect on Assets bundled using the bundling property. Default: - nothing is excluded

  • follow_symlinks (Optional[SymlinkFollowMode]) – A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER

  • ignore_mode (Optional[IgnoreMode]) – The ignore behavior to use for exclude patterns. Default: IgnoreMode.GLOB

Stability:

experimental

Return type:

Build

classmethod from_bucket(scope, id, bucket, key, object_version=None)

(experimental) Create a new Build from s3 content.

Parameters:
  • scope (Construct) –

  • id (str) –

  • bucket (IBucket) –

  • key (str) –

  • object_version (Optional[str]) –

Stability:

experimental

Return type:

Build

classmethod from_build_arn(scope, id, build_arn)

(experimental) Import a build into CDK using its ARN.

Parameters:
  • scope (Construct) –

  • id (str) –

  • build_arn (str) –

Stability:

experimental

Return type:

IBuild

classmethod from_build_attributes(scope, id, *, build_arn=None, build_id=None, role=None)

(experimental) Import an existing build from its attributes.

Parameters:
  • scope (Construct) –

  • id (str) –

  • build_arn (Optional[str]) – (experimental) The ARN of the build. At least one of buildArn and buildId must be provided. Default: derived from buildId.

  • build_id (Optional[str]) – (experimental) The identifier of the build. At least one of buildId and buildArn must be provided. Default: derived from buildArn.

  • role (Optional[IRole]) – (experimental) The IAM role assumed by GameLift to access server build in S3. Default: the imported fleet cannot be granted access to other resources as an iam.IGrantable.

Stability:

experimental

Return type:

IBuild

classmethod from_build_id(scope, id, build_id)

(experimental) Import a build into CDK using its identifier.

Parameters:
  • scope (Construct) –

  • id (str) –

  • build_id (str) –

Stability:

experimental

Return type:

IBuild

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool