

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 将 `UpdateClusterVersion` 与 CLI 配合使用
<a name="eks_example_eks_UpdateClusterVersion_section"></a>

以下代码示例演示如何使用 `UpdateClusterVersion`。

------
#### [ CLI ]

**AWS CLI**  
**将名为 `my-eks-cluster`的 Amazon EKS 集群更新到指定的 Kubernetes 版本**  
以下 `update-cluster-version` 示例将 Amazon EKS 集群更新为指定的 Kubernetes 版本。  

```
aws eks update-cluster-version \
    --name my-eks-cluster \
    --kubernetes-version 1.27
```
输出：  

```
{
    "update": {
        "id": "e4091a28-ea14-48fd-a8c7-975aeb469e8a",
        "status": "InProgress",
        "type": "VersionUpdate",
        "params": [
            {
                "type": "Version",
                "value": "1.27"
            },
            {
                "type": "PlatformVersion",
                "value": "eks.16"
            }
        ],
        "createdAt": "2024-04-12T16:56:01.082000-04:00",
        "errors": []
    }
}
```
有关更多信息，请参阅《Amazon EKS 用户指南》**中的[更新 Amazon EKS 集群 Kubernetes 版本](https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html)。  
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[UpdateClusterVersion](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-version.html)*中的。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此 cmdlet 将 Amazon EKS 集群更新到指定的 Kubernetes 版本。在更新期间，集群将继续运行。**  

```
Update-EKSClusterVersion -Name "PROD-KUBE-CL" -Version 1.14
```
**输出**：  

```
CreatedAt : 12/26/2019 9:50:37 AM
Errors    : {}
Id        : ef186eff-3b3a-4c25-bcfc-3dcdf9e898a8
Params    : {Amazon.EKS.Model.UpdateParam, Amazon.EKS.Model.UpdateParam}
Status    : InProgress
Type      : VersionUpdate
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 4) [UpdateClusterVersion](https://docs.aws.amazon.com/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此 cmdlet 将 Amazon EKS 集群更新到指定的 Kubernetes 版本。在更新期间，集群将继续运行。**  

```
Update-EKSClusterVersion -Name "PROD-KUBE-CL" -Version 1.14
```
**输出**：  

```
CreatedAt : 12/26/2019 9:50:37 AM
Errors    : {}
Id        : ef186eff-3b3a-4c25-bcfc-3dcdf9e898a8
Params    : {Amazon.EKS.Model.UpdateParam, Amazon.EKS.Model.UpdateParam}
Status    : InProgress
Type      : VersionUpdate
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 5) [UpdateClusterVersion](https://docs.aws.amazon.com/powershell/v5/reference)中的。

------