本文件 AWS CLI 僅適用於 的第 1 版。如需與 第 2 版相關的文件 AWS CLI,請參閱 第 2 版使用者指南 。
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 的 Amazon GameLift 範例 AWS CLI
下列程式碼範例示範如何搭配 AWS Command Line Interface Amazon 使用 來執行動作和實作常見案例 GameLift。
Actions 是大型程式的程式碼摘錄,必須在內容中執行。雖然動作會示範如何呼叫個別服務函數,但您可以在其相關案例中查看內容中的動作。
每個範例都包含完整原始程式碼的連結,您可以在其中找到如何在內容中設定和執行程式碼的指示。
主題
動作
下列程式碼範例示範如何使用 create-build
。
- AWS CLI
-
Example1:從 S3 儲存貯體中的檔案建立遊戲組建
下列
create-build
範例會建立自訂遊戲建置資源。它使用存放在您控制之 AWS 帳戶中 S3 位置的壓縮檔案。此範例假設您已建立IAM角色,允許 Amazon GameLift 存取 S3 位置。由於請求未指定作業系統,因此新建置資源預設為 WINDOWS_2012。aws gamelift create-build \ --storage-location
file://storage-loc.json
\ --nameMegaFrogRaceServer.NA
\ --build-version12345.678
storage-loc.json
的內容:{ "Bucket":"MegaFrogRaceServer_NA_build_files" "Key":"MegaFrogRaceServer_build_123.zip" "RoleArn":"arn:aws:iam::123456789012:role/gamelift" }
輸出:
{ "Build": { "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "CreationTime": 1496708916.18, "Name": "MegaFrogRaceServer.NA", "OperatingSystem": "WINDOWS_2012", "SizeOnDisk": 479303, "Status": "INITIALIZED", "Version": "12345.678" }, "StorageLocation": { "Bucket": "MegaFrogRaceServer_NA_build_files", "Key": "MegaFrogRaceServer_build_123.zip" } }
Example2:建立遊戲建置資源,以手動上傳檔案至 GameLift
下列
create-build
範例會建立新的建置資源。它也會取得儲存位置和臨時憑證,可讓您手動將遊戲組建上傳到 Amazon S3 中 GameLift 的位置。成功上傳建置後, GameLift 服務會驗證建置並更新新建置的狀態。aws gamelift create-build \ --name
MegaFrogRaceServer.NA
\ --build-version12345.678
\ --operating-systemAMAZON_LINUX
輸出:
{ "Build": { "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "CreationTime": 1496708916.18, "Name": "MegaFrogRaceServer.NA", "OperatingSystem": "AMAZON_LINUX", "SizeOnDisk": 0, "Status": "INITIALIZED", "Version": "12345.678" }, "StorageLocation": { "Bucket": "gamelift-builds-us-west-2", "Key": "123456789012/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }, "UploadCredentials": { "AccessKeyId": "AKIAIOSFODNN7EXAMPLE", "SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "SessionToken": "AgoGb3JpZ2luENz...EXAMPLETOKEN==" } }
如需詳細資訊,請參閱 Amazon 開發人員指南 中的將自訂伺服器建置上傳至 GameLift 。 GameLift
-
如需API詳細資訊,請參閱 命令參考 CreateBuild
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-fleet
。
- AWS CLI
-
範例 1:建立基本 Linux 機群
下列
create-fleet
範例會建立最少設定的隨需 Linux 執行個體機群,以託管自訂伺服器建置。您可以使用 完成組態update-fleet
。aws gamelift create-fleet \ --name
MegaFrogRaceServer.NA.v2
\ --description 'Hosts for v2 North America
' \ --build-idbuild-1111aaaa-22bb-33cc-44dd-5555eeee66ff
\ --certificate-configuration 'CertificateType=GENERATED
' \ --ec2-instance-typec4.large
\ --fleet-typeON_DEMAND
\ --runtime-configuration 'ServerProcesses=[{LaunchPath=/local/game/release-na/MegaFrogRace_Server.exe,ConcurrentExecutions=1}]
'輸出:
{ "FleetAttributes": { "BuildId": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "CertificateConfiguration": { "CertificateType": "GENERATED" }, "CreationTime": 1496365885.44, "Description": "Hosts for v2 North America", "FleetArn": "arn:aws:gamelift:us-west-2:444455556666:fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "ON_DEMAND", "InstanceType": "c4.large", "MetricGroups": ["default"], "Name": "MegaFrogRace.NA.v2", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "AMAZON_LINUX", "ServerLaunchPath": "/local/game/release-na/MegaFrogRace_Server.exe", "Status": "NEW" } }
範例 2:建立基本 Windows 機群
下列
create-fleet
範例會建立最小設定的 Spot Windows 執行個體機群,以託管自訂伺服器建置。您可以使用 完成組態update-fleet
。aws gamelift create-fleet \ --name
MegaFrogRace.NA.v2
\ --description 'Hosts for v2 North America
' \ --build-idbuild-2222aaaa-33bb-44cc-55dd-6666eeee77ff
\ --certificate-configuration 'CertificateType=GENERATED
' \ --ec2-instance-typec4.large
\ --fleet-typeSPOT
\ --runtime-configuration 'ServerProcesses=[{LaunchPath=C:\game\Bin64.Release.Dedicated\MegaFrogRace_Server.exe,ConcurrentExecutions=1}]
'輸出:
{ "FleetAttributes": { "BuildId": "build-2222aaaa-33bb-44cc-55dd-6666eeee77ff", "CertificateConfiguration": { "CertificateType": "GENERATED" }, "CreationTime": 1496365885.44, "Description": "Hosts for v2 North America", "FleetArn": "arn:aws:gamelift:us-west-2:444455556666:fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "SPOT", "InstanceType": "c4.large", "MetricGroups": ["default"], "Name": "MegaFrogRace.NA.v2", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "WINDOWS_2012", "ServerLaunchPath": "C:\game\Bin64.Release.Dedicated\MegaFrogRace_Server.exe", "Status": "NEW" } }
範例 3:建立完全設定的機群
下列
create-fleet
範例會建立自訂伺服器建置的 Spot Windows 執行個體機群,並提供最常用的組態設定。aws gamelift create-fleet \ --name
MegaFrogRace.NA.v2
\ --description 'Hosts for v2 North America
' \ --build-idbuild-2222aaaa-33bb-44cc-55dd-6666eeee77ff
\ --certificate-configuration 'CertificateType=GENERATED
' \ --ec2-instance-typec4.large
\ --ec2-inbound-permissions 'FromPort=33435,ToPort=33435,IpRange=10.24.34.0/23,Protocol=UDP
' \ --fleet-typeSPOT
\ --new-game-session-protection-policyFullProtection
\ --runtime-configurationfile://runtime-config.json
\ --metric-groupsdefault
\ --instance-role-arn 'arn:aws:iam::444455556666:role/GameLiftS3Access
'runtime-config.json
的內容:GameSessionActivationTimeoutSeconds=300, MaxConcurrentGameSessionActivations=2, ServerProcesses=[ {LaunchPath=C:\game\Bin64.Release.Dedicated\MegaFrogRace_Server.exe,Parameters=-debug,ConcurrentExecutions=1}, {LaunchPath=C:\game\Bin64.Release.Dedicated\MegaFrogRace_Server.exe,ConcurrentExecutions=1}]
輸出:
{ "FleetAttributes": { "InstanceRoleArn": "arn:aws:iam::444455556666:role/GameLiftS3Access", "Status": "NEW", "InstanceType": "c4.large", "FleetArn": "arn:aws:gamelift:us-west-2:444455556666:fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "Description": "Hosts for v2 North America", "FleetType": "SPOT", "OperatingSystem": "WINDOWS_2012", "Name": "MegaFrogRace.NA.v2", "CreationTime": 1569309011.11, "MetricGroups": [ "default" ], "BuildId": "build-2222aaaa-33bb-44cc-55dd-6666eeee77ff", "ServerLaunchParameters": "abc", "ServerLaunchPath": "C:\\game\\Bin64.Release.Dedicated\\MegaFrogRace_Server.exe", "NewGameSessionProtectionPolicy": "FullProtection", "CertificateConfiguration": { "CertificateType": "GENERATED" } } }
範例 4:建立即時伺服器機群
下列
create-fleet
範例會使用已上傳至 Amazon 的即時組態指令碼來建立 Spot 執行個體機群 GameLift。所有即時伺服器都部署到 Linux 機器上。在此範例中,假設上傳的即時指令碼包含多個指令碼檔案,其Init()
函數位於指令碼檔案中,稱為MainScript.js
。如所示,此檔案在執行期組態中識別為啟動指令碼。aws gamelift create-fleet \ --name
MegaFrogRace.NA.realtime
\ --description 'Mega Frog Race Realtime fleet
' \ --script-idscript-1111aaaa-22bb-33cc-44dd-5555eeee66ff
\ --ec2-instance-typec4.large
\ --fleet-typeSPOT
\ --certificate-configuration 'CertificateType=GENERATED
' --runtime-configuration 'ServerProcesses=[{LaunchPath=/local/game/MainScript.js,Parameters=+map Winter444,ConcurrentExecutions=5}]
'輸出:
{ "FleetAttributes": { "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "Status": "NEW", "CreationTime": 1569310745.212, "InstanceType": "c4.large", "NewGameSessionProtectionPolicy": "NoProtection", "CertificateConfiguration": { "CertificateType": "GENERATED" }, "Name": "MegaFrogRace.NA.realtime", "ScriptId": "script-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "FleetArn": "arn:aws:gamelift:us-west-2:444455556666:fleet/fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "FleetType": "SPOT", "MetricGroups": [ "default" ], "Description": "Mega Frog Race Realtime fleet", "OperatingSystem": "AMAZON_LINUX" } }
-
如需API詳細資訊,請參閱 命令參考 CreateFleet
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 create-game-session-queue
。
- AWS CLI
-
Example1:設定排序遊戲工作階段佇列
下列
create-game-session-queue
範例會建立新的遊戲工作階段佇列,其中目的地位於兩個區域。它也會設定佇列,讓遊戲工作階段在等待 10 分鐘後請求逾時。由於未定義延遲政策,因此會 GameLift 嘗試放置列出第一個目的地的所有遊戲工作階段。aws gamelift create-game-session-queue \ --name
MegaFrogRaceServer-NA
\ --destinationsfile://destinations.json
\ --timeout-in-seconds600
destinations.json
的內容:{ "Destinations": [ {"DestinationArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }, {"DestinationArn": "arn:aws:gamelift:us-west-1::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222" } ] }
輸出:
{ "GameSessionQueues": [ { "Name": "MegaFrogRaceServer-NA", "GameSessionQueueArn": "arn:aws:gamelift:us-west-2:123456789012:gamesessionqueue/MegaFrogRaceServer-NA", "TimeoutInSeconds": 600, "Destinations": [ {"DestinationArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"}, {"DestinationArn": "arn:aws:gamelift:us-west-1::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"} ] } ] }
Example2:使用玩家延遲政策設定遊戲工作階段佇列
下列
create-game-session-queue
範例會建立新的遊戲工作階段佇列,其中包含兩個玩家延遲政策。第一個政策會設定 100ms 延遲上限,在遊戲工作階段放置嘗試的第一分鐘強制執行。第二個政策會將延遲上限提高到 200ms,直到置放請求在 3 分鐘逾時為止。aws gamelift create-game-session-queue \ --name
MegaFrogRaceServer-NA
\ --destinationsfile://destinations.json
\ --player-latency-policiesfile://latency-policies.json
\ --timeout-in-seconds180
destinations.json
的內容:{ "Destinations": [ { "DestinationArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }, { "DestinationArn": "arn:aws:gamelift:us-east-1::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222" } ] }
latency-policies.json
的內容:{ "PlayerLatencyPolicies": [ {"MaximumIndividualPlayerLatencyMilliseconds": 200}, {"MaximumIndividualPlayerLatencyMilliseconds": 100, "PolicyDurationSeconds": 60} ] }
輸出:
{ "GameSessionQueue": { "Name": "MegaFrogRaceServer-NA", "GameSessionQueueArn": "arn:aws:gamelift:us-west-2:111122223333:gamesessionqueue/MegaFrogRaceServer-NA", "TimeoutInSeconds": 600, "PlayerLatencyPolicies": [ { "MaximumIndividualPlayerLatencyMilliseconds": 100, "PolicyDurationSeconds": 60 }, { "MaximumIndividualPlayerLatencyMilliseconds": 200 } ] "Destinations": [ {"DestinationArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111"}, {"DestinationArn": "arn:aws:gamelift:us-east-1::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222"} ], } }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的建立佇列。
-
如需API詳細資訊,請參閱 命令參考 CreateGameSessionQueue
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-build
。
- AWS CLI
-
刪除自訂遊戲組建
下列
delete-build
範例會從 Amazon GameLift 帳戶移除建置。刪除建置之後,就無法使用它來建立新的機群。此操作無法復原。aws gamelift delete-build \ --build-id
build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
此命令不會產生輸出。
-
如需API詳細資訊,請參閱 命令參考 DeleteBuild
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-fleet
。
- AWS CLI
-
刪除不再使用的機群
下列
delete-fleet
範例會移除已縮減至零執行個體的機群。如果機群容量大於 0,則請求會失敗並出現 HTTP 400 錯誤。aws gamelift delete-fleet \ --fleet-id
fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
此命令不會產生輸出。
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的管理機群。 GameLift
-
如需API詳細資訊,請參閱 命令參考 DeleteFleet
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 delete-game-session-queue
。
- AWS CLI
-
若要刪除遊戲工作階段佇列
下列
delete-game-session-queue
範例會刪除指定的遊戲工作階段佇列。aws gamelift delete-game-session-queue \ --name
MegaFrogRace-NA
此命令不會產生輸出。
-
如需API詳細資訊,請參閱 命令參考 DeleteGameSessionQueue
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-build
。
- AWS CLI
-
取得自訂遊戲組建的相關資訊
下列
describe-build
範例會擷取遊戲伺服器建置資源的屬性。aws gamelift describe-build \ --build-id
build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
輸出:
{ "Build": { "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "CreationTime": 1496708916.18, "Name": "My_Game_Server_Build_One", "OperatingSystem": "AMAZON_LINUX", "SizeOnDisk": 1304924, "Status": "READY", "Version": "12345.678" } }
如需詳細資訊,請參閱 Amazon 開發人員指南 中的將自訂伺服器建置上傳至 GameLift 。 GameLift
-
如需API詳細資訊,請參閱 命令參考 DescribeBuild
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-ec2-instance-limits
。
- AWS CLI
-
擷取EC2執行個體類型的服務限制
下列
describe-ec2-instance-limits
範例顯示目前區域中指定執行個體類型使用的最大允許執行個體和目前EC2執行個體。結果指出只使用五個允許的二十個執行個體。aws gamelift describe-ec2-instance-limits \ --ec2-instance-type
m5.large
輸出:
{ "EC2InstanceLimits": [ { "EC2InstanceType": ""m5.large", "CurrentInstances": 5, "InstanceLimit": 20 } ] }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的選擇運算資源。
-
如需API詳細資訊,請參閱 AWS CLI 命令參考 中的 DescribeEc2InstanceLimits
。
-
下列程式碼範例示範如何使用 describe-fleet-attributes
。
- AWS CLI
-
Example1:檢視機群清單的屬性
下列
describe-fleet-attributes
範例會擷取兩個指定機群的機群屬性。如所示,請求的機群會部署為相同的建置,一個用於隨需執行個體,另一個用於 Spot 執行個體,具有一些細微的組態差異。aws gamelift describe-fleet-attributes \ --fleet-ids
arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222
輸出:
{ "FleetAttributes": [ { "FleetId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "FleetType": "ON_DEMAND", "InstanceType": "c4.large", "Description": "On-demand hosts for v2 North America", "Name": "MegaFrogRaceServer.NA.v2-od", "CreationTime": 1568836191.995, "Status": "ACTIVE", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "ServerLaunchPath": "C:\\game\\MegaFrogRace_Server.exe", "ServerLaunchParameters": "+gamelift_start_server", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "WINDOWS_2012", "MetricGroups": [ "default" ], "CertificateConfiguration": { "CertificateType": "DISABLED" } }, { "FleetId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "FleetType": "SPOT", "InstanceType": "c4.large", "Description": "On-demand hosts for v2 North America", "Name": "MegaFrogRaceServer.NA.v2-spot", "CreationTime": 1568838275.379, "Status": "ACTIVATING", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "ServerLaunchPath": "C:\\game\\MegaFrogRace_Server.exe", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "WINDOWS_2012", "MetricGroups": [ "default" ], "CertificateConfiguration": { "CertificateType": "GENERATED" } } ] }
Example2:請求所有機群的屬性
下列會
describe-fleet-attributes
傳回具有任何狀態的所有機群的機群屬性。此範例說明使用分頁參數一次傳回一個機群。aws gamelift describe-fleet-attributes \ --limit
1
輸出:
{ "FleetAttributes": [ { "FleetId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "FleetType": "SPOT", "InstanceType": "c4.large", "Description": "On-demand hosts for v2 North America", "Name": "MegaFrogRaceServer.NA.v2-spot", "CreationTime": 1568838275.379, "Status": "ACTIVATING", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "ServerLaunchPath": "C:\\game\\MegaFrogRace_Server.exe", "NewGameSessionProtectionPolicy": "NoProtection", "OperatingSystem": "WINDOWS_2012", "MetricGroups": [ "default" ], "CertificateConfiguration": { "CertificateType": "GENERATED" } } ], "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE2" }
輸出包含一個
NextToken
值,您可以在再次呼叫命令時使用。將 值傳遞至--next-token
參數,以指定在何處取得輸出。下列命令會傳回輸出中的第二個結果。aws gamelift describe-fleet-attributes \ --limit
1
\ --next-tokeneyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE1
重複此動作,直到回應不包含
NextToken
值為止。如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的設定 GameLift 機群。
-
如需API詳細資訊,請參閱 命令參考 DescribeFleetAttributes
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-fleet-capacity
。
- AWS CLI
-
檢視機群清單的容量狀態
下列
describe-fleet-capacity
範例會擷取兩個指定機群的目前容量。aws gamelift describe-fleet-capacity \ --fleet-ids
arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222
輸出:
{ "FleetCapacity": [ { "FleetId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "InstanceType": "c5.large", "InstanceCounts": { "DESIRED": 10, "MINIMUM": 1, "MAXIMUM": 20, "PENDING": 0, "ACTIVE": 10, "IDLE": 3, "TERMINATING": 0 } }, { "FleetId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "InstanceType": "c5.large", "InstanceCounts": { "DESIRED": 13, "MINIMUM": 1, "MAXIMUM": 20, "PENDING": 0, "ACTIVE": 15, "IDLE": 2, "TERMINATING": 2 } } ] }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的GameLift 機群指標。
-
如需API詳細資訊,請參閱 命令參考 DescribeFleetCapacity
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-fleet-events
。
- AWS CLI
-
請求指定時間範圍的事件
下列
describe-fleet-events
範例顯示指定時間範圍期間發生的所有機群相關事件的詳細資訊。aws gamelift describe-fleet-events \ --fleet-id
arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
\ --start-time1579647600
\ --end-time1579649400
\ --limit5
輸出:
{ "Events": [ { "EventId": "a37b6892-5d07-4d3b-8b47-80244ecf66b9", "ResourceId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "EventCode": "FLEET_STATE_ACTIVE", "Message": "Fleet fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 changed state to ACTIVE", "EventTime": 1579649342.191 }, { "EventId": "67da4ec9-92a3-4d95-886a-5d6772c24063", "ResourceId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "EventCode": "FLEET_STATE_ACTIVATING", "Message": "Fleet fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 changed state to ACTIVATING", "EventTime": 1579649321.427 }, { "EventId": "23813a46-a9e6-4a53-8847-f12e6a8381ac", "ResourceId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "EventCode": "FLEET_STATE_BUILDING", "Message": "Fleet fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 changed state to BUILDING", "EventTime": 1579649321.243 }, { "EventId": "3bf217d0-1d44-42f9-9202-433ed475d2e8", "ResourceId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "EventCode": "FLEET_STATE_VALIDATING", "Message": "Fleet fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 changed state to VALIDATING", "EventTime": 1579649197.449 }, { "EventId": "2ecd0130-5986-44eb-99a7-62df27741084", "ResourceId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "EventCode": "FLEET_VALIDATION_LAUNCH_PATH_NOT_FOUND", "Message": "Failed to find a valid path", "EventTime": 1569319075.839, "PreSignedLogUrl": "https://gamelift-event-logs-prod-us-west-2.s3.us-west-2.amazonaws.com/logs/fleet-83422059-8329-42a2-a4d6-c4444386a6f8/events/2ecd0130-5986-44eb-99a7-62df27741084/FLEET_VALIDATION_LAUNCH_PATH_NOT_FOUND.txt?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEB8aCXVzLXdlc3QtMiJHMEUCIHV5K%2FLPx8h310D%2FAvx0%2FZxsDy5XA3cJOwPdu3T0eBa%2FAiEA1yovokcZYy%2FV4CWW6l26aFyiSHO%2Bxz%2FBMAhEHYHMQNcqkQMImP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARAAGgw3NDEwNjE1OTIxNzEiDI8rsZtzLzlwEDQhXSrlAtl5Ae%2Fgo6FCIzqXPbXfBOnSvFYqeDlriZarEpKqKrUt8mXQv9iqHResqCph9AKo49lwgSYTT2QoSxnrD7%2FUgv%2BZm2pVuczvuKtUA0fcx6s0GxpjIAzdIE%2F5P%2FB7B9M%2BVZ%2F9KF82hbJi0HTE6Y7BjKsEgFCvk4UXILhfjtan9iQl8%2F21ZTurAcJbm7Y5tuLF9SWSK3%2BEa7VXOcCK4D4O1sMjmdRm0q0CKZ%2FIaXoHkNvg0RVTa0hIqdvpaDQlsSBNdqTXbjHTu6fETE9Y9Ky%2BiJK5KiUG%2F59GjCpDcvS1FqKeLUEmKT7wysGmvjMc2n%2Fr%2F9VxQfte7w9srXwlLAQuwhiXAAyI5ICMZ5JvzjzQwTqD4CHTVKUUDwL%2BRZzbuuqkJObZml02CkRGp%2B74RTAzLbWptVqZTIfzctiCTmWxb%2FmKyELRYsVLrwNJ%2BGJ7%2BCrN0RC%2FjlgfLYIZyeAqjPgAu5HjgX%2BM7jCo9M7wBTrnAXKOFQuf9dvA84SuwXOJFp17LYGjrHMKv0qC3GfbTMrZ6kzeNV9awKCpXB2Gnx9z2KvIlJdqirWVpvHVGwKCmJBCesDzjJHrae3neogI1uW%2F9C6%2B4jIZPME3jXmZcEHqqw5uvAVF7aeIavtUZU8pxpDIWT0YE4p3Kriy2AA7ziCRKtVfjV839InyLk8LUjsioWK2qlpg2HXKFLpAXw1QsQyxYmFMB9sGKOUlbL7Jdkk%2BYUq8%2FDTlLxqj1S%2FiO4TI0Wo7ilAo%2FKKWWF4guuNDexj8EOOynSp1yImB%2BZf2Fua3O44W4eEXAMPLE33333&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20170621T231808Z&X-Amz-SignedHeaders=host&X-Amz-Expires=900&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20170621%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" } ], "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE2" }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的偵錯機 GameLift 群問題。
-
如需API詳細資訊,請參閱 命令參考 DescribeFleetEvents
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-fleet-port-settings
。
- AWS CLI
-
檢視機群的傳入連線許可
下列
describe-fleet-port-settings
範例會擷取指定機群的連線設定。aws gamelift describe-fleet-port-settings \ --fleet-id
arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
輸出:
{ "InboundPermissions": [ { "FromPort": 33400, "ToPort": 33500, "IpRange": "0.0.0.0/0", "Protocol": "UDP" }, { "FromPort": 1900, "ToPort": 2000, "IpRange": "0.0.0.0/0", "Protocol": "TCP" } ] }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的設定 GameLift 機群。
-
如需API詳細資訊,請參閱 命令參考 DescribeFleetPortSettings
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-fleet-utilization
。
- AWS CLI
-
Example1:檢視機群清單的使用資料
下列
describe-fleet-utilization
範例會擷取指定機群的目前用量資訊。aws gamelift describe-fleet-utilization \ --fleet-ids
arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
輸出:
{ "FleetUtilization": [ { "FleetId": "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "ActiveServerProcessCount": 100, "ActiveGameSessionCount": 62, "CurrentPlayerSessionCount": 329, "MaximumPlayerSessionCount": 1000 } ] }
Example2:請求所有機群的使用資料
下列會
describe-fleet-utilization
傳回任何狀態的所有機群的機群用量資料。此範例使用分頁參數一次傳回兩個機群的資料。aws gamelift describe-fleet-utilization \ --limit
2
輸出:
{ "FleetUtilization": [ { "FleetId": "fleet-1111aaaa-22bb-33cc-44dd-5555eeee66ff", "ActiveServerProcessCount": 100, "ActiveGameSessionCount": 13, "CurrentPlayerSessionCount": 98, "MaximumPlayerSessionCount": 1000 }, { "FleetId": "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "ActiveServerProcessCount": 100, "ActiveGameSessionCount": 62, "CurrentPlayerSessionCount": 329, "MaximumPlayerSessionCount": 1000 } ], "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE2" }
再次呼叫 命令,將
NextToken
值作為引數傳遞至--next-token
參數,以查看接下來的兩個結果。aws gamelift describe-fleet-utilization \ --limit
2
\ --next-tokeneyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE2
重複此動作,直到回應不再包含輸出中的
NextToken
值為止。如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的GameLift 機群指標。
-
如需API詳細資訊,請參閱 命令參考 DescribeFleetUtilization
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-game-session-queues
。
- AWS CLI
-
檢視遊戲工作階段佇列
下列
describe-game-session-queues
範例會擷取兩個指定佇列的屬性。aws gamelift describe-game-session-queues \ --names
MegaFrogRace-NA
MegaFrogRace-EU
輸出:
{ "GameSessionQueues": [{ "Destinations": [{ "DestinationArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }, { "DestinationArn": "arn:aws:gamelift:us-west-2::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222" } ], "Name": "MegaFrogRace-NA", "TimeoutInSeconds": 600, "GameSessionQueueArn": "arn:aws:gamelift:us-west-2::gamesessionqueue/MegaFrogRace-NA", "PlayerLatencyPolicies": [{ "MaximumIndividualPlayerLatencyMilliseconds": 200 }, { "MaximumIndividualPlayerLatencyMilliseconds": 100, "PolicyDurationSeconds": 60 } ], "FilterConfiguration": { "AllowedLocations": ["us-west-2", "ap-south-1", "us-east-1"] }, "PriorityConfiguration": { "PriorityOrder": ["LOCATION", "FLEET_TYPE", "DESTINATION"], "LocationOrder": ["us-west-2", "ap-south-1", "us-east-1"] } }, { "Destinations": [{ "DestinationArn": "arn:aws:gamelift:eu-west-3::fleet/fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222" }], "Name": "MegaFrogRace-EU", "TimeoutInSeconds": 600, "GameSessionQueueArn": "arn:aws:gamelift:us-west-2::gamesessionqueue/MegaFrogRace-EU" } ] }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的使用多區域佇列。
-
如需API詳細資訊,請參閱 命令參考 DescribeGameSessionQueues
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 describe-runtime-configuration
。
- AWS CLI
-
請求機群的執行期組態
下列
describe-runtime-configuration
範例會擷取指定機群目前執行期組態的詳細資訊。aws gamelift describe-runtime-configuration \ --fleet-id
fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
輸出:
{ "RuntimeConfiguration": { "ServerProcesses": [ { "LaunchPath": "C:\game\Bin64.Release.Dedicated\MegaFrogRace_Server.exe", "Parameters": "+gamelift_start_server", "ConcurrentExecutions": 3 }, { "LaunchPath": "C:\game\Bin64.Release.Dedicated\MegaFrogRace_Server.exe", "Parameters": "+gamelift_start_server +debug", "ConcurrentExecutions": 1 } ], "MaxConcurrentGameSessionActivations": 2147483647, "GameSessionActivationTimeoutSeconds": 300 } }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的在機群上執行多個程序。
-
如需API詳細資訊,請參閱 命令參考 DescribeRuntimeConfiguration
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 list-builds
。
- AWS CLI
-
Example1:取得自訂遊戲組建的清單
下列
list-builds
範例會擷取目前區域中所有遊戲伺服器建置的屬性。範例請求說明如何使用分頁參數Limit
和NextToken
,以循序集擷取結果。第一個命令會擷取前兩個組建。由於有兩個以上的可用,因此回應包含NextToken
,表示有更多結果可用。aws gamelift list-builds \ --limit
2
輸出:
{ "Builds": [ { "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "CreationTime": 1495664528.723, "Name": "My_Game_Server_Build_One", "OperatingSystem": "WINDOWS_2012", "SizeOnDisk": 8567781, "Status": "READY", "Version": "12345.678" }, { "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "CreationTime": 1495528748.555, "Name": "My_Game_Server_Build_Two", "OperatingSystem": "AMAZON_LINUX_2", "SizeOnDisk": 8567781, "Status": "FAILED", "Version": "23456.789" } ], "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjJEXAMPLE=" }
然後,您可以使用 參數再次呼叫 命令,
--next-token
如下所示以查看接下來的兩個組建。aws gamelift list-builds \ --limit
2
--next-tokeneyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjJEXAMPLE=
重複此動作,直到回應不包含
NextToken
值為止。Example2:取得失敗狀態的自訂遊戲組建清單
下列
list-builds
範例會擷取目前狀態為 的目前區域中所有遊戲伺服器建置的屬性FAILED。aws gamelift list-builds \ --status
FAILED
輸出:
{ "Builds": [ { "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "CreationTime": 1495528748.555, "Name": "My_Game_Server_Build_Two", "OperatingSystem": "AMAZON_LINUX_2", "SizeOnDisk": 8567781, "Status": "FAILED", "Version": "23456.789" } ] }
-
如需API詳細資訊,請參閱 命令參考 ListBuilds
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 list-fleets
。
- AWS CLI
-
Example1:取得區域中所有機群的清單
下列
list-fleets
範例顯示目前區域中所有機群IDs的機群。此範例使用分頁參數IDs一次擷取兩個機群。回應包含next-token
屬性,這表示要擷取的結果更多。aws gamelift list-fleets \ --limit
2
輸出:
{ "FleetIds": [ "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222" ], "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjJEXAMPLE=" }
您可以在下一個命令中傳遞上一個回應
NextToken
的值,如此處所示,以取得下兩個結果。aws gamelift list-fleets \ --limit
2
\ --next-tokeneyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC00NDRlZjQxZS1hM2I1LTQ2NDYtODJmMy0zYzI4ZTgxNjVjEXAMPLE=
Example2:取得具有特定建置或指令碼之區域中所有機群的清單
下列
list-builds
範例會擷取使用指定遊戲建置部署IDs的機群的 。如果您使用即時伺服器,則可以提供指令碼 ID 取代建置 ID。由於此範例未指定限制參數,因此結果最多可包含 16 個機群 IDs。aws gamelift list-fleets \ --build-id
build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
輸出:
{ "FleetIds": [ "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE44444" ] }
-
如需API詳細資訊,請參閱 命令參考 ListFleets
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 request-upload-credentials
。
- AWS CLI
-
重新整理上傳建置的存取憑證
下列
create-build
範例會取得新的有效存取憑證,以將 GameLift 建置檔案上傳至 Amazon S3 位置。憑證的生命週期有限。您可以從對原始CreateBuild
請求的回應中取得建置 ID。aws gamelift request-upload-credentials \ --build-id
build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
輸出:
{ "StorageLocation": { "Bucket": "gamelift-builds-us-west-2", "Key": "123456789012/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111" }, "UploadCredentials": { "AccessKeyId": "AKIAIOSFODNN7EXAMPLE", "SecretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", "SessionToken": "AgoGb3JpZ2luENz...EXAMPLETOKEN==" } }
如需詳細資訊,請參閱 Amazon 開發人員指南 中的將自訂伺服器建置上傳至 GameLift 。 GameLift
-
如需API詳細資訊,請參閱 命令參考 RequestUploadCredentials
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 start-fleet-actions
。
- AWS CLI
-
若要重新啟動機群自動擴展活動
下列
start-fleet-actions
範例會繼續使用為指定機群定義,但被呼叫 ``stop-fleet-actions`` 所停止的所有擴展政策。開始之後,擴展政策會立即開始追蹤各自的指標。aws gamelift start-fleet-actions \ --fleet-id
fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
\ --actionsAUTO_SCALING
此命令不會產生輸出。
-
如需API詳細資訊,請參閱 命令參考 StartFleetActions
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 stop-fleet-actions
。
- AWS CLI
-
停止機群的自動擴展活動
下列
stop-fleet-actions
範例會停止使用為指定機群定義的所有擴展政策。政策暫停後,除非您手動調整,否則機群容量會保持在相同的作用中執行個體計數。aws gamelift start-fleet-actions \ --fleet-id
fleet-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
\ --actionsAUTO_SCALING
此命令不會產生輸出。
-
如需API詳細資訊,請參閱 命令參考 StopFleetActions
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 update-build
。
- AWS CLI
-
更新自訂遊戲建置
下列
update-build
範例會變更與指定建置資源相關聯的名稱和版本資訊。傳回的建置物件會驗證已成功進行變更。aws gamelift update-build \ --build-id
build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
\ --nameMegaFrogRaceServer.NA.east
\ --build-version12345.east
輸出:
{ "Build": { "BuildArn": "arn:aws:gamelift:us-west-2::build/build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "BuildId": "build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "CreationTime": 1496708916.18, "Name": "MegaFrogRaceServer.NA.east", "OperatingSystem": "AMAZON_LINUX_2", "SizeOnDisk": 1304924, "Status": "READY", "Version": "12345.east" } }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的更新您的建置檔案。
-
如需API詳細資訊,請參閱 命令參考 UpdateBuild
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 update-game-session-queue
。
- AWS CLI
-
更新遊戲工作階段佇列組態
下列
update-game-session-queue
範例會新增新的目的地,並更新現有遊戲工作階段佇列的播放器延遲政策。aws gamelift update-game-session-queue \ --name
MegaFrogRace-NA
\ --destinationsfile://destinations.json
\ --player-latency-policiesfile://latency-policies.json
destinations.json
的內容:{ "Destinations": [ {"DestinationArn": "arn:aws:gamelift:us-west-2::fleet/fleet-1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"}, {"DestinationArn": "arn:aws:gamelift:us-east-1::fleet/fleet-5c6d3c4d-5e6f-7a8b-9c0d-1e2f3a4b5a2b"}, {"DestinationArn": "arn:aws:gamelift:us-east-1::alias/alias-11aa22bb-3c4d-5e6f-000a-1111aaaa22bb"} ] }
latency-policies.json
的內容:{ "PlayerLatencyPolicies": [ {"MaximumIndividualPlayerLatencyMilliseconds": 200}, {"MaximumIndividualPlayerLatencyMilliseconds": 150, "PolicyDurationSeconds": 120}, {"MaximumIndividualPlayerLatencyMilliseconds": 100, "PolicyDurationSeconds": 120} ] }
輸出:
{ "GameSessionQueue": { "Destinations": [ {"DestinationArn": "arn:aws:gamelift:us-west-2::fleet/fleet-1a2b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d"}, {"DestinationArn": "arn:aws:gamelift:us-east-1::fleet/fleet-5c6d3c4d-5e6f-7a8b-9c0d-1e2f3a4b5a2b"}, {"DestinationArn": "arn:aws:gamelift:us-east-1::alias/alias-11aa22bb-3c4d-5e6f-000a-1111aaaa22bb"} ], "GameSessionQueueArn": "arn:aws:gamelift:us-west-2:111122223333:gamesessionqueue/MegaFrogRace-NA", "Name": "MegaFrogRace-NA", "TimeoutInSeconds": 600, "PlayerLatencyPolicies": [ {"MaximumIndividualPlayerLatencyMilliseconds": 200}, {"MaximumIndividualPlayerLatencyMilliseconds": 150, "PolicyDurationSeconds": 120}, {"MaximumIndividualPlayerLatencyMilliseconds": 100, "PolicyDurationSeconds": 120} ] } }
如需詳細資訊,請參閱 Amazon GameLift 開發人員指南 中的使用多區域佇列。
-
如需API詳細資訊,請參閱 命令參考 UpdateGameSessionQueue
中的 。 AWS CLI
-
下列程式碼範例示範如何使用 upload-build
。
- AWS CLI
-
Example1:上傳 Linux 遊戲伺服器建置
下列
upload-build
範例會將 Linux 遊戲伺服器建置檔案從檔案目錄上傳至 GameLift 服務,並建立建置資源。aws gamelift upload-build \ --name
MegaFrogRaceServer.NA
\ --build-version2.0.1
\ --build-root~/MegaFrogRace_Server/release-na
\ --operating-systemAMAZON_LINUX_2
--server-sdk-version4.0.2
輸出:
Uploading ~/MegaFrogRace_Server/release-na: 16.0 KiB / 74.6 KiB (21.45%) Uploading ~/MegaFrogRace_Server/release-na: 32.0 KiB / 74.6 KiB (42.89%) Uploading ~/MegaFrogRace_Server/release-na: 48.0 KiB / 74.6 KiB (64.34%) Uploading ~/MegaFrogRace_Server/release-na: 64.0 KiB / 74.6 KiB (85.79%) Uploading ~/MegaFrogRace_Server/release-na: 74.6 KiB / 74.6 KiB (100.00%) Successfully uploaded ~/MegaFrogRace_Server/release-na to AWS GameLift Build ID: build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
Example2:上傳 Windows 遊戲伺服器建置
下列
upload-build
範例會將 Windows Game Server 建置檔案從目錄上傳至 GameLift 服務,並建立建置記錄。aws gamelift upload-build \ --name
MegaFrogRaceServer.NA
\ --build-version2.0.1
\ --build-root C:\MegaFrogRace_Server\release-na \ --operating-systemWINDOWS_2012
--server-sdk-version4.0.2
輸出:
Uploading C:\MegaFrogRace_Server\release-na: 16.0 KiB / 74.6 KiB (21.45%) Uploading C:\MegaFrogRace_Server\release-na: 32.0 KiB / 74.6 KiB (42.89%) Uploading C:\MegaFrogRace_Server\release-na: 48.0 KiB / 74.6 KiB (64.34%) Uploading C:\MegaFrogRace_Server\release-na: 64.0 KiB / 74.6 KiB (85.79%) Uploading C:\MegaFrogRace_Server\release-na: 74.6 KiB / 74.6 KiB (100.00%) Successfully uploaded C:\MegaFrogRace_Server\release-na to AWS GameLift Build ID: build-a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
如需詳細資訊,請參閱 Amazon 開發人員指南 中的將自訂伺服器建置上傳至 GameLift 。 GameLift
-
如需API詳細資訊,請參閱 命令參考 UploadBuild
中的 。 AWS CLI
-