

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# AWS SDKsコード例
<a name="eks_code_examples"></a>

次のコード例は、 AWS Software Development Kit (SDK) で Amazon Elastic Kubernetes Service を使用する方法を示しています。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

**その他のリソース**
+  **[Amazon EKS ユーザーガイド](https://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html)** — Amazon EKS に関する詳細情報。
+ **[Amazon EKS API リファレンス](https://docs.aws.amazon.com/eks/latest/APIReference/Welcome.html)** — 使用可能なすべての Amazon EKS アクションに関する詳細。
+ **[AWS デベロッパーセンター](https://aws.amazon.com/developer/code-examples/?awsf.sdk-code-examples-product=product%23eks)** – カテゴリまたは全文検索でフィルタリングできるコード例。
+ **[AWS SDK の例](https://github.com/awsdocs/aws-doc-sdk-examples)** – 完全なコードを優先言語で含む GitHub リポジトリ。コードの設定と実行に関する説明が記載されています。

**Contents**
+ [基本](eks_code_examples_basics.md)
  + [アクション](eks_code_examples_actions.md)
    + [`CreateCluster`](eks_example_eks_CreateCluster_section.md)
    + [`CreateFargateProfile`](eks_example_eks_CreateFargateProfile_section.md)
    + [`CreateNodegroup`](eks_example_eks_CreateNodegroup_section.md)
    + [`DeleteCluster`](eks_example_eks_DeleteCluster_section.md)
    + [`DeleteFargateProfile`](eks_example_eks_DeleteFargateProfile_section.md)
    + [`DeleteNodegroup`](eks_example_eks_DeleteNodegroup_section.md)
    + [`DescribeCluster`](eks_example_eks_DescribeCluster_section.md)
    + [`DescribeFargateProfile`](eks_example_eks_DescribeFargateProfile_section.md)
    + [`DescribeNodegroup`](eks_example_eks_DescribeNodegroup_section.md)
    + [`DescribeUpdate`](eks_example_eks_DescribeUpdate_section.md)
    + [`ListClusters`](eks_example_eks_ListClusters_section.md)
    + [`ListFargateProfiles`](eks_example_eks_ListFargateProfiles_section.md)
    + [`ListNodegroups`](eks_example_eks_ListNodegroups_section.md)
    + [`ListTagsForResource`](eks_example_eks_ListTagsForResource_section.md)
    + [`ListUpdates`](eks_example_eks_ListUpdates_section.md)
    + [`TagResource`](eks_example_eks_TagResource_section.md)
    + [`UntagResource`](eks_example_eks_UntagResource_section.md)
    + [`UpdateClusterConfig`](eks_example_eks_UpdateClusterConfig_section.md)
    + [`UpdateClusterVersion`](eks_example_eks_UpdateClusterVersion_section.md)

# AWS SDKs基本的な例
<a name="eks_code_examples_basics"></a>

次のコード例は、 AWS SDK で Amazon Elastic Kubernetes Service を使用する基本的な方法を説明しています。

**Contents**
+ [アクション](eks_code_examples_actions.md)
  + [`CreateCluster`](eks_example_eks_CreateCluster_section.md)
  + [`CreateFargateProfile`](eks_example_eks_CreateFargateProfile_section.md)
  + [`CreateNodegroup`](eks_example_eks_CreateNodegroup_section.md)
  + [`DeleteCluster`](eks_example_eks_DeleteCluster_section.md)
  + [`DeleteFargateProfile`](eks_example_eks_DeleteFargateProfile_section.md)
  + [`DeleteNodegroup`](eks_example_eks_DeleteNodegroup_section.md)
  + [`DescribeCluster`](eks_example_eks_DescribeCluster_section.md)
  + [`DescribeFargateProfile`](eks_example_eks_DescribeFargateProfile_section.md)
  + [`DescribeNodegroup`](eks_example_eks_DescribeNodegroup_section.md)
  + [`DescribeUpdate`](eks_example_eks_DescribeUpdate_section.md)
  + [`ListClusters`](eks_example_eks_ListClusters_section.md)
  + [`ListFargateProfiles`](eks_example_eks_ListFargateProfiles_section.md)
  + [`ListNodegroups`](eks_example_eks_ListNodegroups_section.md)
  + [`ListTagsForResource`](eks_example_eks_ListTagsForResource_section.md)
  + [`ListUpdates`](eks_example_eks_ListUpdates_section.md)
  + [`TagResource`](eks_example_eks_TagResource_section.md)
  + [`UntagResource`](eks_example_eks_UntagResource_section.md)
  + [`UpdateClusterConfig`](eks_example_eks_UpdateClusterConfig_section.md)
  + [`UpdateClusterVersion`](eks_example_eks_UpdateClusterVersion_section.md)

# AWS SDKsアクション
<a name="eks_code_examples_actions"></a>

次のコード例は、 AWS SDKs を使用して個々の Amazon EKS アクションを実行する方法を示しています。それぞれの例には、GitHub へのリンクがあり、そこにはコードの設定と実行に関する説明が記載されています。

 以下の例には、最も一般的に使用されるアクションのみ含まれています。完全なリストについては、「[Amazon Elastic Kubernetes Service API リファレンス](https://docs.aws.amazon.com/eks/latest/APIReference/Welcome.html)」を参照してください。

**Topics**
+ [`CreateCluster`](eks_example_eks_CreateCluster_section.md)
+ [`CreateFargateProfile`](eks_example_eks_CreateFargateProfile_section.md)
+ [`CreateNodegroup`](eks_example_eks_CreateNodegroup_section.md)
+ [`DeleteCluster`](eks_example_eks_DeleteCluster_section.md)
+ [`DeleteFargateProfile`](eks_example_eks_DeleteFargateProfile_section.md)
+ [`DeleteNodegroup`](eks_example_eks_DeleteNodegroup_section.md)
+ [`DescribeCluster`](eks_example_eks_DescribeCluster_section.md)
+ [`DescribeFargateProfile`](eks_example_eks_DescribeFargateProfile_section.md)
+ [`DescribeNodegroup`](eks_example_eks_DescribeNodegroup_section.md)
+ [`DescribeUpdate`](eks_example_eks_DescribeUpdate_section.md)
+ [`ListClusters`](eks_example_eks_ListClusters_section.md)
+ [`ListFargateProfiles`](eks_example_eks_ListFargateProfiles_section.md)
+ [`ListNodegroups`](eks_example_eks_ListNodegroups_section.md)
+ [`ListTagsForResource`](eks_example_eks_ListTagsForResource_section.md)
+ [`ListUpdates`](eks_example_eks_ListUpdates_section.md)
+ [`TagResource`](eks_example_eks_TagResource_section.md)
+ [`UntagResource`](eks_example_eks_UntagResource_section.md)
+ [`UpdateClusterConfig`](eks_example_eks_UpdateClusterConfig_section.md)
+ [`UpdateClusterVersion`](eks_example_eks_UpdateClusterVersion_section.md)

# AWS SDK または CLI `CreateCluster`で を使用する
<a name="eks_example_eks_CreateCluster_section"></a>

次のサンプルコードは、`CreateCluster` を使用する方法を説明しています。

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

**AWS CLI**  
**新しいクラスターを作成するには**  
このコマンド例は、デフォルトリージョンに `prod` という名前のクラスターを作成します。  
コマンド:  

```
aws eks create-cluster --name prod \
--role-arn arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI \
--resources-vpc-config subnetIds=subnet-6782e71e,subnet-e7e761ac,securityGroupIds=sg-6979fe18
```
出力:  

```
{
    "cluster": {
        "name": "prod",
        "arn": "arn:aws:eks:us-west-2:012345678910:cluster/prod",
        "createdAt": 1527808069.147,
        "version": "1.10",
        "roleArn": "arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI",
        "resourcesVpcConfig": {
            "subnetIds": [
                "subnet-6782e71e",
                "subnet-e7e761ac"
            ],
            "securityGroupIds": [
                "sg-6979fe18"
            ],
            "vpcId": "vpc-950809ec"
        },
        "status": "CREATING",
        "certificateAuthority": {}
    }
}
```
**プライベートエンドポイントアクセスを含むクラスターを作成してロギングを埋め込むには**  
このコマンド例は、パブリックエンドポイントアクセスを無効にし、プライベートエンドポイントアクセスを有効にして、すべてのロギングタイプが有効な、`example` という名前のクラスターをデフォルトのリージョンに作成します。  
コマンド:  

```
aws eks create-cluster --name example --kubernetes-version 1.12 \
--role-arn arn:aws:iam::012345678910:role/example-cluster-ServiceRole-1XWBQWYSFRE2Q \
--resources-vpc-config subnetIds=subnet-0a188dccd2f9a632f,subnet-09290d93da4278664,subnet-0f21dd86e0e91134a,subnet-0173dead68481a583,subnet-051f70a57ed6fcab6,subnet-01322339c5c7de9b4,securityGroupIds=sg-0c5b580845a031c10,endpointPublicAccess=false,endpointPrivateAccess=true \
--logging '{"clusterLogging":[{"types":["api","audit","authenticator","controllerManager","scheduler"],"enabled":true}]}'
```
出力:  

```
{
    "cluster": {
        "name": "example",
        "arn": "arn:aws:eks:us-west-2:012345678910:cluster/example",
        "createdAt": 1565804921.901,
        "version": "1.12",
        "roleArn": "arn:aws:iam::012345678910:role/example-cluster-ServiceRole-1XWBQWYSFRE2Q",
        "resourcesVpcConfig": {
            "subnetIds": [
                "subnet-0a188dccd2f9a632f",
                "subnet-09290d93da4278664",
                "subnet-0f21dd86e0e91134a",
                "subnet-0173dead68481a583",
                "subnet-051f70a57ed6fcab6",
                "subnet-01322339c5c7de9b4"
            ],
            "securityGroupIds": [
                "sg-0c5b580845a031c10"
            ],
            "vpcId": "vpc-0f622c01f68d4afec",
            "endpointPublicAccess": false,
            "endpointPrivateAccess": true
        },
        "logging": {
            "clusterLogging": [
                {
                    "types": [
                        "api",
                        "audit",
                        "authenticator",
                        "controllerManager",
                        "scheduler"
                    ],
                    "enabled": true
                }
            ]
        },
        "status": "CREATING",
        "certificateAuthority": {},
        "platformVersion": "eks.3"
    }
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[CreateCluster](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/create-cluster.html)」を参照してください。**

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

**Tools for PowerShell V4**  
**例 1: この例では、「prod」という新しいクラスターを作成します。**  

```
New-EKSCluster -Name prod -ResourcesVpcConfig @{SubnetIds=@("subnet-0a1b2c3d","subnet-3a2b1c0d");SecurityGroupIds="sg-6979fe18"} -RoleArn "arn:aws:iam::012345678901:role/eks-service-role"
```
**出力:**  

```
Arn                  : arn:aws:eks:us-west-2:012345678901:cluster/prod
CertificateAuthority : Amazon.EKS.Model.Certificate
ClientRequestToken   :
CreatedAt            : 12/10/2018 9:25:31 PM
Endpoint             :
Name                 : prod
PlatformVersion      : eks.3
ResourcesVpcConfig   : Amazon.EKS.Model.VpcConfigResponse
RoleArn              : arn:aws:iam::012345678901:role/eks-service-role
Status               : CREATING
Version              : 1.10
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[CreateCluster](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: この例では、「prod」という新しいクラスターを作成します。**  

```
New-EKSCluster -Name prod -ResourcesVpcConfig @{SubnetIds=@("subnet-0a1b2c3d","subnet-3a2b1c0d");SecurityGroupIds="sg-6979fe18"} -RoleArn "arn:aws:iam::012345678901:role/eks-service-role"
```
**出力:**  

```
Arn                  : arn:aws:eks:us-west-2:012345678901:cluster/prod
CertificateAuthority : Amazon.EKS.Model.Certificate
ClientRequestToken   :
CreatedAt            : 12/10/2018 9:25:31 PM
Endpoint             :
Name                 : prod
PlatformVersion      : eks.3
ResourcesVpcConfig   : Amazon.EKS.Model.VpcConfigResponse
RoleArn              : arn:aws:iam::012345678901:role/eks-service-role
Status               : CREATING
Version              : 1.10
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[CreateCluster](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------
#### [ Rust ]

**SDK for Rust**  
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1/examples/eks#code-examples)での設定と実行の方法を確認してください。

```
async fn make_cluster(
    client: &aws_sdk_eks::Client,
    name: &str,
    arn: &str,
    subnet_ids: Vec<String>,
) -> Result<(), aws_sdk_eks::Error> {
    let cluster = client
        .create_cluster()
        .name(name)
        .role_arn(arn)
        .resources_vpc_config(
            VpcConfigRequest::builder()
                .set_subnet_ids(Some(subnet_ids))
                .build(),
        )
        .send()
        .await?;
    println!("cluster created: {:?}", cluster);

    Ok(())
}
```
+  API の詳細については、「*AWS SDK for Rust API リファレンス*」の「[CreateCluster](https://docs.rs/aws-sdk-eks/latest/aws_sdk_eks/client/struct.Client.html#method.create_cluster)」を参照してください。

------

# CLI で `CreateFargateProfile` を使用する
<a name="eks_example_eks_CreateFargateProfile_section"></a>

次のサンプルコードは、`CreateFargateProfile` を使用する方法を説明しています。

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

**AWS CLI**  
**例 1: 名前空間を持つセレクターの EKS Fargate プロファイルを作成する**  
次の `create-fargate-profile` の例では、名前空間を持つセレクターの EKS Fargate Profile を作成します。  

```
aws eks create-fargate-profile \
    --cluster-name my-eks-cluster \
    --pod-execution-role-arn arn:aws:iam::111122223333:role/role-name \
    --fargate-profile-name my-fargate-profile \
    --selectors '[{"namespace": "default"}]'
```
出力:  

```
{
    "fargateProfile": {
        "fargateProfileName": "my-fargate-profile",
        "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/a2c72bca-318e-abe8-8ed1-27c6d4892e9e",
        "clusterName": "my-eks-cluster",
        "createdAt": "2024-03-19T12:38:47.368000-04:00",
        "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name",
        "subnets": [
            "subnet-09d912bb63ef21b9a",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-0e2907431c9988b72"
        ],
        "selectors": [
            {
                "namespace": "default"
            }
        ],
        "status": "CREATING",
        "tags": {}
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[AWS Fargate プロファイル - Fargate プロファイルの作成](https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html#create-fargate-profile)」を参照してください。  
**例 2: 名前空間とラベルを持つセレクターの EKS Fargate プロファイルを作成する**  
次の `create-fargate-profile` の例では、名前空間とラベルを持つセレクターの EKS Fargate プロファイルを作成します。  

```
aws eks create-fargate-profile \
    --cluster-name my-eks-cluster \
    --pod-execution-role-arn arn:aws:iam::111122223333:role/role-name \
    --fargate-profile-name my-fargate-profile \
    --selectors '[{"namespace": "default", "labels": {"labelname1": "labelvalue1"}}]'
```
出力:  

```
{
    "fargateProfile": {
        "fargateProfileName": "my-fargate-profile",
        "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/88c72bc7-e8a4-fa34-44e4-2f1397224bb3",
        "clusterName": "my-eks-cluster",
        "createdAt": "2024-03-19T12:33:48.125000-04:00",
        "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name",
        "subnets": [
            "subnet-09d912bb63ef21b9a",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-0e2907431c9988b72"
        ],
        "selectors": [
            {
                "namespace": "default",
                "labels": {
                    "labelname1": "labelvalue1"
                }
            }
        ],
        "status": "CREATING",
        "tags": {}
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[AWS Fargate プロファイル - Fargate プロファイルの作成](https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html#create-fargate-profile)」を参照してください。  
**例 3: 名前空間とラベル、およびポッドを起動するサブネットの ID を持つセレクターの EKS Fargate Profile を作成する。**  
次の `create-fargate-profile` の例では、名前空間とラベル、およびポッドを起動するサブネットの ID を持つセレクターの EKS Fargate Profile を作成します。  

```
aws eks create-fargate-profile \
    --cluster-name my-eks-cluster \
    --pod-execution-role-arn arn:aws:iam::111122223333:role/role-name \
    --fargate-profile-name my-fargate-profile \
    --selectors '[{"namespace": "default", "labels": {"labelname1": "labelvalue1"}}]' \
    --subnets '["subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72"]'
```
出力:  

```
{
    "fargateProfile": {
        "fargateProfileName": "my-fargate-profile",
        "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/e8c72bc8-e87b-5eb6-57cb-ed4fe57577e3",
        "clusterName": "my-eks-cluster",
        "createdAt": "2024-03-19T12:35:58.640000-04:00",
        "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name",
        "subnets": [
            "subnet-09d912bb63ef21b9a",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-0e2907431c9988b72"
        ],
        "selectors": [
            {
                "namespace": "default",
                "labels": {
                    "labelname1": "labelvalue1"
                }
            }
        ],
        "status": "CREATING",
        "tags": {}
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[AWS Fargate プロファイル - Fargate プロファイルの作成](https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html#create-fargate-profile)」を参照してください。  
**例 4: 複数の名前空間とラベル、およびポッドを起動するサブネットの ID を持つセレクターの EKS Fargate プロファイルを作成する**  
次の `create-fargate-profile` の例では、複数の名前空間とラベル、およびポッドを起動するサブネットの ID を持つセレクターの EKS Fargate プロファイルを作成します。  

```
aws eks create-fargate-profile \
    --cluster-name my-eks-cluster \
    --pod-execution-role-arn arn:aws:iam::111122223333:role/role-name \
    --fargate-profile-name my-fargate-profile \
    --selectors '[{"namespace": "default1", "labels": {"labelname1": "labelvalue1", "labelname2": "labelvalue2"}}, {"namespace": "default2", "labels": {"labelname1": "labelvalue1", "labelname2": "labelvalue2"}}]' \
    --subnets '["subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72"]' \
    --tags '{"eks-fargate-profile-key-1": "value-1" , "eks-fargate-profile-key-2": "value-2"}'
```
出力:  

```
{
    "fargateProfile": {
        "fargateProfileName": "my-fargate-profile",
        "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/4cc72bbf-b766-8ee6-8d29-e62748feb3cd",
        "clusterName": "my-eks-cluster",
        "createdAt": "2024-03-19T12:15:55.271000-04:00",
        "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name",
        "subnets": [
            "subnet-09d912bb63ef21b9a",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-0e2907431c9988b72"
        ],
        "selectors": [
            {
                "namespace": "default1",
                "labels": {
                    "labelname2": "labelvalue2",
                    "labelname1": "labelvalue1"
                }
            },
            {
                "namespace": "default2",
                "labels": {
                    "labelname2": "labelvalue2",
                    "labelname1": "labelvalue1"
                }
            }
        ],
        "status": "CREATING",
        "tags": {
            "eks-fargate-profile-key-2": "value-2",
            "eks-fargate-profile-key-1": "value-1"
        }
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[AWS Fargate プロファイル - Fargate プロファイルの作成](https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html#create-fargate-profile)」を参照してください。  
**例 5: 名前空間とラベル用のワイルドカードセレクタと、ポッドを起動するサブネットの IDs を使用して EKS Fargate Profile を作成する**  
次の `create-fargate-profile` の例では、複数の名前空間とラベル、およびポッドを起動するサブネットの ID を持つセレクターの EKS Fargate プロファイルを作成します。  

```
aws eks create-fargate-profile \
    --cluster-name my-eks-cluster \
    --pod-execution-role-arn arn:aws:iam::111122223333:role/role-name \
    --fargate-profile-name my-fargate-profile \
    --selectors '[{"namespace": "prod*", "labels": {"labelname*?": "*value1"}}, {"namespace": "*dev*", "labels": {"labelname*?": "*value*"}}]' \
    --subnets '["subnet-09d912bb63ef21b9a", "subnet-04ad87f71c6e5ab4d", "subnet-0e2907431c9988b72"]' \
    --tags '{"eks-fargate-profile-key-1": "value-1" , "eks-fargate-profile-key-2": "value-2"}'
```
出力:  

```
{
    "fargateProfile": {
        "fargateProfileName": "my-fargate-profile",
        "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/e8c72bd6-5966-0bfe-b77b-1802893e5a6f",
        "clusterName": "my-eks-cluster",
        "createdAt": "2024-03-19T13:05:20.550000-04:00",
        "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name",
        "subnets": [
            "subnet-09d912bb63ef21b9a",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-0e2907431c9988b72"
        ],
        "selectors": [
            {
                "namespace": "prod*",
                "labels": {
                    "labelname*?": "*value1"
                }
            },
            {
                "namespace": "*dev*",
                "labels": {
                    "labelname*?": "*value*"
                }
            }
        ],
        "status": "CREATING",
        "tags": {
            "eks-fargate-profile-key-2": "value-2",
            "eks-fargate-profile-key-1": "value-1"
        }
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[AWS Fargate プロファイル - Fargate プロファイルの作成](https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html#create-fargate-profile)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateFargateProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/create-fargate-profile.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、Amazon EKS クラスターの AWS Fargate プロファイルを作成します。Fargate インフラストラクチャでポッドをスケジュールできるようにするには、クラスター内に少なくとも 1 つの Fargate プロファイルが必要です。**  

```
New-EKSFargateProfile -FargateProfileName EKSFargateProfile -ClusterName TEST -Subnet "subnet-02f6ff500ff2067a0", "subnet-0cd976f08d5fbfaae" -PodExecutionRoleArn arn:aws:iam::012345678912:role/AmazonEKSFargatePodExecutionRole -Selector @{Namespace="default"}
```
**出力:**  

```
ClusterName         : TEST
CreatedAt           : 12/26/2019 12:38:21 PM
FargateProfileArn   : arn:aws:eks:us-east-2:012345678912:fargateprofile/TEST/EKSFargateProfile/20b7a11b-8292-41c1-bc56-ffa5e60f6224
FargateProfileName  : EKSFargateProfile
PodExecutionRoleArn : arn:aws:iam::012345678912:role/AmazonEKSFargatePodExecutionRole
Selectors           : {Amazon.EKS.Model.FargateProfileSelector}
Status              : CREATING
Subnets             : {subnet-0cd976f08d5fbfaae, subnet-02f6ff500ff2067a0}
Tags                : {}
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[CreateFargateProfile](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、Amazon EKS クラスターの AWS Fargate プロファイルを作成します。Fargate インフラストラクチャでポッドをスケジュールできるようにするには、クラスター内に少なくとも 1 つの Fargate プロファイルが必要です。**  

```
New-EKSFargateProfile -FargateProfileName EKSFargateProfile -ClusterName TEST -Subnet "subnet-02f6ff500ff2067a0", "subnet-0cd976f08d5fbfaae" -PodExecutionRoleArn arn:aws:iam::012345678912:role/AmazonEKSFargatePodExecutionRole -Selector @{Namespace="default"}
```
**出力:**  

```
ClusterName         : TEST
CreatedAt           : 12/26/2019 12:38:21 PM
FargateProfileArn   : arn:aws:eks:us-east-2:012345678912:fargateprofile/TEST/EKSFargateProfile/20b7a11b-8292-41c1-bc56-ffa5e60f6224
FargateProfileName  : EKSFargateProfile
PodExecutionRoleArn : arn:aws:iam::012345678912:role/AmazonEKSFargatePodExecutionRole
Selectors           : {Amazon.EKS.Model.FargateProfileSelector}
Status              : CREATING
Subnets             : {subnet-0cd976f08d5fbfaae, subnet-02f6ff500ff2067a0}
Tags                : {}
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[CreateFargateProfile](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `CreateNodegroup` を使用する
<a name="eks_example_eks_CreateNodegroup_section"></a>

次のサンプルコードは、`CreateNodegroup` を使用する方法を説明しています。

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

**AWS CLI**  
**例 1: Amazon EKS クラスターのマネージド型ノードグループを作成する**  
次の `create-nodegroup` の例では、Amazon EKS クラスターにマネージド型ノードグループを作成します。  

```
aws eks create-nodegroup \
    --cluster-name my-eks-cluster \
    --nodegroup-name my-eks-nodegroup \
    --node-role arn:aws:iam::111122223333:role/role-name \
    --subnets "subnet-0e2907431c9988b72" "subnet-04ad87f71c6e5ab4d" "subnet-09d912bb63ef21b9a" \
    --scaling-config minSize=1,maxSize=3,desiredSize=1 \
    --region us-east-2
```
出力:  

```
{
    "nodegroup": {
        "nodegroupName": "my-eks-nodegroup",
        "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/bac7550f-b8b8-5fbb-4f3e-7502a931119e",
        "clusterName": "my-eks-cluster",
        "version": "1.26",
        "releaseVersion": "1.26.12-20240329",
        "createdAt": "2024-04-04T13:19:32.260000-04:00",
        "modifiedAt": "2024-04-04T13:19:32.260000-04:00",
        "status": "CREATING",
        "capacityType": "ON_DEMAND",
        "scalingConfig": {
            "minSize": 1,
            "maxSize": 3,
            "desiredSize": 1
        },
        "instanceTypes": [
            "t3.medium"
        ],
        "subnets": [
            "subnet-0e2907431c9988b72, subnet-04ad87f71c6e5ab4d, subnet-09d912bb63ef21b9a"
        ],
        "amiType": "AL2_x86_64",
        "nodeRole": "arn:aws:iam::111122223333:role/role-name",
        "diskSize": 20,
        "health": {
            "issues": []
        },
        "updateConfig": {
            "maxUnavailable": 1
        },
        "tags": {}
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[マネージド型ノードグループの作成](https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html)」を参照してください。  
**例 2: カスタムの instance-types と disk-size のある Amazon EKS クラスターのマネージド型ノードグループを作成する**  
次の `create-nodegroup` の例では、カスタムの instance-types と disk-size のある Amazon EKS クラスターのマネージド型ノードグループを作成します。  

```
aws eks create-nodegroup \
    --cluster-name my-eks-cluster \
    --nodegroup-name my-eks-nodegroup \
    --node-role arn:aws:iam::111122223333:role/role-name \
    --subnets "subnet-0e2907431c9988b72" "subnet-04ad87f71c6e5ab4d" "subnet-09d912bb63ef21b9a" \
    --scaling-config minSize=1,maxSize=3,desiredSize=1 \
    --capacity-type ON_DEMAND \
    --instance-types 'm5.large' \
    --disk-size 50 \
    --region us-east-2
```
出力:  

```
{
    "nodegroup": {
        "nodegroupName": "my-eks-nodegroup",
        "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/c0c7551b-e4f9-73d9-992c-a450fdb82322",
        "clusterName": "my-eks-cluster",
        "version": "1.26",
        "releaseVersion": "1.26.12-20240329",
        "createdAt": "2024-04-04T13:46:07.595000-04:00",
        "modifiedAt": "2024-04-04T13:46:07.595000-04:00",
        "status": "CREATING",
        "capacityType": "ON_DEMAND",
        "scalingConfig": {
            "minSize": 1,
            "maxSize": 3,
            "desiredSize": 1
        },
        "instanceTypes": [
            "m5.large"
        ],
        "subnets": [
            "subnet-0e2907431c9988b72",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-09d912bb63ef21b9a"
        ],
        "amiType": "AL2_x86_64",
        "nodeRole": "arn:aws:iam::111122223333:role/role-name",
        "diskSize": 50,
        "health": {
            "issues": []
        },
        "updateConfig": {
            "maxUnavailable": 1
        },
        "tags": {}
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[マネージド型ノードグループの作成](https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html)」を参照してください。  
**例 3: カスタムの instance-types、disk-size、ami-type、capacity-type、update-config、ラベル、テイント、タグを持つ Amazon EKS クラスターのマネージド型ノードグループを作成する。**  
次の `create-nodegroup` の例では、カスタムの instance-types、disk-size、ami-type、capacity-type、update-config、ラベル、テイント、タグを持つ Amazon EKS クラスターのマネージド型ノードグループを作成します。  

```
aws eks create-nodegroup  \
    --cluster-name my-eks-cluster \
    --nodegroup-name my-eks-nodegroup \
    --node-role arn:aws:iam::111122223333:role/role-name \
    --subnets "subnet-0e2907431c9988b72" "subnet-04ad87f71c6e5ab4d" "subnet-09d912bb63ef21b9a" \
    --scaling-config minSize=1,maxSize=5,desiredSize=4 \
    --instance-types 't3.large' \
    --disk-size 50 \
    --ami-type AL2_x86_64 \
    --capacity-type SPOT \
    --update-config maxUnavailable=2 \
    --labels '{"my-eks-nodegroup-label-1": "value-1" , "my-eks-nodegroup-label-2": "value-2"}' \
    --taints '{"key": "taint-key-1" , "value": "taint-value-1", "effect": "NO_EXECUTE"}' \
    --tags '{"my-eks-nodegroup-key-1": "value-1" , "my-eks-nodegroup-key-2": "value-2"}'
```
出力:  

```
{
    "nodegroup": {
        "nodegroupName": "my-eks-nodegroup",
        "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/88c75524-97af-0cb9-a9c5-7c0423ab5314",
        "clusterName": "my-eks-cluster",
        "version": "1.26",
        "releaseVersion": "1.26.12-20240329",
        "createdAt": "2024-04-04T14:05:07.940000-04:00",
        "modifiedAt": "2024-04-04T14:05:07.940000-04:00",
        "status": "CREATING",
        "capacityType": "SPOT",
        "scalingConfig": {
            "minSize": 1,
            "maxSize": 5,
            "desiredSize": 4
        },
        "instanceTypes": [
            "t3.large"
        ],
        "subnets": [
            "subnet-0e2907431c9988b72",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-09d912bb63ef21b9a"
        ],
        "amiType": "AL2_x86_64",
        "nodeRole": "arn:aws:iam::111122223333:role/role-name",
        "labels": {
            "my-eks-nodegroup-label-2": "value-2",
            "my-eks-nodegroup-label-1": "value-1"
        },
        "taints": [
            {
                "key": "taint-key-1",
                "value": "taint-value-1",
                "effect": "NO_EXECUTE"
            }
        ],
        "diskSize": 50,
        "health": {
            "issues": []
        },
        "updateConfig": {
            "maxUnavailable": 2
        },
        "tags": {
            "my-eks-nodegroup-key-1": "value-1",
            "my-eks-nodegroup-key-2": "value-2"
        }
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[マネージド型ノードグループの作成](https://docs.aws.amazon.com/eks/latest/userguide/create-managed-node-group.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateNodegroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/create-nodegroup.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、Amazon EKS クラスターのマネージド型ワーカーノードグループを作成します。クラスターの現在の Kubernetes バージョンと同じクラスター対してのみノードグループを作成できます。すべてのノードグループは、クラスターのそれぞれのマイナー Kubernetes バージョンの最新の AMI リリースバージョンで作成されます。**  

```
New-EKSNodeGroup -NodeGroupName "ProdEKSNodeGroup" -AmiType "AL2_x86_64" -DiskSize 40 -ClusterName "PROD" -ScalingConfig_DesiredSize 2 -ScalingConfig_MinSize 2 -ScalingConfig_MaxSize 5 -InstanceType t3.large -NodeRole "arn:aws:iam::012345678912:role/NodeInstanceRole" -Subnet "subnet-0d1a9fff35efa7691","subnet-0a3f4928edbc224d4"
```
**出力:**  

```
AmiType        : AL2_x86_64
ClusterName    : PROD
CreatedAt      : 12/25/2019 10:16:45 AM
DiskSize       : 40
Health         : Amazon.EKS.Model.NodegroupHealth
InstanceTypes  : {t3.large}
Labels         : {}
ModifiedAt     : 12/25/2019 10:16:45 AM
NodegroupArn   : arn:aws:eks:us-west-2:012345678912:nodegroup/PROD/ProdEKSNodeGroup/7eb79e47-82b6-04d9-e984-95110db6fa85
NodegroupName  : ProdEKSNodeGroup
NodeRole       : arn:aws:iam::012345678912:role/NodeInstanceRole
ReleaseVersion : 1.14.7-20190927
RemoteAccess   :
Resources      :
ScalingConfig  : Amazon.EKS.Model.NodegroupScalingConfig
Status         : CREATING
Subnets        : {subnet-0d1a9fff35efa7691, subnet-0a3f4928edbc224d4}
Tags           : {}
Version        : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[CreateNodegroup](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、Amazon EKS クラスターのマネージド型ワーカーノードグループを作成します。クラスターの現在の Kubernetes バージョンと同じクラスター対してのみノードグループを作成できます。すべてのノードグループは、クラスターのそれぞれのマイナー Kubernetes バージョンの最新の AMI リリースバージョンで作成されます。**  

```
New-EKSNodeGroup -NodeGroupName "ProdEKSNodeGroup" -AmiType "AL2_x86_64" -DiskSize 40 -ClusterName "PROD" -ScalingConfig_DesiredSize 2 -ScalingConfig_MinSize 2 -ScalingConfig_MaxSize 5 -InstanceType t3.large -NodeRole "arn:aws:iam::012345678912:role/NodeInstanceRole" -Subnet "subnet-0d1a9fff35efa7691","subnet-0a3f4928edbc224d4"
```
**出力:**  

```
AmiType        : AL2_x86_64
ClusterName    : PROD
CreatedAt      : 12/25/2019 10:16:45 AM
DiskSize       : 40
Health         : Amazon.EKS.Model.NodegroupHealth
InstanceTypes  : {t3.large}
Labels         : {}
ModifiedAt     : 12/25/2019 10:16:45 AM
NodegroupArn   : arn:aws:eks:us-west-2:012345678912:nodegroup/PROD/ProdEKSNodeGroup/7eb79e47-82b6-04d9-e984-95110db6fa85
NodegroupName  : ProdEKSNodeGroup
NodeRole       : arn:aws:iam::012345678912:role/NodeInstanceRole
ReleaseVersion : 1.14.7-20190927
RemoteAccess   :
Resources      :
ScalingConfig  : Amazon.EKS.Model.NodegroupScalingConfig
Status         : CREATING
Subnets        : {subnet-0d1a9fff35efa7691, subnet-0a3f4928edbc224d4}
Tags           : {}
Version        : 1.14
```
+  API の詳細については、*AWS Tools for PowerShell コマンドレットリファレンス (V5)* の「[CreateNodegroup](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# AWS SDK または CLI `DeleteCluster`で を使用する
<a name="eks_example_eks_DeleteCluster_section"></a>

次のサンプルコードは、`DeleteCluster` を使用する方法を説明しています。

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

**AWS CLI**  
**Amazon EKS クラスターコントロールプレーンを削除する**  
次の `delete-cluster` の例では、Amazon EKS クラスターコントロールプレーンを削除します。  

```
aws eks delete-cluster \
    --name my-eks-cluster
```
出力:  

```
{
    "cluster": {
        "name": "my-eks-cluster",
        "arn": "arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster",
        "createdAt": "2024-03-14T11:31:44.348000-04:00",
        "version": "1.27",
        "endpoint": "https://DALSJ343KE23J3RN45653DSKJTT647TYD.yl4.us-east-2.eks.amazonaws.com",
        "roleArn": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-cluster-ServiceRole-zMF6CBakwwbW",
        "resourcesVpcConfig": {
            "subnetIds": [
                "subnet-0fb75d2d8401716e7",
                "subnet-02184492f67a3d0f9",
                "subnet-04098063527aab776",
                "subnet-0e2907431c9988b72",
                "subnet-04ad87f71c6e5ab4d",
                "subnet-09d912bb63ef21b9a"
            ],
            "securityGroupIds": [
                "sg-0c1327f6270afbb36"
            ],
            "clusterSecurityGroupId": "sg-01c84d09d70f39a7f",
            "vpcId": "vpc-0012b8e1cc0abb17d",
            "endpointPublicAccess": true,
            "endpointPrivateAccess": true,
            "publicAccessCidrs": [
                "0.0.0.0/0"
            ]
        },
        "kubernetesNetworkConfig": {
            "serviceIpv4Cidr": "10.100.0.0/16",
            "ipFamily": "ipv4"
        },
        "logging": {
            "clusterLogging": [
                {
                    "types": [
                        "api",
                        "audit",
                        "authenticator",
                        "controllerManager",
                        "scheduler"
                    ],
                    "enabled": true
                }
            ]
        },
        "identity": {
            "oidc": {
                "issuer": "https://oidc.eks.us-east-2.amazonaws.com/id/DALSJ343KE23J3RN45653DSKJTT647TYD"
            }
        },
        "status": "DELETING",
        "certificateAuthority": {
            "data": "XXX_CA_DATA_XXX"
        },
        "platformVersion": "eks.16",
        "tags": {
            "aws:cloudformation:stack-name": "eksctl-my-eks-cluster-cluster",
            "alpha.eksctl.io/cluster-name": "my-eks-cluster",
            "karpenter.sh/discovery": "my-eks-cluster",
            "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-2:111122223333:stack/eksctl-my-eks-cluster-cluster/e752ea00-e217-11ee-beae-0a9599c8c7ed",
            "auto-delete": "no",
            "eksctl.cluster.k8s.io/v1alpha1/cluster-name": "my-eks-cluster",
            "EKS-Cluster-Name": "my-eks-cluster",
            "alpha.eksctl.io/cluster-oidc-enabled": "true",
            "aws:cloudformation:logical-id": "ControlPlane",
            "alpha.eksctl.io/eksctl-version": "0.173.0-dev+a7ee89342.2024-03-01T03:40:57Z",
            "Name": "eksctl-my-eks-cluster-cluster/ControlPlane"
        },
        "accessConfig": {
            "authenticationMode": "API_AND_CONFIG_MAP"
        }
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[Amazon EKS クラスターの削除](https://docs.aws.amazon.com/eks/latest/userguide/delete-cluster.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteCluster](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/delete-cluster.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、Amazon EKS クラスターコントロールプレーンを削除します。**  

```
Remove-EKSCluster -Name "DEV-KUBE-CL"
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EKSCluster (DeleteCluster)" on target "DEV-KUBE-CL".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y

Arn                  : arn:aws:eks:us-west-2:012345678912:cluster/DEV-KUBE-CL
CertificateAuthority : Amazon.EKS.Model.Certificate
ClientRequestToken   :
CreatedAt            : 12/25/2019 9:33:25 AM
Endpoint             : https://02E6D31E3E4F8C15D7BE7F58D527776A.yl4.us-west-2.eks.amazonaws.com
Identity             : Amazon.EKS.Model.Identity
Logging              : Amazon.EKS.Model.Logging
Name                 : DEV-KUBE-CL
PlatformVersion      : eks.7
ResourcesVpcConfig   : Amazon.EKS.Model.VpcConfigResponse
RoleArn              : arn:aws:iam::012345678912:role/eks-iam-role
Status               : DELETING
Tags                 : {}
Version              : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DeleteCluster](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、Amazon EKS クラスターコントロールプレーンを削除します。**  

```
Remove-EKSCluster -Name "DEV-KUBE-CL"
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EKSCluster (DeleteCluster)" on target "DEV-KUBE-CL".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y

Arn                  : arn:aws:eks:us-west-2:012345678912:cluster/DEV-KUBE-CL
CertificateAuthority : Amazon.EKS.Model.Certificate
ClientRequestToken   :
CreatedAt            : 12/25/2019 9:33:25 AM
Endpoint             : https://02E6D31E3E4F8C15D7BE7F58D527776A.yl4.us-west-2.eks.amazonaws.com
Identity             : Amazon.EKS.Model.Identity
Logging              : Amazon.EKS.Model.Logging
Name                 : DEV-KUBE-CL
PlatformVersion      : eks.7
ResourcesVpcConfig   : Amazon.EKS.Model.VpcConfigResponse
RoleArn              : arn:aws:iam::012345678912:role/eks-iam-role
Status               : DELETING
Tags                 : {}
Version              : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DeleteCluster](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------
#### [ Rust ]

**SDK for Rust**  
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/rustv1/examples/eks#code-examples)での設定と実行の方法を確認してください。

```
async fn remove_cluster(
    client: &aws_sdk_eks::Client,
    name: &str,
) -> Result<(), aws_sdk_eks::Error> {
    let cluster_deleted = client.delete_cluster().name(name).send().await?;
    println!("cluster deleted: {:?}", cluster_deleted);

    Ok(())
}
```
+  API の詳細については、「*AWS SDK for Rust API リファレンス*」の「[DeleteCluster](https://docs.rs/aws-sdk-eks/latest/aws_sdk_eks/client/struct.Client.html#method.delete_cluster)」を参照してください。

------

# CLI で `DeleteFargateProfile` を使用する
<a name="eks_example_eks_DeleteFargateProfile_section"></a>

次のサンプルコードは、`DeleteFargateProfile` を使用する方法を説明しています。

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

**AWS CLI**  
**例 1: 名前空間を持つセレクターの EKS Fargate プロファイルを作成する**  
次の `delete-fargate-profile` の例では、名前空間を持つセレクターの EKS Fargate Profile を作成します。  

```
aws eks delete-fargate-profile \
    --cluster-name my-eks-cluster \
    --fargate-profile-name my-fargate-profile
```
出力:  

```
{
    "fargateProfile": {
        "fargateProfileName": "my-fargate-profile",
        "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/1ac72bb3-3fc6-2631-f1e1-98bff53bed62",
        "clusterName": "my-eks-cluster",
        "createdAt": "2024-03-19T11:48:39.975000-04:00",
        "podExecutionRoleArn": "arn:aws:iam::111122223333:role/role-name",
        "subnets": [
            "subnet-09d912bb63ef21b9a",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-0e2907431c9988b72"
        ],
        "selectors": [
            {
                "namespace": "default",
                "labels": {
                    "foo": "bar"
                }
            }
        ],
        "status": "DELETING",
        "tags": {}
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[AWS Fargate プロファイル - Fargate の削除](https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html#delete-fargate-profile)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteFargateProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/delete-fargate-profile.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは AWS Fargate プロファイルを削除します。Fargate プロファイルを削除すると、そのプロファイルで Fargate で作成された Fargate 上で実行中のポッドは削除されます。**  

```
Remove-EKSFargateProfile -FargateProfileName "EKSFargate" -ClusterName "TEST"
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EKSFargateProfile (DeleteFargateProfile)" on target "EKSFargate".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y

ClusterName         : TEST
CreatedAt           : 12/26/2019 12:34:47 PM
FargateProfileArn   : arn:aws:eks:us-east-2:012345678912:fargateprofile/TEST/EKSFargate/42b7a119-e16b-a279-ce97-bdf303adec92
FargateProfileName  : EKSFargate
PodExecutionRoleArn : arn:aws:iam::012345678912:role/AmazonEKSFargatePodExecutionRole
Selectors           : {Amazon.EKS.Model.FargateProfileSelector}
Status              : DELETING
Subnets             : {subnet-0cd976f08d5fbfaae, subnet-02f6ff500ff2067a0}
Tags                : {}
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DeleteFargateProfile](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは AWS Fargate プロファイルを削除します。Fargate プロファイルを削除すると、そのプロファイルで Fargate で作成された Fargate 上で実行中のポッドは削除されます。**  

```
Remove-EKSFargateProfile -FargateProfileName "EKSFargate" -ClusterName "TEST"
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EKSFargateProfile (DeleteFargateProfile)" on target "EKSFargate".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y

ClusterName         : TEST
CreatedAt           : 12/26/2019 12:34:47 PM
FargateProfileArn   : arn:aws:eks:us-east-2:012345678912:fargateprofile/TEST/EKSFargate/42b7a119-e16b-a279-ce97-bdf303adec92
FargateProfileName  : EKSFargate
PodExecutionRoleArn : arn:aws:iam::012345678912:role/AmazonEKSFargatePodExecutionRole
Selectors           : {Amazon.EKS.Model.FargateProfileSelector}
Status              : DELETING
Subnets             : {subnet-0cd976f08d5fbfaae, subnet-02f6ff500ff2067a0}
Tags                : {}
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DeleteFargateProfile](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DeleteNodegroup` を使用する
<a name="eks_example_eks_DeleteNodegroup_section"></a>

次のサンプルコードは、`DeleteNodegroup` を使用する方法を説明しています。

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

**AWS CLI**  
**例 1: Amazon EKS クラスターのマネージドノードグループを削除する**  
次の `delete-nodegroup` の例では、Amazon EKS クラスターのマネージド型ノードグループを削除します。  

```
aws eks delete-nodegroup \
    --cluster-name my-eks-cluster \
    --nodegroup-name my-eks-nodegroup
```
出力:  

```
{
    "nodegroup": {
        "nodegroupName": "my-eks-nodegroup",
        "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/1ec75f5f-0e21-dcc0-b46e-f9c442685cd8",
        "clusterName": "my-eks-cluster",
        "version": "1.26",
        "releaseVersion": "1.26.12-20240329",
        "createdAt": "2024-04-08T13:25:15.033000-04:00",
        "modifiedAt": "2024-04-08T13:25:31.252000-04:00",
        "status": "DELETING",
        "capacityType": "SPOT",
        "scalingConfig": {
            "minSize": 1,
            "maxSize": 5,
            "desiredSize": 4
        },
        "instanceTypes": [
            "t3.large"
        ],
        "subnets": [
            "subnet-0e2907431c9988b72",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-09d912bb63ef21b9a"
        ],
        "amiType": "AL2_x86_64",
        "nodeRole": "arn:aws:iam::111122223333:role/role-name",
        "labels": {
            "my-eks-nodegroup-label-2": "value-2",
            "my-eks-nodegroup-label-1": "value-1"
        },
        "taints": [
            {
                "key": "taint-key-1",
                "value": "taint-value-1",
                "effect": "NO_EXECUTE"
            }
        ],
        "diskSize": 50,
        "health": {
            "issues": []
        },
        "updateConfig": {
            "maxUnavailable": 2
        },
        "tags": {
            "my-eks-nodegroup-key-1": "value-1",
            "my-eks-nodegroup-key-2": "value-2"
        }
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteNodegroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/delete-nodegroup.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、クラスターの Amazon EKS ノードグループを削除します。**  

```
Remove-EKSNodegroup -NodegroupName "ProdEKSNodeGroup" -ClusterName "PROD"
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EKSNodegroup (DeleteNodegroup)" on target "ProdEKSNodeGroup".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y

AmiType        : AL2_x86_64
ClusterName    : PROD
CreatedAt      : 12/25/2019 10:16:45 AM
DiskSize       : 40
Health         : Amazon.EKS.Model.NodegroupHealth
InstanceTypes  : {t3.large}
Labels         : {}
ModifiedAt     : 12/25/2019 11:01:16 AM
NodegroupArn   : arn:aws:eks:us-west-2:012345678912:nodegroup/PROD/ProdEKSNodeGroup/7eb79e47-82b6-04d9-e984-95110db6fa85
NodegroupName  : ProdEKSNodeGroup
NodeRole       : arn:aws:iam::012345678912:role/NodeInstanceRole
ReleaseVersion : 1.14.7-20190927
RemoteAccess   :
Resources      : Amazon.EKS.Model.NodegroupResources
ScalingConfig  : Amazon.EKS.Model.NodegroupScalingConfig
Status         : DELETING
Subnets        : {subnet-0d1a9fff35efa7691, subnet-0a3f4928edbc224d4}
Tags           : {}
Version        : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DeleteNodegroup](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、クラスターの Amazon EKS ノードグループを削除します。**  

```
Remove-EKSNodegroup -NodegroupName "ProdEKSNodeGroup" -ClusterName "PROD"
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EKSNodegroup (DeleteNodegroup)" on target "ProdEKSNodeGroup".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y

AmiType        : AL2_x86_64
ClusterName    : PROD
CreatedAt      : 12/25/2019 10:16:45 AM
DiskSize       : 40
Health         : Amazon.EKS.Model.NodegroupHealth
InstanceTypes  : {t3.large}
Labels         : {}
ModifiedAt     : 12/25/2019 11:01:16 AM
NodegroupArn   : arn:aws:eks:us-west-2:012345678912:nodegroup/PROD/ProdEKSNodeGroup/7eb79e47-82b6-04d9-e984-95110db6fa85
NodegroupName  : ProdEKSNodeGroup
NodeRole       : arn:aws:iam::012345678912:role/NodeInstanceRole
ReleaseVersion : 1.14.7-20190927
RemoteAccess   :
Resources      : Amazon.EKS.Model.NodegroupResources
ScalingConfig  : Amazon.EKS.Model.NodegroupScalingConfig
Status         : DELETING
Subnets        : {subnet-0d1a9fff35efa7691, subnet-0a3f4928edbc224d4}
Tags           : {}
Version        : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DeleteNodegroup](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DescribeCluster` を使用する
<a name="eks_example_eks_DescribeCluster_section"></a>

次のサンプルコードは、`DescribeCluster` を使用する方法を説明しています。

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

**AWS CLI**  
**Amazon EKS クラスターでアクティブに実行されている EKS アドオンを記述する**  
次の `describe-cluster` の例では、Amazon EKS クラスターで EKS アドオンをアクティブに実行しています。  

```
aws eks describe-cluster \
    --name my-eks-cluster
```
出力:  

```
{
    "cluster": {
        "name": "my-eks-cluster",
        "arn": "arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster",
        "createdAt": "2024-03-14T11:31:44.348000-04:00",
        "version": "1.26",
        "endpoint": "https://JSA79429HJDASKJDJ8223829MNDNASW.yl4.us-east-2.eks.amazonaws.com",
        "roleArn": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-cluster-ServiceRole-zMF6CBakwwbW",
        "resourcesVpcConfig": {
            "subnetIds": [
                "subnet-0fb75d2d8401716e7",
                "subnet-02184492f67a3d0f9",
                "subnet-04098063527aab776",
                "subnet-0e2907431c9988b72",
                "subnet-04ad87f71c6e5ab4d",
                "subnet-09d912bb63ef21b9a"
            ],
            "securityGroupIds": [
                "sg-0c1327f6270afbb36"
            ],
            "clusterSecurityGroupId": "sg-01c84d09d70f39a7f",
            "vpcId": "vpc-0012b8e1cc0abb17d",
            "endpointPublicAccess": true,
            "endpointPrivateAccess": true,
            "publicAccessCidrs": [
                "22.19.18.2/32"
            ]
        },
        "kubernetesNetworkConfig": {
            "serviceIpv4Cidr": "10.100.0.0/16",
            "ipFamily": "ipv4"
        },
        "logging": {
            "clusterLogging": [
                {
                    "types": [
                        "api",
                        "audit",
                        "authenticator",
                        "controllerManager",
                        "scheduler"
                    ],
                    "enabled": true
                }
            ]
        },
        "identity": {
            "oidc": {
                "issuer": "https://oidc.eks.us-east-2.amazonaws.com/id/JSA79429HJDASKJDJ8223829MNDNASW"
            }
        },
        "status": "ACTIVE",
        "certificateAuthority": {
            "data": "CA_DATA_STRING..."
        },
        "platformVersion": "eks.14",
        "tags": {
            "aws:cloudformation:stack-name": "eksctl-my-eks-cluster-cluster",
            "alpha.eksctl.io/cluster-name": "my-eks-cluster",
            "karpenter.sh/discovery": "my-eks-cluster",
            "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-2:111122223333:stack/eksctl-my-eks-cluster-cluster/e752ea00-e217-11ee-beae-0a9599c8c7ed",
            "auto-delete": "no",
            "eksctl.cluster.k8s.io/v1alpha1/cluster-name": "my-eks-cluster",
            "EKS-Cluster-Name": "my-eks-cluster",
            "alpha.eksctl.io/cluster-oidc-enabled": "true",
            "aws:cloudformation:logical-id": "ControlPlane",
            "alpha.eksctl.io/eksctl-version": "0.173.0-dev+a7ee89342.2024-03-01T03:40:57Z",
            "Name": "eksctl-my-eks-cluster-cluster/ControlPlane"
        },
        "health": {
            "issues": []
        },
        "accessConfig": {
            "authenticationMode": "API_AND_CONFIG_MAP"
        }
    }
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[DescribeCluster](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/describe-cluster.html)」を参照してください。**

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、Amazon EKS クラスターに関する詳細情報を返します。**  

```
Get-EKSCluster -Name "PROD"
```
**出力:**  

```
Arn                  : arn:aws:eks:us-west-2:012345678912:cluster/PROD
CertificateAuthority : Amazon.EKS.Model.Certificate
ClientRequestToken   :
CreatedAt            : 12/25/2019 6:46:17 AM
Endpoint             : https://669608765450FBBE54D1D78A3D71B72C.gr8.us-west-2.eks.amazonaws.com
Identity             : Amazon.EKS.Model.Identity
Logging              : Amazon.EKS.Model.Logging
Name                 : PROD
PlatformVersion      : eks.7
ResourcesVpcConfig   : Amazon.EKS.Model.VpcConfigResponse
RoleArn              : arn:aws:iam::012345678912:role/eks-iam-role
Status               : ACTIVE
Tags                 : {}
Version              : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DescribeCluster](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、Amazon EKS クラスターに関する詳細情報を返します。**  

```
Get-EKSCluster -Name "PROD"
```
**出力:**  

```
Arn                  : arn:aws:eks:us-west-2:012345678912:cluster/PROD
CertificateAuthority : Amazon.EKS.Model.Certificate
ClientRequestToken   :
CreatedAt            : 12/25/2019 6:46:17 AM
Endpoint             : https://669608765450FBBE54D1D78A3D71B72C.gr8.us-west-2.eks.amazonaws.com
Identity             : Amazon.EKS.Model.Identity
Logging              : Amazon.EKS.Model.Logging
Name                 : PROD
PlatformVersion      : eks.7
ResourcesVpcConfig   : Amazon.EKS.Model.VpcConfigResponse
RoleArn              : arn:aws:iam::012345678912:role/eks-iam-role
Status               : ACTIVE
Tags                 : {}
Version              : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DescribeCluster](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DescribeFargateProfile` を使用する
<a name="eks_example_eks_DescribeFargateProfile_section"></a>

次のサンプルコードは、`DescribeFargateProfile` を使用する方法を説明しています。

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

**AWS CLI**  
**Fargate プロファイルを記述する**  
次の `describe-fargate-profile` の例では、Fargate プロファイルについて記述します。  

```
aws eks describe-fargate-profile \
    --cluster-name my-eks-cluster \
    --fargate-profile-name my-fargate-profile
```
出力:  

```
{
    "fargateProfile": {
        "fargateProfileName": "my-fargate-profile",
        "fargateProfileArn": "arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/96c766ce-43d2-f9c9-954c-647334391198",
        "clusterName": "my-eks-cluster",
        "createdAt": "2024-04-11T10:42:52.486000-04:00",
        "podExecutionRoleArn": "arn:aws:iam::111122223333:role/eksctl-my-eks-cluster-farga-FargatePodExecutionRole-1htfAaJdJUEO",
        "subnets": [
            "subnet-09d912bb63ef21b9a",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-0e2907431c9988b72"
        ],
        "selectors": [
            {
                "namespace": "prod*",
                "labels": {
                    "labelname*?": "*value1"
                }
            },
            {
                "namespace": "*dev*",
                "labels": {
                    "labelname*?": "*value*"
                }
            }
        ],
        "status": "ACTIVE",
        "tags": {
            "eks-fargate-profile-key-2": "value-2",
            "eks-fargate-profile-key-1": "value-1"
        }
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeFargateProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/describe-fargate-profile.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、 AWS Fargate プロファイルに関する説明情報を返します。**  

```
Get-EKSFargateProfile -FargateProfileName "EKSFargate" -ClusterName "TEST"
```
**出力:**  

```
ClusterName         : TEST
CreatedAt           : 12/26/2019 12:34:47 PM
FargateProfileArn   : arn:aws:eks:us-east-2:012345678912:fargateprofile/TEST/EKSFargate/42b7a119-e16b-a279-ce97-bdf303adec92
FargateProfileName  : EKSFargate
PodExecutionRoleArn : arn:aws:iam::012345678912:role/AmazonEKSFargatePodExecutionRole
Selectors           : {Amazon.EKS.Model.FargateProfileSelector}
Status              : ACTIVE
Subnets             : {subnet-0cd976f08d5fbfaae, subnet-02f6ff500ff2067a0}
Tags                : {}
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DescribeFargateProfile](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、 AWS Fargate プロファイルに関する説明情報を返します。**  

```
Get-EKSFargateProfile -FargateProfileName "EKSFargate" -ClusterName "TEST"
```
**出力:**  

```
ClusterName         : TEST
CreatedAt           : 12/26/2019 12:34:47 PM
FargateProfileArn   : arn:aws:eks:us-east-2:012345678912:fargateprofile/TEST/EKSFargate/42b7a119-e16b-a279-ce97-bdf303adec92
FargateProfileName  : EKSFargate
PodExecutionRoleArn : arn:aws:iam::012345678912:role/AmazonEKSFargatePodExecutionRole
Selectors           : {Amazon.EKS.Model.FargateProfileSelector}
Status              : ACTIVE
Subnets             : {subnet-0cd976f08d5fbfaae, subnet-02f6ff500ff2067a0}
Tags                : {}
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DescribeFargateProfile](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DescribeNodegroup` を使用する
<a name="eks_example_eks_DescribeNodegroup_section"></a>

次のサンプルコードは、`DescribeNodegroup` を使用する方法を説明しています。

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

**AWS CLI**  
**Amazon EKS クラスターのマネージド型ノードグループを記述する**  
次の `describe-nodegroup` の例では、Amazon EKS クラスターのマネージド型ノードグループについて説明します。  

```
aws eks describe-nodegroup \
    --cluster-name my-eks-cluster \
    --nodegroup-name my-eks-nodegroup
```
出力:  

```
{
    "nodegroup": {
        "nodegroupName": "my-eks-nodegroup",
        "nodegroupArn": "arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-nodegroup/a8c75f2f-df78-a72f-4063-4b69af3de5b1",
        "clusterName": "my-eks-cluster",
        "version": "1.26",
        "releaseVersion": "1.26.12-20240329",
        "createdAt": "2024-04-08T11:42:10.555000-04:00",
        "modifiedAt": "2024-04-08T11:44:12.402000-04:00",
        "status": "ACTIVE",
        "capacityType": "ON_DEMAND",
        "scalingConfig": {
            "minSize": 1,
            "maxSize": 3,
            "desiredSize": 1
        },
        "instanceTypes": [
            "t3.medium"
        ],
        "subnets": [
            "subnet-0e2907431c9988b72",
            "subnet-04ad87f71c6e5ab4d",
            "subnet-09d912bb63ef21b9a"
        ],
        "amiType": "AL2_x86_64",
        "nodeRole": "arn:aws:iam::111122223333:role/role-name",
        "labels": {},
        "resources": {
            "autoScalingGroups": [
                {
                    "name": "eks-my-eks-nodegroup-a8c75f2f-df78-a72f-4063-4b69af3de5b1"
                }
            ]
        },
        "diskSize": 20,
        "health": {
            "issues": []
        },
        "updateConfig": {
            "maxUnavailable": 1
        },
        "tags": {}
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeNodegroup](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/describe-nodegroup.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、Amazon EKS ノードグループに関する詳細情報を返します。**  

```
Get-EKSNodegroup -NodegroupName "ProdEKSNodeGroup" -ClusterName "PROD"
```
**出力:**  

```
AmiType        : AL2_x86_64
ClusterName    : PROD
CreatedAt      : 12/25/2019 10:16:45 AM
DiskSize       : 40
Health         : Amazon.EKS.Model.NodegroupHealth
InstanceTypes  : {t3.large}
Labels         : {}
ModifiedAt     : 12/25/2019 10:16:45 AM
NodegroupArn   : arn:aws:eks:us-west-2:012345678912:nodegroup/PROD/ProdEKSNodeGroup/7eb79e47-82b6-04d9-e984-95110db6fa85
NodegroupName  : ProdEKSNodeGroup
NodeRole       : arn:aws:iam::012345678912:role/NodeInstanceRole
ReleaseVersion : 1.14.7-20190927
RemoteAccess   :
Resources      :
ScalingConfig  : Amazon.EKS.Model.NodegroupScalingConfig
Status         : CREATING
Subnets        : {subnet-0d1a9fff35efa7691, subnet-0a3f4928edbc224d4}
Tags           : {}
Version        : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DescribeNodegroup](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、Amazon EKS ノードグループに関する詳細情報を返します。**  

```
Get-EKSNodegroup -NodegroupName "ProdEKSNodeGroup" -ClusterName "PROD"
```
**出力:**  

```
AmiType        : AL2_x86_64
ClusterName    : PROD
CreatedAt      : 12/25/2019 10:16:45 AM
DiskSize       : 40
Health         : Amazon.EKS.Model.NodegroupHealth
InstanceTypes  : {t3.large}
Labels         : {}
ModifiedAt     : 12/25/2019 10:16:45 AM
NodegroupArn   : arn:aws:eks:us-west-2:012345678912:nodegroup/PROD/ProdEKSNodeGroup/7eb79e47-82b6-04d9-e984-95110db6fa85
NodegroupName  : ProdEKSNodeGroup
NodeRole       : arn:aws:iam::012345678912:role/NodeInstanceRole
ReleaseVersion : 1.14.7-20190927
RemoteAccess   :
Resources      :
ScalingConfig  : Amazon.EKS.Model.NodegroupScalingConfig
Status         : CREATING
Subnets        : {subnet-0d1a9fff35efa7691, subnet-0a3f4928edbc224d4}
Tags           : {}
Version        : 1.14
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DescribeNodegroup](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `DescribeUpdate` を使用する
<a name="eks_example_eks_DescribeUpdate_section"></a>

次のサンプルコードは、`DescribeUpdate` を使用する方法を説明しています。

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

**AWS CLI**  
**例 1: クラスターの更新を記述するには**  
次の `describe-update` の例では、名前の付いたクラスターの更新について記述しています。  

```
aws eks describe-update \
    --name my-eks-cluster \
    --update-id 10bddb13-a71b-425a-b0a6-71cd03e59161
```
出力:  

```
{
    "update": {
        "id": "10bddb13-a71b-425a-b0a6-71cd03e59161",
        "status": "Successful",
        "type": "EndpointAccessUpdate",
        "params": [
            {
                "type": "EndpointPublicAccess",
                "value": "false"
            },
            {
                "type": "EndpointPrivateAccess",
                "value": "true"
            }
        ],
        "createdAt": "2024-03-14T10:01:26.297000-04:00",
        "errors": []
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[Updating an Amazon EKS cluster Kubernetes version](https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html)」を参照してください。  
**例 2: クラスターの更新を記述するには**  
次の `describe-update` の例では、名前の付いたクラスターの更新について記述しています。  

```
aws eks describe-update \
    --name my-eks-cluster \
    --update-id e4994991-4c0f-475a-a040-427e6da52966
```
出力:  

```
{
    "update": {
        "id": "e4994991-4c0f-475a-a040-427e6da52966",
        "status": "Successful",
        "type": "AssociateEncryptionConfig",
        "params": [
            {
                "type": "EncryptionConfig",
                "value": "[{\"resources\":[\"secrets\"],\"provider\":{\"keyArn\":\"arn:aws:kms:region-code:account:key/key\"}}]"
            }
        ],
        "createdAt": "2024-03-14T11:01:26.297000-04:00",
        "errors": []
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[Updating an Amazon EKS cluster Kubernetes version](https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html)」を参照してください。  
**例 3: クラスターの更新を記述するには**  
次の `describe-update` の例では、名前の付いたクラスターの更新について記述しています。  

```
aws eks describe-update \
    --name my-eks-cluster \
    --update-id b5f0ba18-9a87-4450-b5a0-825e6e84496f
```
出力:  

```
{
    "update": {
        "id": "b5f0ba18-9a87-4450-b5a0-825e6e84496f",
        "status": "Successful",
        "type": "VersionUpdate",
        "params": [
            {
                "type": "Version",
                "value": "1.29"
            },
            {
                "type": "PlatformVersion",
                "value": "eks.1"
            }
        ],
        "createdAt": "2024-03-14T12:05:26.297000-04:00",
        "errors": []
    }
}
```
詳細については、「*Amazon EKS ユーザーガイド*」の「[Updating an Amazon EKS cluster Kubernetes version](https://docs.aws.amazon.com/eks/latest/userguide/update-cluster.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[DescribeUpdate](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/describe-update.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、Amazon EKS クラスターまたは関連するマネージドノードグループに対する更新に関する詳細情報を返します。**  

```
Get-EKSUpdate -Name "PROD" -UpdateId "ee708232-7d2e-4ed7-9270-d0b5176f0726"
```
**出力:**  

```
CreatedAt : 12/25/2019 5:03:07 PM
Errors    : {}
Id        : ee708232-7d2e-4ed7-9270-d0b5176f0726
Params    : {Amazon.EKS.Model.UpdateParam}
Status    : Successful
Type      : LoggingUpdate
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[DescribeUpdate](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、Amazon EKS クラスターまたは関連するマネージドノードグループに対する更新に関する詳細情報を返します。**  

```
Get-EKSUpdate -Name "PROD" -UpdateId "ee708232-7d2e-4ed7-9270-d0b5176f0726"
```
**出力:**  

```
CreatedAt : 12/25/2019 5:03:07 PM
Errors    : {}
Id        : ee708232-7d2e-4ed7-9270-d0b5176f0726
Params    : {Amazon.EKS.Model.UpdateParam}
Status    : Successful
Type      : LoggingUpdate
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[DescribeUpdate](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `ListClusters` を使用する
<a name="eks_example_eks_ListClusters_section"></a>

次のサンプルコードは、`ListClusters` を使用する方法を説明しています。

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

**AWS CLI**  
**「my-eks-cluster」という名前の Amazon EKS クラスターにインストールされているすべてのアドオンを一覧表示するには**  
次の `list-clusters` の例では、my-eks-cluster という名前の Amazon EKS クラスターにインストールされているすべてのアドオンを一覧表示します。  

```
aws eks list-clusters
```
出力:  

```
{
    "clusters": [
        "prod",
        "qa",
        "stage",
        "my-eks-cluster"
    ]
}
```
+  API の詳細については、AWS CLI コマンドリファレンスの「[ListClusters](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/list-clusters.html)」を参照してください。**

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、指定されたリージョン AWS アカウント の の Amazon EKS クラスターを一覧表示します。**  

```
Get-EKSClusterList
```
**出力:**  

```
 PROD
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[ListClusters](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、指定されたリージョン AWS アカウント の の Amazon EKS クラスターを一覧表示します。**  

```
Get-EKSClusterList
```
**出力:**  

```
 PROD
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[ListClusters](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `ListFargateProfiles` を使用する
<a name="eks_example_eks_ListFargateProfiles_section"></a>

次のサンプルコードは、`ListFargateProfiles` を使用する方法を説明しています。

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

**AWS CLI**  
**「my-eks-cluster」という名前の Amazon EKS クラスター内のすべての Fargate プロファイルを一覧表示するには**  
次の `list-fargate-profiles` の例では、my-eks-cluster という名前の Amazon EKS クラスター内のすべての Fargate プロファイルを一覧表示します。  

```
aws eks list-fargate-profiles \
    --cluster-name my-eks-cluster
```
出力:  

```
{
    "fargateProfileNames": [
        "my-fargate-profile"
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListFargateProfiles](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/list-fargate-profiles.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、指定されたリージョンの 内の指定されたクラスターに関連付けられた AWS Fargate プロファイル AWS アカウント を一覧表示します。**  

```
Get-EKSFargateProfileList -ClusterName "TEST"
```
**出力:**  

```
EKSFargate
EKSFargateProfile
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[ListFargateProfiles](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、指定されたリージョンの 内の指定されたクラスターに関連付けられた AWS Fargate プロファイル AWS アカウント を一覧表示します。**  

```
Get-EKSFargateProfileList -ClusterName "TEST"
```
**出力:**  

```
EKSFargate
EKSFargateProfile
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[ListFargateProfiles](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `ListNodegroups` を使用する
<a name="eks_example_eks_ListNodegroups_section"></a>

次のサンプルコードは、`ListNodegroups` を使用する方法を説明しています。

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

**AWS CLI**  
**Amazon EKS クラスター内のすべてのノードグループを一覧表示する**  
次の `list-nodegroups` の例では、 Amazon EKS クラスターにすべてのノードグループを一覧表示します。  

```
aws eks list-nodegroups \
    --cluster-name my-eks-cluster
```
出力:  

```
{
    "nodegroups": [
        "my-eks-managed-node-group",
        "my-eks-nodegroup"
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListNodegroups](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/list-nodegroups.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、指定されたリージョンの 内の指定されたクラスターに関連付けられた Amazon EKS ノードグループ AWS アカウント を一覧表示します。 **  

```
Get-EKSNodegroupList -ClusterName PROD
```
**出力:**  

```
 ProdEKSNodeGroup
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[ListNodegroups](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、指定されたリージョンの 内の指定されたクラスターに関連付けられた Amazon EKS ノードグループ AWS アカウント を一覧表示します。 **  

```
Get-EKSNodegroupList -ClusterName PROD
```
**出力:**  

```
 ProdEKSNodeGroup
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[ListNodegroups](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `ListTagsForResource` を使用する
<a name="eks_example_eks_ListTagsForResource_section"></a>

次のサンプルコードは、`ListTagsForResource` を使用する方法を説明しています。

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

**AWS CLI**  
**例 1: Amazon EKS クラスター ARN のすべてのタグを一覧表示するには**  
次の `list-tags-for-resource` の例では、Amazon EKS クラスター ARN のすべてのタグを一覧表示します。  

```
aws eks list-tags-for-resource \
    --resource-arn arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster
```
出力:  

```
{
    "tags": {
        "aws:cloudformation:stack-name": "eksctl-my-eks-cluster-cluster",
        "alpha.eksctl.io/cluster-name": "my-eks-cluster",
        "karpenter.sh/discovery": "my-eks-cluster",
        "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-2:111122223333:stack/eksctl-my-eks-cluster-cluster/e752ea00-e217-11ee-beae-0a9599c8c7ed",
        "auto-delete": "no",
        "eksctl.cluster.k8s.io/v1alpha1/cluster-name": "my-eks-cluster",
        "EKS-Cluster-Name": "my-eks-cluster",
        "alpha.eksctl.io/cluster-oidc-enabled": "true",
        "aws:cloudformation:logical-id": "ControlPlane",
        "alpha.eksctl.io/eksctl-version": "0.173.0-dev+a7ee89342.2024-03-01T03:40:57Z",
        "Name": "eksctl-my-eks-cluster-cluster/ControlPlane"
    }
}
```
**例 2: Amazon EKS ノードグループ ARN のすべてのタグを一覧表示するには**  
次の `list-tags-for-resource` の例では、Amazon EKS ノードグループ ARN のすべてのタグを一覧表示します。  

```
aws eks list-tags-for-resource \
    --resource-arn arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-managed-node-group/60c71ed2-2cfb-020f-a5f4-ad32477f198c
```
出力:  

```
{
    "tags": {
        "aws:cloudformation:stack-name": "eksctl-my-eks-cluster-nodegroup-my-eks-managed-node-group",
        "aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-2:111122223333:stack/eksctl-my-eks-cluster-nodegroup-my-eks-managed-node-group/eaa20310-e219-11ee-b851-0ab9ad8228ff",
        "eksctl.cluster.k8s.io/v1alpha1/cluster-name": "my-eks-cluster",
        "EKS-Cluster-Name": "my-eks-cluster",
        "alpha.eksctl.io/nodegroup-type": "managed",
        "NodeGroup Name 1": "my-eks-managed-node-group",
        "k8s.io/cluster-autoscaler/enabled": "true",
        "nodegroup-role": "worker",
        "alpha.eksctl.io/cluster-name": "my-eks-cluster",
        "alpha.eksctl.io/nodegroup-name": "my-eks-managed-node-group",
        "karpenter.sh/discovery": "my-eks-cluster",
        "NodeGroup Name 2": "AmazonLinux-Linux-Managed-NG-v1-26-v1",
        "auto-delete": "no",
        "k8s.io/cluster-autoscaler/my-eks-cluster": "owned",
        "aws:cloudformation:logical-id": "ManagedNodeGroup",
        "alpha.eksctl.io/eksctl-version": "0.173.0-dev+a7ee89342.2024-03-01T03:40:57Z"
    }
}
```
**例 3: Amazon EKS Fargate プロフィル ARNe のすべてのタグを一覧表示するには**  
次の `list-tags-for-resource` の例では、Amazon EKS Fargate プロファイル ARN のすべてのタグを一覧表示します。  

```
aws eks list-tags-for-resource  \
    --resource-arn arn:aws:eks:us-east-2:111122223333:fargateprofile/my-eks-cluster/my-fargate-profile/d6c76780-e541-0725-c816-36754cab734b
```
出力:  

```
{
    "tags": {
        "eks-fargate-profile-key-2": "value-2",
        "eks-fargate-profile-key-1": "value-1"
    }
}
```
**例 4: Amazon EKS アドオン ARN のすべてのタグを一覧表示するには**  
次の `list-tags-for-resource` の例では、Amazon EKS アドオン ARN のすべてのタグを一覧表示します。  

```
aws eks list-tags-for-resource \
    --resource-arn arn:aws:eks:us-east-2:111122223333:addon/my-eks-cluster/vpc-cni/0ec71efc-98dd-3203-60b0-4b939b2a5e5f
```
出力:  

```
{
    "tags": {
        "eks-addon-key-2": "value-2",
        "eks-addon-key-1": "value-1"
    }
}
```
**例 5: Amazon EKS OIDC ID プロバイダー ARN のすべてのタグを一覧表示するには**  
次の `list-tags-for-resource` の例では、Amazon EKS OIDC ID プロバイダー ARN のすべてのタグを一覧表示します。  

```
aws eks list-tags-for-resource \
    --resource-arn arn:aws:eks:us-east-2:111122223333:identityproviderconfig/my-eks-cluster/oidc/my-identity-provider/8ac76722-78e4-cec1-ed76-d49eea058622
```
出力:  

```
{
    "tags": {
        "my-identity-provider": "test"
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/list-tags-for-resource.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、Amazon EKS リソースのタグを一覧表示します。 **  

```
Get-EKSResourceTag -ResourceArn "arn:aws:eks:us-west-2:012345678912:cluster/PROD"
```
**出力:**  

```
Key  Value
---  -----
Name EKSPRODCLUSTER
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[ListTagsForResource](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、Amazon EKS リソースのタグを一覧表示します。 **  

```
Get-EKSResourceTag -ResourceArn "arn:aws:eks:us-west-2:012345678912:cluster/PROD"
```
**出力:**  

```
Key  Value
---  -----
Name EKSPRODCLUSTER
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[ListTagsForResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `ListUpdates` を使用する
<a name="eks_example_eks_ListUpdates_section"></a>

次のサンプルコードは、`ListUpdates` を使用する方法を説明しています。

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

**AWS CLI**  
**クラスターの更新を一覧表示するには**  
このコマンド例では、デフォルトのリージョンで `example` という名前のクラスターの現在の更新を一覧表示します。  
コマンド:  

```
aws eks list-updates --name example
```
出力:  

```
{
    "updateIds": [
        "10bddb13-a71b-425a-b0a6-71cd03e59161"
    ]
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListUpdates](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/list-updates.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、指定されたリージョンの 内の Amazon EKS クラスターまたはマネージドノードグループに関連付けられた更新 AWS アカウントを一覧表示します。**  

```
Get-EKSUpdateList -Name "PROD"
```
**出力:**  

```
ee708232-7d2e-4ed7-9270-d0b5176f0726
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[ListUpdates](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、指定されたリージョンの 内の Amazon EKS クラスターまたはマネージドノードグループに関連付けられた更新 AWS アカウントを一覧表示します。**  

```
Get-EKSUpdateList -Name "PROD"
```
**出力:**  

```
ee708232-7d2e-4ed7-9270-d0b5176f0726
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5*)」の「[ListUpdates](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `TagResource` を使用する
<a name="eks_example_eks_TagResource_section"></a>

次のサンプルコードは、`TagResource` を使用する方法を説明しています。

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

**AWS CLI**  
**例 1: 指定されたタグを Amazon EKS クラスターに追加するには**  
次の `tag-resource` の例では、指定されたタグを Amazon EKS クラスターに追加します。  

```
aws eks tag-resource \
    --resource-arn arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster \
    --tag 'my-eks-cluster-test-1=test-value-1,my-eks-cluster-dev-1=dev-value-2'
```
このコマンドでは何も出力されません。  
**例 2: 指定されたタグを Amazon EKS ノードグループに追加するには**  
次の `tag-resource` の例では、Amazon EKS ノードグループに指定されたタグを追加します。  

```
aws eks tag-resource \
    --resource-arn arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-managed-node-group/60c71ed2-2cfb-020f-a5f4-ad32477f198c \
    --tag 'my-eks-nodegroup-test-1=test-value-1,my-eks-nodegroup-dev-1=dev-value-2'
```
このコマンドでは何も出力されません。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/tag-resource.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、指定されたタグを、指定された resourceArn を持つリソースに関連付けます。**  

```
Add-EKSResourceTag -ResourceArn "arn:aws:eks:us-west-2:012345678912:cluster/PROD" -Tag @{Name = "EKSPRODCLUSTER"}
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[TagResource](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、指定されたタグを、指定された resourceArn を持つリソースに関連付けます。**  

```
Add-EKSResourceTag -ResourceArn "arn:aws:eks:us-west-2:012345678912:cluster/PROD" -Tag @{Name = "EKSPRODCLUSTER"}
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[TagResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `UntagResource` を使用する
<a name="eks_example_eks_UntagResource_section"></a>

次のサンプルコードは、`UntagResource` を使用する方法を説明しています。

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

**AWS CLI**  
**例 1: Amazon EKS クラスターから指定されたタグを削除するには**  
次の `untag-resource` の例は、指定されたタグを Amazon EKS クラスターから削除します。  

```
aws eks untag-resource \
    --resource-arn arn:aws:eks:us-east-2:111122223333:cluster/my-eks-cluster \
    --tag-keys "my-eks-cluster-test-1" "my-eks-cluster-dev-1"
```
このコマンドでは何も出力されません。  
**例 2: Amazon EKS ノードグループから指定されたタグを削除するには**  
次の `untag-resource` の例では、Amazon EKS ノードグループから指定されたタグを削除します。  

```
aws eks untag-resource \
    --resource-arn arn:aws:eks:us-east-2:111122223333:nodegroup/my-eks-cluster/my-eks-managed-node-group/60c71ed2-2cfb-020f-a5f4-ad32477f198c \
    --tag-keys "my-eks-nodegroup-test-1" "my-eks-nodegroup-dev-1"
```
このコマンドでは何も出力されません。  
+  API の詳細については、「AWS CLI コマンドリファレンス」の「[UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/untag-resource.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、EKS リソースから指定されたタグを削除します。**  

```
Remove-EKSResourceTag -ResourceArn "arn:aws:eks:us-west-2:012345678912:cluster/PROD" -TagKey "Name"
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EKSResourceTag (UntagResource)" on target "arn:aws:eks:us-west-2:012345678912:cluster/PROD".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[UntagResource](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、EKS リソースから指定されたタグを削除します。**  

```
Remove-EKSResourceTag -ResourceArn "arn:aws:eks:us-west-2:012345678912:cluster/PROD" -TagKey "Name"
```
**出力:**  

```
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-EKSResourceTag (UntagResource)" on target "arn:aws:eks:us-west-2:012345678912:cluster/PROD".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): Y
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[UntagResource](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `UpdateClusterConfig` を使用する
<a name="eks_example_eks_UpdateClusterConfig_section"></a>

次のサンプルコードは、`UpdateClusterConfig` を使用する方法を説明しています。

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

**AWS CLI**  
**クラスターエンドポイントアクセスを更新するには**  
このコマンド例では、クラスターを更新してエンドポイントのパブリックアクセスを無効にし、プライベートエンドポイントアクセスを有効にします。  
コマンド:  

```
aws eks update-cluster-config --name example \
--resources-vpc-config endpointPublicAccess=false,endpointPrivateAccess=true
```
出力:  

```
{
    "update": {
        "id": "ec883c93-2e9e-407c-a22f-8f6fa6e67d4f",
        "status": "InProgress",
        "type": "EndpointAccessUpdate",
        "params": [
            {
                "type": "EndpointPublicAccess",
                "value": "false"
            },
            {
                "type": "EndpointPrivateAccess",
                "value": "true"
            }
        ],
        "createdAt": 1565806986.506,
        "errors": []
    }
}
```
**クラスターのログ記録を有効にするには**  
このコマンド例では、`example` という名前のクラスターのすべてのクラスターコントロールプレーンのログ記録タイプを有効にします。  
コマンド:  

```
aws eks update-cluster-config --name example \
--logging '{"clusterLogging":[{"types":["api","audit","authenticator","controllerManager","scheduler"],"enabled":true}]}'
```
出力:  

```
{
    "update": {
        "id": "7551c64b-1d27-4b1e-9f8e-c45f056eb6fd",
        "status": "InProgress",
        "type": "LoggingUpdate",
        "params": [
            {
                "type": "ClusterLogging",
                "value": "{\"clusterLogging\":[{\"types\":[\"api\",\"audit\",\"authenticator\",\"controllerManager\",\"scheduler\"],\"enabled\":true}]}"
            }
        ],
        "createdAt": 1565807210.37,
        "errors": []
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateClusterConfig](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/eks/update-cluster-config.html)」を参照してください。

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

**Tools for PowerShell V4**  
**例 1: Amazon EKS クラスター設定を更新します。更新中もクラスターは引き続き機能します。**  

```
Update-EKSClusterConfig -Name "PROD" -Logging_ClusterLogging @{Types="api","audit","authenticator","controllerManager","scheduler",Enabled="True"}
```
**出力:**  

```
CreatedAt : 12/25/2019 5:03:07 PM
Errors    : {}
Id        : ee708232-7d2e-4ed7-9270-d0b5176f0726
Params    : {Amazon.EKS.Model.UpdateParam}
Status    : InProgress
Type      : LoggingUpdate
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V4)*」の「[UpdateClusterConfig](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: Amazon EKS クラスター設定を更新します。更新中もクラスターは引き続き機能します。**  

```
Update-EKSClusterConfig -Name "PROD" -Logging_ClusterLogging @{Types="api","audit","authenticator","controllerManager","scheduler",Enabled="True"}
```
**出力:**  

```
CreatedAt : 12/25/2019 5:03:07 PM
Errors    : {}
Id        : ee708232-7d2e-4ed7-9270-d0b5176f0726
Params    : {Amazon.EKS.Model.UpdateParam}
Status    : InProgress
Type      : LoggingUpdate
```
+  API の詳細については、「*AWS Tools for PowerShell コマンドレットリファレンス (V5)*」の「[UpdateClusterConfig](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------

# CLI で `UpdateClusterVersion` を使用する
<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 ユーザーガイド*」の「[Updating an Amazon EKS cluster Kubernetes version](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 ]

**Tools for PowerShell V4**  
**例 1: このコマンドレットは、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 コマンドレットリファレンス (V4)*」の「[UpdateClusterVersion](https://docs.aws.amazon.com/powershell/v4/reference)」を参照してください。

**Tools for PowerShell V5**  
**例 1: このコマンドレットは、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 コマンドレットリファレンス (V5)* の「[UpdateClusterVersion](https://docs.aws.amazon.com/powershell/v5/reference)」を参照してください。

------