• 沒有找到結果。

Create a game build resource for manually uploading files to GameLift

在文檔中 GameLift Service (頁 38-48)

}

Sample Response

{ "Build": {

"BuildArn": "arn:aws:gamelift:us-west-2::build/

build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",

"BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CreationTime": 1496708916.18,

"Name": "MegaFrogRaceServer.NA", "OperatingSystem": "WINDOWS_2012", "SizeOnDisk": 0,

"Status": "READY", "Version": "12345.678"

},

"StorageLocation": {

"Bucket": "MegaFrogRaceServer_NA_build_files", "Key": "MegaFrogRaceServer_build_123.zip"

} }

Create a game build resource for manually uploading files to GameLift

This example creates a new build resource. It also gets a storage location and temporary credentials that allow you to manually upload your game build to the GameLift location in Amazon S3. When you specify a storage location, SizeOnDisk will be reported as 0. You can find the actual size in Amazon S3. Once you've successfully uploaded your build, the GameLift service validates the build and updates the new build's status.

HTTP requests are authenticated using an AWS Signature Version 4 signature in the Authorization header field.

Sample Request

{

"Name": "MegaFrogRaceServer.NA", "Version": "12345.678",

"OperatingSystem": "AMAZON_LINUX"

}

Sample Response

{

"Build": {

"BuildArn": "arn:aws:gamelift:us-west-2::build/

build-1111aaaa-22bb-33cc-44dd-5555eeee66ff",

"BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CreationTime": 1496708916.18,

"Name": "MegaFrogRaceServer.NA", "OperatingSystem": "AMAZON_LINUX",

See Also

"SizeOnDisk": 0, "Status": "READY", "Version": "12345.678"

},

"StorageLocation": {

"Bucket": "gamelift-builds-us-west-2",

"Key": "123456789012/build-1111aaaa-22bb-33cc-44dd-5555eeee66ff"

},

"UploadCredentials": {

"AccessKeyId": "AKIAIOSFODNN7EXAMPLE",

"SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "SessionToken": "AgoGb3JpZ2luENz...EXAMPLETOKEN=="

} }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

• AWS Command Line Interface

• AWS SDK for .NET

• AWS SDK for C++

• AWS SDK for Go

• AWS SDK for Java V2

• AWS SDK for JavaScript

• AWS SDK for PHP V3

• AWS SDK for Python

• AWS SDK for Ruby V3

CreateFleet

CreateFleet

Creates a fleet of Amazon Elastic Compute Cloud (Amazon Elastic Compute Cloud) instances to host your custom game server or Realtime Servers. Use this operation to configure the computing resources for your fleet and provide instructions for running game servers on each instance.

Most GameLift fleets can deploy instances to multiple locations, including the home Region (where the fleet is created) and an optional set of remote locations. Fleets that are created in the following AWS Regions support multiple locations: us-east-1 (N. Virginia), us-west-2 (Oregon), eu-central-1 (Frankfurt), eu-west-1 (Ireland), ap-southeast-2 (Sydney), ap-northeast-1 (Tokyo), and ap-northeast-2 (Seoul). Fleets that are created in other GameLift Regions can deploy instances in the fleet's home Region only. All fleet instances use the same configuration regardless of location; however, you can adjust capacity settings and turn auto-scaling on/off for each location.

To create a fleet, choose the hardware for your instances, specify a game server build or Realtime script to deploy, and provide a runtime configuration to direct GameLift how to start and run game servers on each instance in the fleet. Set permissions for inbound traffic to your game servers, and enable optional features as needed. When creating a multi-location fleet, provide a list of additional remote locations.

If you need to debug your fleet, fetch logs, view performance metrics or other actions on the fleet, create the development fleet with port 22/3389 open. As a best practice, we recommend opening ports for remote access only when you need them and closing them when you're finished.

If successful, this operation creates a new Fleet resource and places it in NEW status, which prompts GameLift to initiate the fleet creation workflow. You can track fleet creation by checking fleet status using DescribeFleetAttributes (p. 140) and DescribeFleetLocationAttributes (p. 156)/, or by

