ListFleets - GameLift Service

ListFleets

Retrieves a collection of fleet resources in an AWS Region. You can call this operation to get fleets in a previously selected default Region (see https://docs.aws.amazon.com/credref/latest/refdocs/setting-global-region.htmlor specify a Region in your request. You can filter the result set to find only those fleets that are deployed with a specific build or script. For fleets that have multiple locations, this operation retrieves fleets based on their home Region only.

This operation can be used in the following ways:

  • To get a list of all fleets in a Region, don't provide a build or script identifier.

  • To get a list of all fleets where a specific custom game build is deployed, provide the build ID.

  • To get a list of all Realtime Servers fleets with a specific configuration script, provide the script ID.

Use the pagination parameters to retrieve results as a set of sequential pages.

If successful, a list of fleet IDs that match the request parameters is returned. A NextToken value is also returned if there are more result pages to retrieve.

Note

Fleet resources are not listed in a particular order.

Learn more

Setting up GameLift fleets

Related actions

CreateFleet | UpdateFleetCapacity | PutScalingPolicy | DescribeEC2InstanceLimits | DescribeFleetAttributes | DescribeFleetLocationAttributes | UpdateFleetAttributes | StopFleetActions | DeleteFleet | All APIs by task

Request Syntax

{ "BuildId": "string", "Limit": number, "NextToken": "string", "ScriptId": "string" }

Request Parameters

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

The request accepts the following data in JSON format.

Note

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

BuildId

A unique identifier for the build to request fleets for. Use this parameter to return only fleets using a specified build. Use either the build ID or ARN value.

Type: String

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

Required: No

Limit

The maximum number of results to return. Use this parameter with NextToken to get results as a set of sequential pages.

Type: Integer

Valid Range: Minimum value of 1.

Required: No

NextToken

A token that indicates the start of the next sequential page of results. Use the token that is returned with a previous call to this operation. To start at the beginning of the result set, do not specify a value.

Type: String

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

Required: No

ScriptId

A unique identifier for the Realtime script to request fleets for. Use this parameter to return only fleets using a specified script. Use either the script ID or ARN value.

Type: String

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

Required: No

Response Syntax

{ "FleetIds": [ "string" ], "NextToken": "string" }

Response Elements

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

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

FleetIds

A set of fleet IDs that match the list request. You can retrieve additional information about all returned fleets by passing this result set to a DescribeFleetAttributes, DescribeFleetCapacity, or DescribeFleetUtilization call.

Type: Array of strings

Array Members: Minimum number of 1 item.

Pattern: ^fleet-\S+

NextToken

A token that indicates where to resume retrieving results on the next call to this operation. If no token is returned, these results represent the end of the list.

Type: String

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

Errors

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

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

NotFoundException

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

HTTP Status Code: 400

UnauthorizedException

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

HTTP Status Code: 400

Examples

List all fleets in a Region

This example retrieves the fleet IDs of all fleets with their home Region in the currently selected Region. It uses the pagination parameters to retrieve two fleet IDs at a time. The example response includes a NextToken, which indicates that there are still more results to retrieve.

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

Sample Request

{ "Limit": 2, "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE1" }

Sample Response

{ "FleetIds": [ "fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa", "fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa" ], "NextToken": "eyJhd3NBY2NvdW50SWQiOnsicyI6IjMwMjc3NjAxNjM5OCJ9LCJidWlsZElkIjp7InMiOiJidWlsZC01NWYxZTZmMS1jY2FlLTQ3YTctOWI5ZS1iYjFkYTQwMjEXAMPLE2" }

List all fleets in a Region with a specific build or script

This example retrieves the IDs of fleets in the currently selected Region that are deployed with a specified game build. If you're working with Realtime Servers, you can opt to provide a script ID in place of a build ID. This example does not specify the limit parameter, so results can include up to 16 fleet IDs.

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

Sample Request

{ "Build": "build-1111aaaa-22bb-33cc-44dd-5555eeee66ff" }

Sample Response

{ "FleetIds": ["fleet-2222bbbb-33cc-44dd-55ee-6666ffff77aa"] }

See Also

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