Skip to content

update_game_server_group

update_game_server_group(
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    game_server_group_name: Optional[GameServerGroupNameOrArn] = None,
    role_arn: Optional[IamRoleArn] = None,
    instance_definitions: Optional[InstanceDefinitions] = None,
    game_server_protection_policy: Optional[GameServerProtectionPolicy] = None,
    balancing_strategy: Optional[BalancingStrategy] = None,
) -> UpdateGameServerGroupOutput

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

Updates Amazon GameLift Servers FleetIQ-specific properties for a game server group. Many Auto Scaling group properties are updated on the Auto Scaling group directly, including the launch template, Auto Scaling policies, and maximum/minimum/desired instance counts.

To update the game server group, specify the game server group ID and provide the updated values. Before applying the updates, the new values are validated to ensure that Amazon GameLift Servers FleetIQ can continue to perform instance balancing activity. If successful, a GameServerGroup object is returned.

Target tracking Auto Scaling policies on the Auto Scaling group cannot be updated through the Amazon Web Services Management Console. Instead, use the Amazon Elastic Compute Cloud Auto Scaling PutScalingPolicy API action to update these policies.

Learn more

Amazon GameLift Servers FleetIQ Guide

Parameters:

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

    A unique identifier for the game server group. Use either the name or ARN value.

  • role_arn (Optional[IamRoleArn], default: None ) –

    The Amazon Resource Name (ARN) for an IAM role that allows Amazon GameLift Servers to access your Amazon EC2 Auto Scaling groups.

  • instance_definitions (Optional[InstanceDefinitions], default: None ) –

    An updated list of Amazon EC2 instance types to use in the Auto Scaling group. The instance definitions must specify at least two different instance types that are supported by Amazon GameLift Servers FleetIQ. This updated list replaces the entire current list of instance definitions for the game server group. For more information on instance types, see EC2 Instance Types in the Amazon EC2 User Guide. You can optionally specify capacity weighting for each instance type. If no weight value is specified for an instance type, it is set to the default value "1". For more information about capacity weighting, see Instance Weighting for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.

  • game_server_protection_policy (Optional[GameServerProtectionPolicy], default: None ) –

    A flag that indicates whether instances in the game server group are protected from early termination. Unprotected instances that have active game servers running might be terminated during a scale-down event, causing players to be dropped from the game. Protected instances cannot be terminated while there are active game servers running except in the event of a forced game server group deletion. An exception to this is with Spot Instances, which can be terminated by Amazon Web Services regardless of protection status. This property is set to NO_PROTECTION by default.

  • balancing_strategy (Optional[BalancingStrategy], default: None ) –

    Indicates how Amazon GameLift Servers FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group. Method options include the following:

    • SPOT_ONLY - Only Spot Instances are used in the game server group. If Spot Instances are unavailable or not viable for game hosting, the game server group provides no hosting capacity until Spot Instances can again be used. Until then, no new instances are started, and the existing nonviable Spot Instances are terminated (after current gameplay ends) and are not replaced.

    • SPOT_PREFERRED - (default value) Spot Instances are used whenever available in the game server group. If Spot Instances are unavailable, the game server group continues to provide hosting capacity by falling back to On-Demand Instances. Existing nonviable Spot Instances are terminated (after current gameplay ends) and are replaced with new On-Demand Instances.

    • ON_DEMAND_ONLY - Only On-Demand Instances are used in the game server group. No Spot Instances are used, even when available, while this balancing strategy is in force.

Raises:

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

  • NotFoundException –

    The requested resource was not found. The resource was either not created yet or deleted.

  • 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/game_lift.py
