

 **このページの改善にご協力ください** 

このユーザーガイドに貢献するには、すべてのページの右側のペインにある「**GitHub でこのページを編集する**」リンクを選択してください。

# EKS Auto Mode の組織コントロールを更新する
<a name="auto-controls"></a>

一部の組織コントロールは、EKS Auto Mode の正常な機能を妨げる場合があります。その場合、これらのコントロールを更新し、EKS Auto Mode がユーザーに代わって EC2 インスタンスを管理するために必要なアクセス許可を持てるようにする必要があります。

EKS Auto Mode には、EKS Auto Mode ノードをバックアップする EC2 インスタンスを起動するためのサービスロールが使用されます。サービスロールはユーザーの名義で作成された [IAM ロール](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)であり、サービスがユーザーに代わってアクションを実行するために引き受けます。[サービスコントロールポリシー](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html) (SCP) はサービスロールで実行されるアクションに常に適用されます。SCP が自動モードのオペレーションを禁止できるようにします。最も一般的なケースは、SCP を使用して起動できる Amazon マシンイメージ (AMI) を制限する場合です。EKS Auto Mode を機能させるには、SCP を変更して EKS Auto Mode アカウントから AMI の起動を許可します。

[EC2 が許可された AMI](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-allowed-amis.html) 機能を使用し、他のアカウントで AMI の可視性を制限することもできます。この機能を使用する場合、対象リージョンに EKS Auto Mode AMI アカウントも含めるため、イメージ条件を拡張する必要があります。

## EKS Auto Mode AMI を除くすべての AMI をブロックする SCP の例
<a name="_example_scp_to_block_all_amis_except_for_eks_auto_mode_amis"></a>

以下の SCP では、AMI が us-west-2 または us-east-1 の EKS Auto Mode AMI アカウントに属していない限り、`ec2:RunInstances` の呼び出しが防止されます。

**注記**  
`ec2:Owner` コンテキストキーを使用**しない**ことが重要です。Amazon は EKS Auto Mode AMI アカウントを所有しており、このキーの値は常に `amazon` になります。`ec2:Owner` が `amazon` の場合に AMI の起動を許可する SCP を構築すると、EKS Auto Mode 用の AMI だけでなく、Amazon が所有する AMI の起動も許可されます。\*

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "DenyAMI",
      "Effect": "Deny",
      "Action": "ec2:RunInstances",
      "Resource": "arn:*:ec2:*::image/ami-*",
      "Condition": {
        "StringNotEquals": {
          "aws:ResourceAccount": [
            "767397842682",
            "992382739861"
          ]
        }
      }
    }
  ]
}
```

## EKS Auto Mode AMI アカウント
<a name="_eks_auto_mode_ami_accounts"></a>

 リージョンによって異なる AWS アカウントは、EKS Auto Mode パブリック AMI をホストします。


|  |  | 
| --- |--- |
|  AWS リージョン | アカウント | 
| af-south-1 | 471112993317 | 
| ap-east-1 | 590183728416 | 
| ap-east-2 | 381492200852 | 
| ap-northeast-1 | 851725346105 | 
| ap-northeast-2 | 992382805010 | 
| ap-northeast-3 | 891377407544 | 
| ap-south-1 | 975049899075 | 
| ap-south-2 | 590183737426 | 
| ap-southeast-1 | 339712723301 | 
| ap-southeast-2 | 058264376476 | 
| ap-southeast-3 | 471112941769 | 
| ap-southeast-4 | 590183863144 | 
| ap-southeast-5 | 654654202513 | 
| ap-southeast-6 | 905418310314 | 
| ap-southeast-7 | 533267217478 | 
| ca-central-1 | 992382439851 | 
| ca-west-1 | 767397959864 | 
| eu-central-1 | 891376953411 | 
| eu-central-2 | 381492036002 | 
| eu-north-1 | 339712696471 | 
| eu-south-1 | 975049955519 | 
| eu-south-2 | 471112620929 | 
| eu-west-1 | 381492008532 | 
| eu-west-2 | 590184142468 | 
| eu-west-3 | 891376969258 | 
| il-central-1 | 590183797093 | 
| me-central-1 | 637423494195 | 
| me-south-1 | 905418070398 | 
| mx-central-1 | 211125506622 | 
| sa-east-1 | 339712709251 | 
| us–east–1 | 992382739861 | 
| us-east-2 | 975050179949 | 
| us-west-1 | 975050035094 | 
| us-west-2 | 767397842682 | 
| us-gov-east-1 | 446077414359 | 
| us-gov-west-1 | 446098668741 | 

## パブリック IP アドレスの関連付け
<a name="_associate_public_ip_address"></a>

`ec2:RunInstances` が呼び出されると、インスタンス起動の `AssociatePublicIpAddress` フィールドは、インスタンスが起動されるサブネットのタイプによって自動的に決定されます。SCP を使用すると、起動するサブネットのタイプに関係なく、この値を明示的に false に設定することができます。この場合、SCP の要件を満たすために NodeClass フィールド `spec.advancedNetworking.associatePublicIPAddress` を false に設定することもできます。

```
  {
        "Sid": "DenyPublicEC2IPAddesses",
        "Effect": "Deny",
        "Action": "ec2:RunInstances",
        "Resource": "arn:aws:ec2:*:*:network-interface/*",
        "Condition": {
            "BoolIfExists": {
                "ec2:AssociatePublicIpAddress": "true"
            }
        }
    }
```