getInstanceAccess method
Requests remote access to a fleet instance. Remote access is useful for debugging, gathering benchmarking data, or observing activity in real time.
To remotely access an instance, you need credentials that match the
operating system of the instance. For a Windows instance, Amazon GameLift
returns a user name and password as strings for use with a Windows Remote
Desktop client. For a Linux instance, Amazon GameLift returns a user name
and RSA private key, also as strings, for use with an SSH client. The
private key must be saved in the proper format to a .pem
file
before using. If you're making this request using the AWS CLI, saving the
secret can be handled as part of the GetInstanceAccess request, as shown
in one of the examples for this operation.
To request access to a specific instance, specify the IDs of both the instance and the fleet it belongs to. You can retrieve a fleet's instance IDs by calling DescribeInstances. If successful, an InstanceAccess object is returned that contains the instance's IP address and a set of credentials.
Learn more
Remotely Access Fleet Instances
Related operations
May throw UnauthorizedException. May throw InvalidRequestException. May throw NotFoundException. May throw InternalServiceException.
Parameter fleetId
:
A unique identifier for a fleet that contains the instance you want access
to. You can use either the fleet ID or ARN value. The fleet can be in any
of the following statuses: ACTIVATING
, ACTIVE
,
or ERROR
. Fleets with an ERROR
status may be
accessible for a short time before they are deleted.
Parameter instanceId
:
A unique identifier for an instance you want to get access to. You can
access an instance in any status.
Implementation
Future<GetInstanceAccessOutput> getInstanceAccess({
required String fleetId,
required String instanceId,
}) async {
ArgumentError.checkNotNull(fleetId, 'fleetId');
ArgumentError.checkNotNull(instanceId, 'instanceId');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'GameLift.GetInstanceAccess'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'FleetId': fleetId,
'InstanceId': instanceId,
},
);
return GetInstanceAccessOutput.fromJson(jsonResponse.body);
}