Skip to content

update_container_group_definition

update_container_group_definition(
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    name: Optional[ContainerGroupDefinitionNameOrArn] = None,
    game_server_container_definition: Optional[
        GameServerContainerDefinitionInput
    ] = None,
    support_container_definitions: Optional[SupportContainerDefinitionInputList] = None,
    total_memory_limit_mebibytes: Optional[ContainerTotalMemoryLimit] = None,
    total_vcpu_limit: Optional[ContainerTotalVcpuLimit] = None,
    version_description: Optional[NonZeroAndMaxString] = None,
    source_version_number: Optional[PositiveInteger] = None,
    operating_system: Optional[ContainerOperatingSystem] = None,
    remove_attributes: Optional[ContainerGroupDefinitionRemoveAttributeList] = None,
) -> UpdateContainerGroupDefinitionOutput

This API works with the following fleet types: Container

Updates properties in an existing container group definition. This operation doesn't replace the definition. Instead, it creates a new version of the definition and saves it separately. You can access all versions that you choose to retain.

The only property you can't update is the container group type.

Request options:

  • Update based on the latest version of the container group definition. Specify the container group definition name only, or use an ARN value without a version number. Provide updated values for the properties that you want to change only. All other values remain the same as the latest version.

  • Update based on a specific version of the container group definition. Specify the container group definition name and a source version number, or use an ARN value with a version number. Provide updated values for the properties that you want to change only. All other values remain the same as the source version.

  • Change a game server container definition. Provide a complete set of container definitions, including the updated definition.

  • Add or change a support container definition. Provide a complete set of container definitions, including the updated definition.

  • Remove a support container definition. Provide a complete set of container definitions, excluding the definition to remove. If the container group has only one support container definition, provide an empty set.

  • Remove the total vCPU limit from a game server container group so that its containers can use up to the instance's available vCPU. Set RemoveAttributes to TOTAL_VCPU_LIMIT. The game server container must have a Vcpu value, because a game server container group needs either a total vCPU limit or a game server Vcpu value.

Results:

If successful, this operation returns the complete properties of the new container group definition version.

If the container group definition version is used in an active fleet, the update automatically initiates a new fleet deployment of the new version. You can track a fleet's deployments using ListFleetDeployments.

Parameters:

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

    A descriptive identifier for the container group definition. The name value must be unique in an Amazon Web Services Region.

  • game_server_container_definition (Optional[GameServerContainerDefinitionInput], default: None ) –

    An updated definition for the game server container in this group. Define a game server container only when the container group type is GAME_SERVER. You can pass in your container definitions as a JSON file.

  • support_container_definitions (Optional[SupportContainerDefinitionInputList], default: None ) –

    One or more definitions for support containers in this group. You can define a support container in any type of container group. You can pass in your container definitions as a JSON file.

  • total_memory_limit_mebibytes (Optional[ContainerTotalMemoryLimit], default: None ) –

    The maximum amount of memory (in MiB) to allocate to the container group. All containers in the group share this memory. If you specify memory limits for an individual container, the total value must be greater than any individual container's memory limit.

  • total_vcpu_limit (Optional[ContainerTotalVcpuLimit], default: None ) –

    The maximum amount of vCPU units to allocate to the container group (1 vCPU is equal to 1024 CPU units). All containers in the group share these resources. If you set vCPU reservations for individual containers, the total value must be equal to or greater than the sum of the Vcpu values for all containers in the group.

    For a game server container group, Amazon GameLift Servers requires either a total vCPU limit or a Vcpu value for the game server container. If the container group has a total vCPU limit, Amazon GameLift Servers uses this value to calculate how many game server container groups fit on an instance. If the container group doesn't have a total vCPU limit, its containers can use up to the instance's available vCPU, and Amazon GameLift Servers uses the sum of the containers' Vcpu values to calculate how many game server container groups fit on an instance. To remove the total vCPU limit, omit this parameter and set RemoveAttributes to TOTAL_VCPU_LIMIT.

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

    A description for this update to the container group definition.

  • source_version_number (Optional[PositiveInteger], default: None ) –

    The container group definition version to update. The new version starts with values from the source version, and then updates values included in this request.

  • operating_system (Optional[ContainerOperatingSystem], default: None ) –

    The platform that all containers in the group use. Containers in a group must run on the same operating system.

    Amazon Linux 2 (AL2) will reach end of support on 6/30/2026. See more details in the Amazon Linux 2 FAQs. For game servers that are hosted on AL2 and use server SDK version 4.x for Amazon GameLift Servers, first update the game server build to server SDK 5.x, and then deploy to AL2023 instances. See Migrate to server SDK version 5.

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

    If set, this update removes the container group's total vCPU limit, and the group's containers can use up to the instance's available vCPU. You can't remove the total vCPU limit from a per-instance container group. A game server container group needs either a total vCPU limit or a Vcpu value for the game server container. You can't set TotalVcpuLimit in the same request.

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.

  • 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/game_lift.py