def update_game_server_group(
    self,
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    game_server_group_name: Optional[
        "capo_gamelift.types.game_server_group_name_or_arn.GameServerGroupNameOrArn"
    ] = None,
    role_arn: Optional["capo_gamelift.types.iam_role_arn.IamRoleArn"] = None,
    instance_definitions: Optional[
        "capo_gamelift.types.instance_definitions.InstanceDefinitions"
    ] = None,
    game_server_protection_policy: Optional[
        "capo_gamelift.types.game_server_protection_policy.GameServerProtectionPolicy"
    ] = None,
    balancing_strategy: Optional[
        "capo_gamelift.types.balancing_strategy.BalancingStrategy"
    ] = None,
) -> "capo_gamelift.types.update_game_server_group_output.UpdateGameServerGroupOutput":
    """<p> <b>This API works with the following fleet types:</b> EC2 (FleetIQ)</p> <p>Updates Amazon GameLift Servers FleetIQ-specific properties for a game server group. Many Auto Scaling group properties are updated on the Auto Scaling group directly, including the launch template, Auto Scaling policies, and maximum/minimum/desired instance counts.</p> <p>To update the game server group, specify the game server group ID and provide the updated values. Before applying the updates, the new values are validated to ensure that Amazon GameLift Servers FleetIQ can continue to perform instance balancing activity. If successful, a <code>GameServerGroup</code> object is returned.</p> <note> <p>Target tracking Auto Scaling policies on the Auto Scaling group cannot be updated through the Amazon Web Services Management Console. Instead, use the Amazon Elastic Compute Cloud Auto Scaling <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_PutScalingPolicy.html"> <code>PutScalingPolicy</code> </a> API action to update these policies.</p> </note> <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. Use either the name or ARN value.</p>
        role_arn: <p>The Amazon Resource Name (<a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html">ARN</a>) for an IAM role that allows Amazon GameLift Servers to access your Amazon EC2 Auto Scaling groups.</p>
        instance_definitions: <p>An updated list of Amazon EC2 instance types to use in the Auto Scaling group. The instance definitions must specify at least two different instance types that are supported by Amazon GameLift Servers FleetIQ. This updated list replaces the entire current list of instance definitions for the game server group. For more information on instance types, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html">EC2 Instance Types</a> in the <i>Amazon EC2 User Guide</i>. You can optionally specify capacity weighting for each instance type. If no weight value is specified for an instance type, it is set to the default value "1". For more information about capacity weighting, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-weighting.html"> Instance Weighting for Amazon EC2 Auto Scaling</a> in the Amazon EC2 Auto Scaling User Guide.</p>
        game_server_protection_policy: <p>A flag that indicates whether instances in the game server group are protected from early termination. Unprotected instances that have active game servers running might be terminated during a scale-down event, causing players to be dropped from the game. Protected instances cannot be terminated while there are active game servers running except in the event of a forced game server group deletion. An exception to this is with Spot Instances, which can be terminated by Amazon Web Services regardless of protection status. This property is set to <code>NO_PROTECTION</code> by default.</p>
        balancing_strategy: <p>Indicates how Amazon GameLift Servers FleetIQ balances the use of Spot Instances and On-Demand Instances in the game server group. Method options include the following:</p> <ul> <li> <p> <code>SPOT_ONLY</code> - Only Spot Instances are used in the game server group. If Spot Instances are unavailable or not viable for game hosting, the game server group provides no hosting capacity until Spot Instances can again be used. Until then, no new instances are started, and the existing nonviable Spot Instances are terminated (after current gameplay ends) and are not replaced.</p> </li> <li> <p> <code>SPOT_PREFERRED</code> - (default value) Spot Instances are used whenever available in the game server group. If Spot Instances are unavailable, the game server group continues to provide hosting capacity by falling back to On-Demand Instances. Existing nonviable Spot Instances are terminated (after current gameplay ends) and are replaced with new On-Demand Instances.</p> </li> <li> <p> <code>ON_DEMAND_ONLY</code> - Only On-Demand Instances are used in the game server group. No Spot Instances are used, even when available, while this balancing strategy is in force.</p> </li> </ul>

    Raises:
        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.not_found_exception.NotFoundException: <p>The requested resource was not found. The resource was either not created yet or deleted.</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.
    """

    def _handler(
        req: "OperationRequest[capo_gamelift.types.update_game_server_group_input.UpdateGameServerGroupInput]",
    ) -> OperationResponse[
        "capo_gamelift.types.update_game_server_group_output.UpdateGameServerGroupOutput"
    ]:
        import capo_gamelift._operations.game_lift.update_game_server_group

        output, http_response = (
            capo_gamelift._operations.game_lift.update_game_server_group.update_game_server_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateGameServerGroup")
    )
    input_: capo_gamelift.types.update_game_server_group_input.UpdateGameServerGroupInput = {}
    if game_server_group_name is not None:
        input_["game_server_group_name"] = game_server_group_name
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if instance_definitions is not None:
        input_["instance_definitions"] = instance_definitions
    if game_server_protection_policy is not None:
        input_["game_server_protection_policy"] = game_server_protection_policy
    if balancing_strategy is not None:
        input_["balancing_strategy"] = balancing_strategy

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output