monitoring fleet creation events using DescribeFleetEvents (p. 151). As soon as the fleet status changes to ACTIVE, you can enable automatic scaling for the fleet with PutScalingPolicy (p. 275) and set capacity for the home Region with UpdateFleetCapacity (p. 354). When the status of each remote location reaches ACTIVE, you can set capacity by location using UpdateFleetCapacity (p. 354).

Learn more Setting up fleets

Debug fleet creation issues Multi-location fleets Related actions

CreateFleet (p. 22) | UpdateFleetCapacity (p. 354) | PutScalingPolicy (p. 275)

| DescribeEC2InstanceLimits (p. 135) | DescribeFleetAttributes (p. 140) |

DescribeFleetLocationAttributes (p. 156) | UpdateFleetAttributes (p. 350) | StopFleetActions (p. 325)

| DeleteFleet (p. 100) | All APIs by task

Request Syntax

{ "BuildId": "string",

"CertificateConfiguration": { "CertificateType": "string"

},

"Description": "string", "EC2InboundPermissions": [ {

"FromPort": number,

Request Parameters

"EC2InstanceType": "string", "FleetType": "string", "InstanceRoleArn": "string", "Locations": [

{

"Location": "string"

} ],

"LogPaths": [ "string" ], "MetricGroups": [ "string" ], "Name": "string",

"NewGameSessionProtectionPolicy": "string", "PeerVpcAwsAccountId": "string",

"PeerVpcId": "string",

"ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": number, "PolicyPeriodInMinutes": number },

"RuntimeConfiguration": {

"GameSessionActivationTimeoutSeconds": number, "MaxConcurrentGameSessionActivations": number, "ServerProcesses": [

"ScriptId": "string",

"ServerLaunchParameters": "string", "ServerLaunchPath": "string", "Tags": [

For information about the parameters that are common to all actions, see Common Parameters (p. 509).

The request accepts the following data in JSON format.

NoteIn the following list, the required parameters are described first.

EC2InstanceType (p. 22)

The GameLift-supported Amazon EC2 instance type to use for all fleet instances. Instance type determines the computing resources that will be used to host your game servers, including CPU, memory, storage, and networking capacity. See Amazon Elastic Compute Cloud Instance Types for detailed descriptions of Amazon EC2 instance types.

Type: String

Request Parameters

Valid Values: t2.micro | t2.small | t2.medium | t2.large | c3.large | c3.xlarge

| c3.2xlarge | c3.4xlarge | c3.8xlarge | c4.large | c4.xlarge | c4.2xlarge

| c4.4xlarge | c4.8xlarge | c5.large | c5.xlarge | c5.2xlarge | c5.4xlarge

| c5.9xlarge | c5.12xlarge | c5.18xlarge | c5.24xlarge | c5a.large | c5a.xlarge | c5a.2xlarge | c5a.4xlarge | c5a.8xlarge | c5a.12xlarge |

c5a.16xlarge | c5a.24xlarge | r3.large | r3.xlarge | r3.2xlarge | r3.4xlarge

| r3.8xlarge | r4.large | r4.xlarge | r4.2xlarge | r4.4xlarge | r4.8xlarge

| r4.16xlarge | r5.large | r5.xlarge | r5.2xlarge | r5.4xlarge | r5.8xlarge

| r5.12xlarge | r5.16xlarge | r5.24xlarge | r5a.large | r5a.xlarge | r5a.2xlarge | r5a.4xlarge | r5a.8xlarge | r5a.12xlarge | r5a.16xlarge | r5a.24xlarge | m3.medium | m3.large | m3.xlarge | m3.2xlarge | m4.large | m4.xlarge | m4.2xlarge | m4.4xlarge | m4.10xlarge | m5.large | m5.xlarge

| m5.2xlarge | m5.4xlarge | m5.8xlarge | m5.12xlarge | m5.16xlarge

| m5.24xlarge | m5a.large | m5a.xlarge | m5a.2xlarge | m5a.4xlarge | m5a.8xlarge | m5a.12xlarge | m5a.16xlarge | m5a.24xlarge

Required: Yes Name (p. 22)

A descriptive label that is associated with a fleet. Fleet names do not need to be unique.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: Yes BuildId (p. 22)

The unique identifier for a custom game server build to be deployed on fleet instances. You can use either the build ID or ARN. The build must be uploaded to GameLift and in READY status. This fleet property cannot be changed later.

Type: String

Pattern: ^build-\S+|^arn:.*:build\/build-\S+

Required: No

CertificateConfiguration (p. 22)

Prompts GameLift to generate a TLS/SSL certificate for the fleet. TLS certificates are used for encrypting traffic between game clients and the game servers that are running on GameLift. By default, the CertificateConfiguration is set to DISABLED. This property cannot be changed after the fleet is created.

Note: This feature requires the AWS Certificate Manager (ACM) service, which is not available in all AWS regions. When working in a region that does not support this feature, a fleet creation request with certificate generation fails with a 4xx error.

Type: CertificateConfiguration (p. 406) object Required: No

Description (p. 22)

A human-readable description of the fleet.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

Request Parameters

EC2InboundPermissions (p. 22)

The allowed IP address ranges and port settings that allow inbound traffic to access game sessions on this fleet. If the fleet is hosting a custom game build, this property must be set before players can connect to game sessions. For Realtime Servers fleets, GameLift automatically sets TCP and UDP ranges.

Type: Array of IpPermission (p. 460) objects Array Members: Maximum number of 50 items.

Required: No FleetType (p. 22)

Indicates whether to use On-Demand or Spot instances for this fleet. By default, this property is set to ON_DEMAND. Learn more about when to use On-Demand versus Spot Instances. This property cannot be changed after the fleet is created.

Type: String

Valid Values: ON_DEMAND | SPOT Required: No

InstanceRoleArn (p. 22)

A unique identifier for an IAM role that manages access to your AWS services. With an instance role ARN set, any application that runs on an instance in this fleet can assume the role, including install scripts, server processes, and daemons (background processes). Create a role or look up a role's ARN by using the IAM dashboard in the AWS Management Console. Learn more about using on-box credentials for your game servers at Access external resources from a game server. This property cannot be changed after the fleet is created.

Type: String

Length Constraints: Minimum length of 1.

Required: No Locations (p. 22)

A set of remote locations to deploy additional instances to and manage as part of the fleet. This parameter can only be used when creating fleets in AWS Regions that support multiple locations.

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. To create a fleet with instances in the home Region only, omit this parameter.

Type: Array of LocationConfiguration (p. 465) objects

Array Members: Minimum number of 1 item. Maximum number of 100 items.

Required: No LogPaths (p. 22)

This parameter is no longer used. To specify where GameLift should store log files once a server process shuts down, use the GameLift server API ProcessReady() and specify one or more directory paths in logParameters. See more information in the Server API Reference.

Type: Array of strings

Length Constraints: Minimum length of 1. Maximum length of 1024.

Request Parameters

Required: No MetricGroups (p. 22)

The name of an AWS CloudWatch metric group to add this fleet to. A metric group is used to aggregate the metrics for multiple fleets. You can specify an existing metric group name or set a new name to create a new metric group. A fleet can be included in only one metric group at a time.

Type: Array of strings

Array Members: Maximum number of 1 item.

Length Constraints: Minimum length of 1. Maximum length of 255.

Required: No

NewGameSessionProtectionPolicy (p. 22)

The status of termination protection for active game sessions on the fleet. By default, this property is set to NoProtection. You can also set game session protection for an individual game session by calling UpdateGameSession (p. 373).

NoProtection - Game sessions can be terminated during active gameplay as a result of a scale-down event.

FullProtection - Game sessions in ACTIVE status cannot be terminated during a scale-down event.

Type: String

Valid Values: NoProtection | FullProtection Required: No

PeerVpcAwsAccountId (p. 22)

Used when peering your GameLift fleet with a VPC, the unique identifier for the AWS account that owns the VPC. You can find your account ID in the AWS Management Console under account settings.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No PeerVpcId (p. 22)

A unique identifier for a VPC with resources to be accessed by your GameLift fleet. The VPC must be in the same Region as your fleet. To look up a VPC ID, use the VPC Dashboard in the AWS Management Console. Learn more about VPC peering in VPC Peering with GameLift Fleets.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Required: No

ResourceCreationLimitPolicy (p. 22)

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.

Type: ResourceCreationLimitPolicy (p. 487) object Required: No

Request Parameters

RuntimeConfiguration (p. 22)

Instructions for how to launch and maintain server processes on instances in the fleet. The runtime configuration defines one or more server process configurations, each identifying a build executable or Realtime script file and the number of processes of that type to run concurrently.

NoteThe RuntimeConfiguration parameter is required unless the fleet is being configured using the older parameters ServerLaunchPath and ServerLaunchParameters, which are still supported for backward compatibility.

Type: RuntimeConfiguration (p. 489) object Required: No

ScriptId (p. 22)

The unique identifier for a Realtime configuration script to be deployed on fleet instances. You can use either the script ID or ARN. Scripts must be uploaded to GameLift prior to creating the fleet. This fleet property cannot be changed later.

Type: String

Pattern: ^script-\S+|^arn:.*:script\/script-\S+

Required: No

ServerLaunchParameters (p. 22)

This parameter is no longer used. Specify server launch parameters using the

RuntimeConfiguration parameter. Requests that use this parameter instead continue to be valid.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: [A-Za-z0-9_:.+\/\\\- =@;{},?'\[\]"]+

Required: No

ServerLaunchPath (p. 22)

This parameter is no longer used. Specify a server launch path using the RuntimeConfiguration parameter. Requests that use this parameter instead continue to be valid.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Pattern: [A-Za-z0-9_:.+\/\\\- ]+

Required: No Tags (p. 22)

A list of labels to assign to the new fleet resource. Tags are developer-defined key-value pairs.

Tagging AWS resources are useful for resource management, access management and cost allocation. For more information, see Tagging AWS Resources in the AWS General Reference.

Once the fleet is created, you can use TagResource (p. 338), UntagResource (p. 341), and

ListTagsForResource (p. 272) to add, remove, and view tags. The maximum tag limit may be lower than stated. See the AWS General Reference for actual tagging limits.

Type: Array of Tag (p. 501) objects

Array Members: Minimum number of 0 items. Maximum number of 200 items.

Response Syntax

"CertificateConfiguration": { "CertificateType": "string"

},

"CreationTime": number, "Description": "string", "FleetArn": "string", "FleetId": "string", "FleetType": "string", "InstanceRoleArn": "string", "InstanceType": "string", "LogPaths": [ "string" ], "MetricGroups": [ "string" ], "Name": "string",

"NewGameSessionProtectionPolicy": "string", "OperatingSystem": "string",

"ResourceCreationLimitPolicy": { "NewGameSessionsPerCreator": number, "PolicyPeriodInMinutes": number },

"ScriptArn": "string", "ScriptId": "string",

"ServerLaunchParameters": "string", "ServerLaunchPath": "string", "Status": "string",

"StoppedActions": [ "string" ], "TerminationTime": number },

"LocationStates": [ {

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

FleetAttributes (p. 28)

The properties for the new fleet, including the current status. All fleets are placed in NEW status on creation.

Type: FleetAttributes (p. 417) object LocationStates (p. 28)

The fleet's locations and life-cycle status of each location. For new fleets, the status of all locations is set to NEW. During fleet creation, GameLift updates each location status as instances are deployed

Errors

there and prepared for game hosting. This list includes an entry for the fleet's home Region. For fleets with no remote locations, only one entry, representing the home Region, is returned.

Type: Array of LocationState (p. 466) objects

Errors

For information about the errors that are common to all actions, see Common Errors (p. 511).

ConflictException

The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request.

HTTP Status Code: 400 InternalServiceException

The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.

HTTP Status Code: 500 InvalidRequestException

One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.

HTTP Status Code: 400 LimitExceededException

The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.

HTTP Status Code: 400 NotFoundException

A service resource associated with the request could not be found. Clients should not retry such requests.

HTTP Status Code: 400 TaggingFailedException

The requested tagging operation did not succeed. This may be due to invalid tag format or the maximum tag limit may have been exceeded. Resolve the issue before retrying.

HTTP Status Code: 400 UnauthorizedException

The client failed authentication. Clients should not retry such requests.

HTTP Status Code: 400 UnsupportedRegionException

The requested operation is not supported in the Region specified.

HTTP Status Code: 400

Examples

Examples

在文檔中 GameLift Service (頁 38-48)