Skip to content

update_cluster_version

update_cluster_version(
    name: String,
    version: String,
    *,
    config_overrides: Optional[EKSClientConfig] = None,
    client_request_token: Optional[String] = None,
    force: Optional[Boolean] = None,
    rollback_config: Optional[RollbackConfig] = None,
) -> UpdateClusterVersionResponse

Updates an Amazon EKS cluster to the specified Kubernetes version. Your cluster continues to function during the update. The response output includes an update ID that you can use to track the status of your cluster update with the DescribeUpdate API operation.

Cluster updates are asynchronous, and they should finish within a few minutes. During an update, the cluster status moves to UPDATING (this status transition is eventually consistent). When the update is complete (either Failed or Successful), the cluster status moves to Active.

If your cluster has managed node groups attached to it, all of your node groups' Kubernetes versions must match the cluster's Kubernetes version in order to update the cluster to a new Kubernetes version.

Parameters:

  • name (String) –

    The name of the Amazon EKS cluster to update.

  • version (String) –

    The desired Kubernetes version following a successful update.

  • client_request_token (Optional[String], default: None ) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

  • force (Optional[Boolean], default: None ) –

    Set this value to true to override upgrade-blocking or rollback-blocking readiness checks when updating a cluster.

  • rollback_config (Optional[RollbackConfig], default: None ) –

    The rollback configuration for the cluster version rollback.

Raises:

  • ClientException –

    These errors are usually caused by a client action. Actions can include using an action or resource on behalf of an IAM principal that doesn't have permissions to use the action or resource or specifying an identifier that is not valid.

  • InvalidParameterException –

    The specified parameter is invalid. Review the available parameters for the API request.

  • InvalidRequestException –

    The request is invalid given the state of the cluster. Check the state of the cluster and the associated operations.

  • InvalidStateException –

    Amazon EKS detected upgrade readiness issues. Call the ListInsights API to view detected upgrade blocking issues. Pass the force flag when updating to override upgrade readiness errors.

  • ResourceInUseException –

    The specified resource is in use.

  • ResourceNotFoundException –

    The specified resource could not be found. You can view your available clusters with ListClusters. You can view your available managed node groups with ListNodegroups. Amazon EKS clusters and node groups are Amazon Web Services Region specific.

  • ServerException –

    These errors are usually caused by a server-side issue.

  • ThrottlingException –

    The request or operation couldn't be performed because a service is throttling requests.

  • UnknownServiceError –

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

Source code in docs_src/capo_eks/_services/eks.py
def update_cluster_version(
    self,
    name: "capo_eks.types.string.String",
    version: "capo_eks.types.string.String",
    *,
    config_overrides: Optional[EKSClientConfig] = None,
    client_request_token: Optional["capo_eks.types.string.String"] = None,
    force: Optional["capo_eks.types.boolean.Boolean"] = None,
    rollback_config: Optional[
        "capo_eks.types.rollback_config.RollbackConfig"
    ] = None,
) -> "capo_eks.types.update_cluster_version_response.UpdateClusterVersionResponse":
    """<p>Updates an Amazon EKS cluster to the specified Kubernetes version. Your cluster continues to function during the update. The response output includes an update ID that you can use to track the status of your cluster update with the <a href="https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeUpdate.html"> <code>DescribeUpdate</code> </a> API operation.</p> <p>Cluster updates are asynchronous, and they should finish within a few minutes. During an update, the cluster status moves to <code>UPDATING</code> (this status transition is eventually consistent). When the update is complete (either <code>Failed</code> or <code>Successful</code>), the cluster status moves to <code>Active</code>.</p> <p>If your cluster has managed node groups attached to it, all of your node groups' Kubernetes versions must match the cluster's Kubernetes version in order to update the cluster to a new Kubernetes version.</p>

    Args:
        name: <p>The name of the Amazon EKS cluster to update.</p>
        version: <p>The desired Kubernetes version following a successful update.</p>
        client_request_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
        force: <p>Set this value to <code>true</code> to override upgrade-blocking or rollback-blocking readiness checks when updating a cluster.</p>
        rollback_config: <p>The rollback configuration for the cluster version rollback.</p>

    Raises:
        capo_eks.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. Actions can include using an action or resource on behalf of an <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html">IAM principal</a> that doesn't have permissions to use the action or resource or specifying an identifier that is not valid.</p>
        capo_eks.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter is invalid. Review the available parameters for the API request.</p>
        capo_eks.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid given the state of the cluster. Check the state of the cluster and the associated operations.</p>
        capo_eks.errors.invalid_state_exception.InvalidStateException: <p>Amazon EKS detected upgrade readiness issues. Call the <a href="https://docs.aws.amazon.com/eks/latest/APIReference/API_ListInsights.html"> <code>ListInsights</code> </a> API to view detected upgrade blocking issues. Pass the <a href="https://docs.aws.amazon.com/eks/latest/APIReference/API_UpdateClusterVersion.html#API_UpdateClusterVersion_RequestBody"> <code>force</code> </a> flag when updating to override upgrade readiness errors.</p>
        capo_eks.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
        capo_eks.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource could not be found. You can view your available clusters with <code>ListClusters</code>. You can view your available managed node groups with <code>ListNodegroups</code>. Amazon EKS clusters and node groups are Amazon Web Services Region specific.</p>
        capo_eks.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
        capo_eks.errors.throttling_exception.ThrottlingException: <p>The request or operation couldn't be performed because a service is throttling requests.</p>
        capo_eks.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_eks.types.update_cluster_version_request.UpdateClusterVersionRequest]",
    ) -> OperationResponse[
        "capo_eks.types.update_cluster_version_response.UpdateClusterVersionResponse"
    ]:
        import capo_eks._operations.aws_wesley_frontend.update_cluster_version

        output, http_response = (
            capo_eks._operations.aws_wesley_frontend.update_cluster_version.update_cluster_version(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateClusterVersion")
    )
    input_: capo_eks.types.update_cluster_version_request.UpdateClusterVersionRequest = {
        "name": name,
        "version": version,
    }
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if force is not None:
        input_["force"] = force
    if rollback_config is not None:
        input_["rollback_config"] = rollback_config

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