def update_container_group_definition(
    self,
    *,
    config_overrides: Optional[GameLiftClientConfig] = None,
    name: Optional[
        "capo_gamelift.types.container_group_definition_name_or_arn.ContainerGroupDefinitionNameOrArn"
    ] = None,
    game_server_container_definition: Optional[
        "capo_gamelift.types.game_server_container_definition_input.GameServerContainerDefinitionInput"
    ] = None,
    support_container_definitions: Optional[
        "capo_gamelift.types.support_container_definition_input_list.SupportContainerDefinitionInputList"
    ] = None,
    total_memory_limit_mebibytes: Optional[
        "capo_gamelift.types.container_total_memory_limit.ContainerTotalMemoryLimit"
    ] = None,
    total_vcpu_limit: Optional[
        "capo_gamelift.types.container_total_vcpu_limit.ContainerTotalVcpuLimit"
    ] = None,
    version_description: Optional[
        "capo_gamelift.types.non_zero_and_max_string.NonZeroAndMaxString"
    ] = None,
    source_version_number: Optional[
        "capo_gamelift.types.positive_integer.PositiveInteger"
    ] = None,
    operating_system: Optional[
        "capo_gamelift.types.container_operating_system.ContainerOperatingSystem"
    ] = None,
    remove_attributes: Optional[
        "capo_gamelift.types.container_group_definition_remove_attribute_list.ContainerGroupDefinitionRemoveAttributeList"
    ] = None,
) -> "capo_gamelift.types.update_container_group_definition_output.UpdateContainerGroupDefinitionOutput":
    """<p> <b>This API works with the following fleet types:</b> Container</p> <p>Updates properties in an existing container group definition. This operation doesn't replace the definition. Instead, it creates a new version of the definition and saves it separately. You can access all versions that you choose to retain.</p> <p>The only property you can't update is the container group type.</p> <p> <b>Request options:</b> </p> <ul> <li> <p>Update based on the latest version of the container group definition. Specify the container group definition name only, or use an ARN value without a version number. Provide updated values for the properties that you want to change only. All other values remain the same as the latest version.</p> </li> <li> <p>Update based on a specific version of the container group definition. Specify the container group definition name and a source version number, or use an ARN value with a version number. Provide updated values for the properties that you want to change only. All other values remain the same as the source version.</p> </li> <li> <p>Change a game server container definition. Provide a complete set of container definitions, including the updated definition.</p> </li> <li> <p>Add or change a support container definition. Provide a complete set of container definitions, including the updated definition.</p> </li> <li> <p>Remove a support container definition. Provide a complete set of container definitions, excluding the definition to remove. If the container group has only one support container definition, provide an empty set.</p> </li> <li> <p>Remove the total vCPU limit from a game server container group so that its containers can use up to the instance's available vCPU. Set <code>RemoveAttributes</code> to <code>TOTAL_VCPU_LIMIT</code>. The game server container must have a <code>Vcpu</code> value, because a game server container group needs either a total vCPU limit or a game server <code>Vcpu</code> value.</p> </li> </ul> <p> <b>Results:</b> </p> <p>If successful, this operation returns the complete properties of the new container group definition version.</p> <p>If the container group definition version is used in an active fleet, the update automatically initiates a new fleet deployment of the new version. You can track a fleet's deployments using <a href="https://docs.aws.amazon.com/gamelift/latest/apireference/API_ListFleetDeployments.html">ListFleetDeployments</a>.</p>

    Args:
        name: <p>A descriptive identifier for the container group definition. The name value must be unique in an Amazon Web Services Region.</p>
        game_server_container_definition: <p>An updated definition for the game server container in this group. Define a game server container only when the container group type is <code>GAME_SERVER</code>. You can pass in your container definitions as a JSON file.</p>
        support_container_definitions: <p>One or more definitions for support containers in this group. You can define a support container in any type of container group. You can pass in your container definitions as a JSON file.</p>
        total_memory_limit_mebibytes: <p>The maximum amount of memory (in MiB) to allocate to the container group. All containers in the group share this memory. If you specify memory limits for an individual container, the total value must be greater than any individual container's memory limit.</p>
        total_vcpu_limit: <p>The maximum amount of vCPU units to allocate to the container group (1 vCPU is equal to 1024 CPU units). All containers in the group share these resources. If you set vCPU reservations for individual containers, the total value must be equal to or greater than the sum of the <code>Vcpu</code> values for all containers in the group.</p> <p>For a game server container group, Amazon GameLift Servers requires either a total vCPU limit or a <code>Vcpu</code> value for the game server container. If the container group has a total vCPU limit, Amazon GameLift Servers uses this value to calculate how many game server container groups fit on an instance. If the container group doesn't have a total vCPU limit, its containers can use up to the instance's available vCPU, and Amazon GameLift Servers uses the sum of the containers' <code>Vcpu</code> values to calculate how many game server container groups fit on an instance. To remove the total vCPU limit, omit this parameter and set <code>RemoveAttributes</code> to <code>TOTAL_VCPU_LIMIT</code>.</p>
        version_description: <p>A description for this update to the container group definition. </p>
        source_version_number: <p>The container group definition version to update. The new version starts with values from the source version, and then updates values included in this request. </p>
        operating_system: <p>The platform that all containers in the group use. Containers in a group must run on the same operating system.</p> <note> <p>Amazon Linux 2 (AL2) will reach end of support on 6/30/2026. See more details in the <a href="http://aws.amazon.com/amazon-linux-2/faqs/">Amazon Linux 2 FAQs</a>. For game servers that are hosted on AL2 and use server SDK version 4.x for Amazon GameLift Servers, first update the game server build to server SDK 5.x, and then deploy to AL2023 instances. See <a href="https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-serversdk5-migration.html"> Migrate to server SDK version 5.</a> </p> </note>
        remove_attributes: <p>If set, this update removes the container group's total vCPU limit, and the group's containers can use up to the instance's available vCPU. You can't remove the total vCPU limit from a per-instance container group. A game server container group needs either a total vCPU limit or a <code>Vcpu</code> value for the game server container. You can't set <code>TotalVcpuLimit</code> in the same request.</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.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.
    """

    def _handler(
        req: "OperationRequest[capo_gamelift.types.update_container_group_definition_input.UpdateContainerGroupDefinitionInput]",
    ) -> OperationResponse[
        "capo_gamelift.types.update_container_group_definition_output.UpdateContainerGroupDefinitionOutput"
    ]:
        import capo_gamelift._operations.game_lift.update_container_group_definition

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

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

        return capo_gamelift.types.update_container_group_definition_input.redact_sensitive(
            input_
        )

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

        return capo_gamelift.types.update_container_group_definition_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateContainerGroupDefinition",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_gamelift.types.update_container_group_definition_input.UpdateContainerGroupDefinitionInput = {}
    if name is not None:
        input_["name"] = name
    if game_server_container_definition is not None:
        input_["game_server_container_definition"] = (
            game_server_container_definition
        )
    if support_container_definitions is not None:
        input_["support_container_definitions"] = support_container_definitions
    if total_memory_limit_mebibytes is not None:
        input_["total_memory_limit_mebibytes"] = total_memory_limit_mebibytes
    if total_vcpu_limit is not None:
        input_["total_vcpu_limit"] = total_vcpu_limit
    if version_description is not None:
        input_["version_description"] = version_description
    if source_version_number is not None:
        input_["source_version_number"] = source_version_number
    if operating_system is not None:
        input_["operating_system"] = operating_system
    if remove_attributes is not None:
        input_["remove_attributes"] = remove_attributes

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