DescribeInstances
Retrieves information about a fleet's instances, including instance IDs, connection data, and status.
This operation can be used in the following ways:
-
To get information on all instances that are deployed to a fleet's home Region, provide the fleet ID.
-
To get information on all instances that are deployed to a fleet's remote location, provide the fleet ID and location name.
-
To get information on a specific instance in a fleet, provide the fleet ID and instance ID.
Use the pagination parameters to retrieve results as a set of sequential pages.
If successful, an Instance
object is returned for each requested
instance. Instances are not returned in any particular order.
Learn more
Remotely Access Fleet Instances
Related actions
Request Syntax
{
"FleetId": "string
",
"InstanceId": "string
",
"Limit": number
,
"Location": "string
",
"NextToken": "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.
- FleetId
-
A unique identifier for the fleet to retrieve instance information for. You can use either the fleet ID or ARN value.
Type: String
Pattern:
^fleet-\S+|^arn:.*:fleet\/fleet-\S+
Required: Yes
- InstanceId
-
A unique identifier for an instance to retrieve. Specify an instance ID or leave blank to retrieve all instances in the fleet.
Type: String
Pattern:
[a-zA-Z0-9\.-]+
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
- Location
-
The name of a location to retrieve instance information for, in the form of an Amazon Region code such as
us-west-2
.Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
^[A-Za-z0-9\-]+
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
Response Syntax
{
"Instances": [
{
"CreationTime": number,
"DnsName": "string",
"FleetArn": "string",
"FleetId": "string",
"InstanceId": "string",
"IpAddress": "string",
"Location": "string",
"OperatingSystem": "string",
"Status": "string",
"Type": "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.
- Instances
-
A collection of objects containing properties for each instance returned.
Type: Array of Instance objects
- 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
-
THe requested resources was not found. The resource was either not created yet or deleted.
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
Get instance data on a fleet's home Region
This example requests information on EC2 instances that are deployed in a
fleet that resides in the user's default Region, which is currently set to
us-west-2
. This fleet might also deploy instances to remote
locations, but this example only retrieves information on instances that are
deployed in the fleet's home Region.
Sample Request
{
"FleetId": "fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"Limit": "1"
}
Sample Response
{
"Instances": [
{
"FleetId": "fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"InstanceId": "i-11111111a222b333c,
"IpAddress": "192.0.2.0",
"DnsName": "ec2-192-0-2-0.us-west-2.compute.amazonaws.com",
"OperatingSystem": "WIN_2012",
"Type": "c4.large",
"Status": "Active",
"CreationTime": 1515032347.867,
"Location": "us-west-2
}
]
}
Get instance data on a fleet's remote location
This example requests information on EC2 instances that are deployed in a
fleet that with a remote location in the Amazon Region sa-east-1
.
(The fleet's home Region is us-west-2
which is the user's default
Region and so doesn't need to be explicitly named in the request.) This example
only retrieves information on instances that are deployed in the
sa-east-1
by the specified fleet.
Sample Request
{
"FleetId": "fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"Location": "sa-east-1",
"Limit": "2"
}
Sample Response
{
"Instances": [
{
"FleetId": "fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"FleetArn": "arn:aws:gamelift:us-west-2::fleet/fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"InstanceId": "i-11111111a222b333c,
"IpAddress": "192.0.2.0",
"DnsName": "ec2-192-0-2-0.us-west-2.compute.amazonaws.com",
"OperatingSystem": "WIN_2012",
"Type": "c4.large",
"Status": "Active",
"CreationTime": 1515032347.867,
"Location": "sa-east-1"
},
{
"FleetId": "fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"FleetArn": "arn:aws:gamelift:us-east-2::fleet/fleet-9999ffff-88ee-77dd-66cc-5555bbbb44aa",
"InstanceId": "i-12312311a222b444d,
"IpAddress": "192.0.2.0",
"DnsName": "ec2-192-0-2-0.us-west-2.compute.amazonaws.com",
"OperatingSystem": "WIN_2012",
"Type": "c4.large",
"Status": "Active",
"CreationTime": 1515032999.867,
"Location": "sa-east-1"
}
]
}
See Also
For more information about using this API in one of the language-specific Amazon SDKs, see the following: