Skip to content

update_container_fleet async

update_container_fleet(
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    fleet_id: Optional[FleetIdOrArn] = None,
    game_server_container_group_definition_name: Optional[
        ContainerGroupDefinitionNameOrArn
    ] = None,
    per_instance_container_group_definition_name: Optional[
        ContainerGroupDefinitionNameOrArn
    ] = None,
    game_server_container_groups_per_instance: Optional[
        GameServerContainerGroupsPerInstance
    ] = None,
    instance_connection_port_range: Optional[ConnectionPortRange] = None,
    instance_inbound_permission_authorizations: Optional[IpPermissionsList] = None,
    instance_inbound_permission_revocations: Optional[IpPermissionsList] = None,
    deployment_configuration: Optional[DeploymentConfiguration] = None,
    description: Optional[NonZeroAndMaxString] = None,
    metric_groups: Optional[MetricGroupList] = None,
    new_game_session_protection_policy: Optional[ProtectionPolicy] = None,
    game_session_creation_limit_policy: Optional[GameSessionCreationLimitPolicy] = None,
    log_configuration: Optional[LogConfiguration] = None,
    remove_attributes: Optional[ContainerFleetRemoveAttributeList] = None,
) -> UpdateContainerFleetOutput

This API works with the following fleet types: Container

Updates the properties of a managed container fleet. Depending on the properties being updated, this operation might initiate a fleet deployment. You can track deployments for a fleet using https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribeFleetDeployment.html.

A managed fleet's runtime environment, which depends on the fleet's Amazon Machine Image (AMI) version, can't be updated. You must create a new fleet. As a best practice, we recommend replacing your managed fleets every 30 days to maintain a secure and up-to-date runtime environment for your hosted game servers. For guidance, see Security best practices for Amazon GameLift Servers.

Request options

As with CreateContainerFleet, many fleet properties use common defaults or are calculated based on the fleet's container group definitions.

  • Update fleet properties that result in a fleet deployment. Include only those properties that you want to change. Specify deployment configuration settings.

  • Update fleet properties that don't result in a fleet deployment. Include only those properties that you want to change.

Changes to the following properties initiate a fleet deployment:

  • GameServerContainerGroupDefinition

  • PerInstanceContainerGroupDefinition

  • GameServerContainerGroupsPerInstance

  • InstanceInboundPermissions

  • InstanceConnectionPortRange

  • LogConfiguration

Results

If successful, this operation updates the container fleet resource, and might initiate a new deployment of fleet resources using the deployment configuration provided. A deployment replaces existing fleet instances with new instances that are deployed with the updated fleet properties. The fleet is placed in UPDATING status until the deployment is complete, then returns to ACTIVE.

You can have only one update deployment active at a time for a fleet. If a second update request initiates a deployment while another deployment is in progress, the first deployment is cancelled.

