Skip to content

register_game_server async

register_game_server(
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    game_server_group_name: Optional[GameServerGroupNameOrArn] = None,
    game_server_id: Optional[GameServerId] = None,
    instance_id: Optional[GameServerInstanceId] = None,
    connection_info: Optional[GameServerConnectionInfo] = None,
    game_server_data: Optional[GameServerData] = None,
) -> RegisterGameServerOutput

This API works with the following fleet types: EC2 (FleetIQ)

Creates a new game server resource and notifies Amazon GameLift Servers FleetIQ that the game server is ready to host gameplay and players. This operation is called by a game server process that is running on an instance in a game server group. Registering game servers enables Amazon GameLift Servers FleetIQ to track available game servers and enables game clients and services to claim a game server for a new game session.

To register a game server, identify the game server group and instance where the game server is running, and provide a unique identifier for the game server. You can also include connection and game server data.

Once a game server is successfully registered, it is put in status AVAILABLE. A request to register a game server may fail if the instance it is running on is in the process of shutting down as part of instance balancing or scale-down activity.

Learn more

Amazon GameLift Servers FleetIQ Guide

Parameters:

  • game_server_group_name (Optional[GameServerGroupNameOrArn], default: None ) –

    A unique identifier for the game server group where the game server is running.

  • game_server_id (Optional[GameServerId], default: None ) –

    A custom string that uniquely identifies the game server to register. Game server IDs are developer-defined and must be unique across all game server groups in your Amazon Web Services account.

  • instance_id (Optional[GameServerInstanceId], default: None ) –

    The unique identifier for the instance where the game server is running. This ID is available in the instance metadata. EC2 instance IDs use a 17-character format, for example: i-1234567890abcdef0.

  • connection_info (Optional[GameServerConnectionInfo], default: None ) –

    Information that is needed to make inbound client connections to the game server. This might include the IP address and port, DNS name, and other information.

  • game_server_data (Optional[GameServerData], default: None ) –

    A set of custom game server properties, formatted as a single string value. This data is passed to a game client or service when it requests information on game servers.

Raises:

  • 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.

  • InternalServiceException –

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

  • InvalidRequestException –

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

  • LimitExceededException –

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

  • UnauthorizedException –

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

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_gamelift/_services/async_game_lift.py
async def register_game_server(
    self,
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    game_server_group_name: Optional[
        "capo_gamelift.types.game_server_group_name_or_arn.GameServerGroupNameOrArn"
    ] = None,
    game_server_id: Optional[
        "capo_gamelift.types.game_server_id.GameServerId"
    ] = None,
    instance_id: Optional[
        "capo_gamelift.types.game_server_instance_id.GameServerInstanceId"
    ] = None,
    connection_info: Optional[
        "capo_gamelift.types.game_server_connection_info.GameServerConnectionInfo"
    ] = None,
    game_server_data: Optional[
        "capo_gamelift.types.game_server_data.GameServerData"
    ] = None,
) -> "capo_gamelift.types.register_game_server_output.RegisterGameServerOutput":
    """<p> <b>This API works with the following fleet types:</b> EC2 (FleetIQ)</p> <p>Creates a new game server resource and notifies Amazon GameLift Servers FleetIQ that the game server is ready to host gameplay and players. This operation is called by a game server process that is running on an instance in a game server group. Registering game servers enables Amazon GameLift Servers FleetIQ to track available game servers and enables game clients and services to claim a game server for a new game session. </p> <p>To register a game server, identify the game server group and instance where the game server is running, and provide a unique identifier for the game server. You can also include connection and game server data.</p> <p>Once a game server is successfully registered, it is put in status <code>AVAILABLE</code>. A request to register a game server may fail if the instance it is running on is in the process of shutting down as part of instance balancing or scale-down activity. </p> <p> <b>Learn more</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html">Amazon GameLift Servers FleetIQ Guide</a> </p>

    Args:
        game_server_group_name: <p>A unique identifier for the game server group where the game server is running.</p>
        game_server_id: <p>A custom string that uniquely identifies the game server to register. Game server IDs are developer-defined and must be unique across all game server groups in your Amazon Web Services account.</p>
        instance_id: <p>The unique identifier for the instance where the game server is running. This ID is available in the instance metadata. EC2 instance IDs use a 17-character format, for example: <code>i-1234567890abcdef0</code>.</p>
        connection_info: <p>Information that is needed to make inbound client connections to the game server. This might include the IP address and port, DNS name, and other information.</p>
        game_server_data: <p>A set of custom game server properties, formatted as a single string value. This data is passed to a game client or service when it requests information on game servers. </p>

    Raises:
        capo_gamelift.errors.conflict_exception.ConflictException: <p>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.</p> <p></p>
        capo_gamelift.errors.internal_service_exception.InternalServiceException: <p>The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.</p>
        capo_gamelift.errors.invalid_request_exception.InvalidRequestException: <p>One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.</p>
        capo_gamelift.errors.limit_exceeded_exception.LimitExceededException: <p>The requested operation would cause the resource to exceed the allowed service limit. Resolve the issue before retrying.</p>
        capo_gamelift.errors.unauthorized_exception.UnauthorizedException: <p>The client failed authentication. Clients should not retry such requests.</p>
        capo_gamelift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_gamelift.types.register_game_server_input.RegisterGameServerInput]",
    ) -> AsyncOperationResponse[
        "capo_gamelift.types.register_game_server_output.RegisterGameServerOutput"
    ]:
        import capo_gamelift._operations.game_lift.register_game_server

        (
            output,
            http_response,
        ) = await capo_gamelift._operations.game_lift.register_game_server.async_register_game_server(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_gamelift.types.register_game_server_input.RegisterGameServerInput",
    ) -> dict[str, Any]:
        import capo_gamelift.types.register_game_server_input

        return capo_gamelift.types.register_game_server_input.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_gamelift.types.register_game_server_output.RegisterGameServerOutput",
    ) -> dict[str, Any]:
        import capo_gamelift.types.register_game_server_output

        return capo_gamelift.types.register_game_server_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "RegisterGameServer",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_gamelift.types.register_game_server_input.RegisterGameServerInput = {}
    if game_server_group_name is not None:
        input_["game_server_group_name"] = game_server_group_name
    if game_server_id is not None:
        input_["game_server_id"] = game_server_id
    if instance_id is not None:
        input_["instance_id"] = instance_id
    if connection_info is not None:
        input_["connection_info"] = connection_info
    if game_server_data is not None:
        input_["game_server_data"] = game_server_data

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output