Parameters:

  • fleet_id (Optional[FleetIdOrArn], default: None ) –

    A unique identifier for the container fleet to update. You can use either the fleet ID or ARN value.

  • game_server_container_group_definition_name (Optional[ContainerGroupDefinitionNameOrArn], default: None ) –

    The name or ARN value of a new game server container group definition to deploy on the fleet. If you're updating the fleet to a specific version of a container group definition, use the ARN value and include the version number. If you're updating the fleet to the latest version of a container group definition, you can use the name value. You can't remove a fleet's game server container group definition, you can only update or replace it with another definition.

    Update a container group definition by calling UpdateContainerGroupDefinition. This operation creates a ContainerGroupDefinition resource with an incremented version.

  • per_instance_container_group_definition_name (Optional[ContainerGroupDefinitionNameOrArn], default: None ) –

    The name or ARN value of a new per-instance container group definition to deploy on the fleet. If you're updating the fleet to a specific version of a container group definition, use the ARN value and include the version number. If you're updating the fleet to the latest version of a container group definition, you can use the name value.

    Update a container group definition by calling UpdateContainerGroupDefinition. This operation creates a ContainerGroupDefinition resource with an incremented version.

    To remove a fleet's per-instance container group definition, leave this parameter empty and use the parameter RemoveAttributes.

  • game_server_container_groups_per_instance (Optional[GameServerContainerGroupsPerInstance], default: None ) –

    The number of times to replicate the game server container group on each fleet instance. By default, Amazon GameLift Servers calculates the maximum number of game server container groups that can fit on each instance. You can remove this property value to use the calculated value, or set it manually. If you set this number manually, Amazon GameLift Servers uses your value as long as it's less than the calculated maximum.

  • instance_connection_port_range (Optional[ConnectionPortRange], default: None ) –

    A revised set of port numbers to open on each fleet instance. By default, Amazon GameLift Servers calculates an optimal port range based on your fleet configuration. If you previously set this parameter manually, you can't reset this to use the calculated settings.

    The port range must not overlap with the Amazon GameLift Servers reserved port range 4092-4191. This range is reserved for internal Amazon GameLift Servers services.

  • instance_inbound_permission_authorizations (Optional[IpPermissionsList], default: None ) –

    A set of ports to add to the container fleet's inbound permissions.

    The port range must not overlap with the Amazon GameLift Servers reserved port range 4092-4191. This range is reserved for internal Amazon GameLift Servers services.

  • instance_inbound_permission_revocations (Optional[IpPermissionsList], default: None ) –

    A set of ports to remove from the container fleet's inbound permissions.

  • deployment_configuration (Optional[DeploymentConfiguration], default: None ) –

    Instructions for how to deploy updates to a container fleet, if the fleet update initiates a deployment. The deployment configuration lets you determine how to replace fleet instances and what actions to take if the deployment fails.

  • description (Optional[NonZeroAndMaxString], default: None ) –

    A meaningful description of the container fleet.

  • metric_groups (Optional[MetricGroupList], default: None ) –

    The name of an Amazon Web Services CloudWatch metric group to add this fleet to.

  • new_game_session_protection_policy (Optional[ProtectionPolicy], default: None ) –

    The game session protection policy to apply to all new game sessions that are started in this fleet. Game sessions that already exist are not affected.

  • game_session_creation_limit_policy (Optional[GameSessionCreationLimitPolicy], default: None ) –

    A policy that limits the number of game sessions that each individual player can create on instances in this fleet. The limit applies for a specified span of time.

  • log_configuration (Optional[LogConfiguration], default: None ) –

    The method for collecting container logs for the fleet.

  • remove_attributes (Optional[ContainerFleetRemoveAttributeList], default: None ) –

    If set, this update removes a fleet's per-instance container group definition. You can't remove a fleet's game server container group definition.

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.

  • LimitExceededException –

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

  • NotFoundException –

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

  • NotReadyException –

    The operation failed because Amazon GameLift Servers has not yet finished validating this compute. We recommend attempting 8 to 10 retries over 3 to 5 minutes with exponential backoffs and jitter.

  • UnauthorizedException –

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

  • UnsupportedRegionException –

    The requested operation is not supported in the Region specified.

  • 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 update_container_fleet(
    self,
    *,
    config_overrides: Optional[AsyncGameLiftClientConfig] = None,
    fleet_id: Optional["capo_gamelift.types.fleet_id_or_arn.FleetIdOrArn"] = None,
    game_server_container_group_definition_name: Optional[
        "capo_gamelift.types.container_group_definition_name_or_arn.ContainerGroupDefinitionNameOrArn"
    ] = None,
    per_instance_container_group_definition_name: Optional[
        "capo_gamelift.types.container_group_definition_name_or_arn.ContainerGroupDefinitionNameOrArn"
    ] = None,
    game_server_container_groups_per_instance: Optional[
        "capo_gamelift.types.game_server_container_groups_per_instance.GameServerContainerGroupsPerInstance"
    ] = None,
    instance_connection_port_range: Optional[
        "capo_gamelift.types.connection_port_range.ConnectionPortRange"
    ] = None,
    instance_inbound_permission_authorizations: Optional[
        "capo_gamelift.types.ip_permissions_list.IpPermissionsList"
    ] = None,
    instance_inbound_permission_revocations: Optional[
        "capo_gamelift.types.ip_permissions_list.IpPermissionsList"
    ] = None,
    deployment_configuration: Optional[
        "capo_gamelift.types.deployment_configuration.DeploymentConfiguration"
    ] = None,
    description: Optional[
        "capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
    ] = None,
    metric_groups: Optional[
        "capo_gamelift.types.metric_group_list.MetricGroupList"
    ] = None,
    new_game_session_protection_policy: Optional[
        "capo_gamelift.types.protection_policy.ProtectionPolicy"
    ] = None,
    game_session_creation_limit_policy: Optional[
        "capo_gamelift.types.game_session_creation_limit_policy.GameSessionCreationLimitPolicy"
    ] = None,
    log_configuration: Optional[
        "capo_gamelift.types.log_configuration.LogConfiguration"
    ] = None,
    remove_attributes: Optional[
        "capo_gamelift.types.container_fleet_remove_attribute_list.ContainerFleetRemoveAttributeList"
    ] = None,
) -> "capo_gamelift.types.update_container_fleet_output.UpdateContainerFleetOutput":
    """<p> <b>This API works with the following fleet types:</b> Container</p> <p>Updates the properties of a managed container fleet. Depending on the properties being updated, this operation might initiate a fleet deployment. You can track deployments for a fleet using <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribeFleetDeployment.html">https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribeFleetDeployment.html</a>.</p> <note> <p>A managed fleet's runtime environment, which depends on the fleet's Amazon Machine Image (AMI) version, can't be updated. You must create a new fleet. As a best practice, we recommend replacing your managed fleets every 30 days to maintain a secure and up-to-date runtime environment for your hosted game servers. For guidance, see <a href="https://docs.aws.amazon.com/gameliftservers/latest/developerguide/security-best-practices.html"> Security best practices for Amazon GameLift Servers</a>.</p> </note> <p> <b>Request options</b> </p> <p>As with CreateContainerFleet, many fleet properties use common defaults or are calculated based on the fleet's container group definitions. </p> <ul> <li> <p>Update fleet properties that result in a fleet deployment. Include only those properties that you want to change. Specify deployment configuration settings.</p> </li> <li> <p>Update fleet properties that don't result in a fleet deployment. Include only those properties that you want to change.</p> </li> </ul> <p>Changes to the following properties initiate a fleet deployment: </p> <ul> <li> <p> <code>GameServerContainerGroupDefinition</code> </p> </li> <li> <p> <code>PerInstanceContainerGroupDefinition</code> </p> </li> <li> <p> <code>GameServerContainerGroupsPerInstance</code> </p> </li> <li> <p> <code>InstanceInboundPermissions</code> </p> </li> <li> <p> <code>InstanceConnectionPortRange</code> </p> </li> <li> <p> <code>LogConfiguration</code> </p> </li> </ul> <p> <b>Results</b> </p> <p>If successful, this operation updates the container fleet resource, and might initiate a new deployment of fleet resources using the deployment configuration provided. A deployment replaces existing fleet instances with new instances that are deployed with the updated fleet properties. The fleet is placed in <code>UPDATING</code> status until the deployment is complete, then returns to <code>ACTIVE</code>. </p> <p>You can have only one update deployment active at a time for a fleet. If a second update request initiates a deployment while another deployment is in progress, the first deployment is cancelled.</p>

    Args:
        fleet_id: <p>A unique identifier for the container fleet to update. You can use either the fleet ID or ARN value.</p>
        game_server_container_group_definition_name: <p>The name or ARN value of a new game server container group definition to deploy on the fleet. If you're updating the fleet to a specific version of a container group definition, use the ARN value and include the version number. If you're updating the fleet to the latest version of a container group definition, you can use the name value. You can't remove a fleet's game server container group definition, you can only update or replace it with another definition.</p> <p>Update a container group definition by calling <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_UpdateContainerGroupDefinition.html">UpdateContainerGroupDefinition</a>. This operation creates a <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_ContainerGroupDefinition.html">ContainerGroupDefinition</a> resource with an incremented version. </p>
        per_instance_container_group_definition_name: <p>The name or ARN value of a new per-instance container group definition to deploy on the fleet. If you're updating the fleet to a specific version of a container group definition, use the ARN value and include the version number. If you're updating the fleet to the latest version of a container group definition, you can use the name value.</p> <p>Update a container group definition by calling <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_UpdateContainerGroupDefinition.html">UpdateContainerGroupDefinition</a>. This operation creates a <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_ContainerGroupDefinition.html">ContainerGroupDefinition</a> resource with an incremented version. </p> <p>To remove a fleet's per-instance container group definition, leave this parameter empty and use the parameter <code>RemoveAttributes</code>.</p>
        game_server_container_groups_per_instance: <p>The number of times to replicate the game server container group on each fleet instance. By default, Amazon GameLift Servers calculates the maximum number of game server container groups that can fit on each instance. You can remove this property value to use the calculated value, or set it manually. If you set this number manually, Amazon GameLift Servers uses your value as long as it's less than the calculated maximum.</p>
        instance_connection_port_range: <p>A revised set of port numbers to open on each fleet instance. By default, Amazon GameLift Servers calculates an optimal port range based on your fleet configuration. If you previously set this parameter manually, you can't reset this to use the calculated settings.</p> <p>The port range must not overlap with the Amazon GameLift Servers reserved port range <code>4092-4191</code>. This range is reserved for internal Amazon GameLift Servers services.</p>
        instance_inbound_permission_authorizations: <p>A set of ports to add to the container fleet's inbound permissions.</p> <p>The port range must not overlap with the Amazon GameLift Servers reserved port range <code>4092-4191</code>. This range is reserved for internal Amazon GameLift Servers services.</p>
        instance_inbound_permission_revocations: <p>A set of ports to remove from the container fleet's inbound permissions.</p>
        deployment_configuration: <p>Instructions for how to deploy updates to a container fleet, if the fleet update initiates a deployment. The deployment configuration lets you determine how to replace fleet instances and what actions to take if the deployment fails.</p>
        description: <p>A meaningful description of the container fleet.</p>
        metric_groups: <p>The name of an Amazon Web Services CloudWatch metric group to add this fleet to. </p>
        new_game_session_protection_policy: <p>The game session protection policy to apply to all new game sessions that are started in this fleet. Game sessions that already exist are not affected. </p>
        game_session_creation_limit_policy: <p>A policy that limits the number of game sessions that each individual player can create on instances in this fleet. The limit applies for a specified span of time.</p>
        log_configuration: <p>The method for collecting container logs for the fleet. </p>
        remove_attributes: <p>If set, this update removes a fleet's per-instance container group definition. You can't remove a fleet's game server container group definition.</p>

    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.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.not_found_exception.NotFoundException: <p>The requested resource was not found. The resource was either not created yet or deleted.</p>
        capo_gamelift.errors.not_ready_exception.NotReadyException: <p> The operation failed because Amazon GameLift Servers has not yet finished validating this compute. We recommend attempting 8 to 10 retries over 3 to 5 minutes with <a href="http://aws.amazon.com/blogs/https:/aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/">exponential backoffs and jitter</a>. </p>
        capo_gamelift.errors.unauthorized_exception.UnauthorizedException: <p>The client failed authentication. Clients should not retry such requests.</p>
        capo_gamelift.errors.unsupported_region_exception.UnsupportedRegionException: <p>The requested operation is not supported in the Region specified.</p>
        capo_gamelift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_gamelift.types.update_container_fleet_input.UpdateContainerFleetInput]",
    ) -> AsyncOperationResponse[
        "capo_gamelift.types.update_container_fleet_output.UpdateContainerFleetOutput"
    ]:
        import capo_gamelift._operations.game_lift.update_container_fleet

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

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

        return capo_gamelift.types.update_container_fleet_input.redact_sensitive(
            input_
        )

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

        return capo_gamelift.types.update_container_fleet_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateContainerFleet",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_gamelift.types.update_container_fleet_input.UpdateContainerFleetInput = {}
    if fleet_id is not None:
        input_["fleet_id"] = fleet_id
    if game_server_container_group_definition_name is not None:
        input_["game_server_container_group_definition_name"] = (
            game_server_container_group_definition_name
        )
    if per_instance_container_group_definition_name is not None:
        input_["per_instance_container_group_definition_name"] = (
            per_instance_container_group_definition_name
        )
    if game_server_container_groups_per_instance is not None:
        input_["game_server_container_groups_per_instance"] = (
            game_server_container_groups_per_instance
        )
    if instance_connection_port_range is not None:
        input_["instance_connection_port_range"] = instance_connection_port_range
    if instance_inbound_permission_authorizations is not None:
        input_["instance_inbound_permission_authorizations"] = (
            instance_inbound_permission_authorizations
        )
    if instance_inbound_permission_revocations is not None:
        input_["instance_inbound_permission_revocations"] = (
            instance_inbound_permission_revocations
        )
    if deployment_configuration is not None:
        input_["deployment_configuration"] = deployment_configuration
    if description is not None:
        input_["description"] = description
    if metric_groups is not None:
        input_["metric_groups"] = metric_groups
    if new_game_session_protection_policy is not None:
        input_["new_game_session_protection_policy"] = (
            new_game_session_protection_policy
        )
    if game_session_creation_limit_policy is not None:
        input_["game_session_creation_limit_policy"] = (
            game_session_creation_limit_policy
        )
    if log_configuration is not None:
        input_["log_configuration"] = log_configuration
    if remove_attributes is not None:
        input_["remove_attributes"] = remove_attributes

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