

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

# AWS CodeDeploy の マネージド (事前定義) ポリシー
<a name="managed-policies"></a>

AWS は、 によって作成および管理されるスタンドアロン IAM ポリシーを提供することで、多くの一般的なユースケースに対処します AWS。これらの AWS管理ポリシーは、一般的なユースケースのアクセス許可を付与するため、どのアクセス許可が必要かを調査する必要がなくなります。詳細については、「**IAM ユーザーガイド」の「[AWS マネージドポリシー](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)」を参照してください。

**Topics**
+ [CodeDeploy の AWS マネージドポリシーのリスト](#managed-policies-list)
+ [CodeDeploy のマネージドポリシーと通知](#notifications-permissions)

## CodeDeploy の AWS マネージドポリシーのリスト
<a name="managed-policies-list"></a>

アカウントのユーザーにアタッチできる以下の AWS 管理ポリシーは、CodeDeploy に固有のものです。
+ `AWSCodeDeployFullAccess`: CodeDeploy への全面的なアクセス権を付与します。

   
**注記**  
AWSCodeDeployFullAccess は、Amazon EC2 や Amazon S3 などのアプリケーションをデプロイするために必要な他のサービスの操作にアクセス権限を提供しません。CodeDeploy に固有の操作にのみアクセス権限を提供します。
+ `AWSCodeDeployDeployerAccess`: リビジョンを登録してデプロイする権限を許可します。

   
+ `AWSCodeDeployReadOnlyAccess`: CodeDeploy への読み取り専用アクセス権を付与します。

   
+ <a name="ACD-policy"></a>`AWSCodeDeployRole`: CodeDeploy に以下を許可します
  + インスタンスのタグを読み取る、または Amazon EC2 Auto Scaling グループ名により Amazon EC2 インスタンスを識別する
  + Amazon EC2 Auto Scaling グループ、ライフサイクルフック、スケーリングポリシー、ウォームプールの機能の読み取り、作成、更新、削除を行う
  + Amazon SNS トピックに情報を公開
  + Amazon CloudWatch アラームに関する基本的な情報を取得
  + Elastic Load Balancing サービスでのリソースの読み取りと更新

  ポリシーには、次の規定が含まれます。

------
#### [ JSON ]

****  

  ```
  {
    "Version":"2012-10-17",		 	 	 
    "Statement": [
      {
        "Effect": "Allow",
        "Action": [
          "autoscaling:CompleteLifecycleAction",
          "autoscaling:DeleteLifecycleHook",
          "autoscaling:DescribeAutoScalingGroups",
          "autoscaling:DescribeLifecycleHooks",
          "autoscaling:PutLifecycleHook",
          "autoscaling:RecordLifecycleActionHeartbeat",
          "autoscaling:CreateAutoScalingGroup",
          "autoscaling:CreateOrUpdateTags",
          "autoscaling:UpdateAutoScalingGroup",
          "autoscaling:EnableMetricsCollection",
          "autoscaling:DescribePolicies",
          "autoscaling:DescribeScheduledActions",
          "autoscaling:DescribeNotificationConfigurations",
          "autoscaling:SuspendProcesses",
          "autoscaling:ResumeProcesses",
          "autoscaling:AttachLoadBalancers",
          "autoscaling:AttachLoadBalancerTargetGroups",
          "autoscaling:PutScalingPolicy",
          "autoscaling:PutScheduledUpdateGroupAction",
          "autoscaling:PutNotificationConfiguration",
          "autoscaling:DescribeScalingActivities",
          "autoscaling:DeleteAutoScalingGroup",
          "autoscaling:PutWarmPool",
          "ec2:DescribeInstances",
          "ec2:DescribeInstanceStatus",
          "ec2:TerminateInstances",
          "tag:GetResources",
          "sns:Publish",
          "cloudwatch:DescribeAlarms",
          "cloudwatch:PutMetricAlarm",
          "elasticloadbalancing:DescribeLoadBalancers",
          "elasticloadbalancing:DescribeLoadBalancerAttributes",
          "elasticloadbalancing:DescribeInstanceHealth",
          "elasticloadbalancing:RegisterInstancesWithLoadBalancer",
          "elasticloadbalancing:DeregisterInstancesFromLoadBalancer",
          "elasticloadbalancing:DescribeTargetGroups",
          "elasticloadbalancing:DescribeTargetGroupAttributes",
          "elasticloadbalancing:DescribeTargetHealth",
          "elasticloadbalancing:RegisterTargets",
          "elasticloadbalancing:DeregisterTargets"
        ],
        "Resource": "*"
      }
    ]
  }
  ```

------

   
+ `AWSCodeDeployRoleForLambda`: CodeDeploy に、デプロイに必要な AWS Lambda およびその他のリソースへのアクセス許可を付与します。

   
+  `AWSCodeDeployRoleForECS`: CodeDeploy に Amazon ECS およびデプロイに必要なその他のリソースへのアクセス許可を付与します。

   
+  `AWSCodeDeployRoleForECSLimited`: CodeDeploy に Amazon ECS およびデプロイに必要なその他のリソースへのアクセス許可を付与します。ただし、下記を例外とします。
  +  AppSpec ファイルの `hooks` セクションでは、名前が `CodeDeployHook_` で始まる Lambda 関数のみを使用できます。詳細については、「[Amazon ECS のデプロイ向けの AppSpec の「hooks」セクション](reference-appspec-file-structure-hooks.md#appspec-hooks-ecs)」を参照してください。
  +  S3 バケットへのアクセスは、`UseWithCodeDeploy` の値の登録タグを持つ `true` で S3 バケットに限定されます。詳細については、「[オブジェクトのタグ付け](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)」を参照してください。
+ <a name="EC2-policy"></a>`AmazonEC2RoleforAWSCodeDeployLimited`: CodeDeploy Amazon S3 バケット内のオブジェクトを取得および一覧表示のアクセス権限を CodeDeploy に付与します。ポリシーには、次の規定が含まれます。

------
#### [ JSON ]

****  

  ```
  {
      "Version":"2012-10-17",		 	 	 
      "Statement": [
          {
              "Effect": "Allow",
              "Action": [
                  "s3:GetObject",
                  "s3:GetObjectVersion",
                  "s3:ListBucket"
              ],
              "Resource": "arn:aws:s3:::*/CodeDeploy/*"
          },
          {
              "Effect": "Allow",
              "Action": [
                  "s3:GetObject",
                  "s3:GetObjectVersion"
              ],
              "Resource": "*",
              "Condition": {
                  "StringEquals": {
                      "s3:ExistingObjectTag/UseWithCodeDeploy": "true"
                  }
              }
          }
      ]
  }
  ```

------

デプロイプロセスの一部に対するアクセス許可は、CodeDeploy を代行する他の 2 つのロールタイプに付与されます。
+ *IAM インスタンスプロファイル*は、Amazon EC2 インスタンス にアタッチする IAM ロールです。このプロファイルには、アプリケーションが保存される Amazon S3 バケットまたは GitHub リポジトリへのアクセスに必要な権限が含まれます。詳細については、「[ステップ 4: Amazon EC2 インスタンス用の IAM インスタンスプロファイルを作成する](getting-started-create-iam-instance-profile.md)」を参照してください。
+ *サービスロール*は、 AWS リソースにアクセスできるように AWS サービスにアクセス許可を付与する IAM ロールです。サービスロールにアタッチするポリシーによって、サービスがアクセスできる AWS リソースと、それらのリソースで実行できるアクションが決まります。CodeDeploy では、サービスロールは、以下の目的で使用されます。
  + インスタンスに適用されているタグやインスタンスに関連付けられている Amazon EC2 Auto Scaling グループ名を読み取ることができます。これにより、CodeDeploy はアプリケーションをデプロイできるインスタンスを識別できます。
  + インスタンス、Amazon EC2 Auto Scaling グループ、および Elastic Load Balancing ロードバランサーでオペレーションを実行するには。
  + 指定したデプロイまたはインスタンスイベントが発生したときに通知を送信できるように、Amazon SNS トピックに情報を公開すること。
  + CloudWatch アラームに関する情報を取得して、デプロイのアラームモニタリングを設定します。

  その他の詳細については、「[ステップ 2: CodeDeployのサービスのロールを作成する](getting-started-create-service-role.md)」を参照してください。

カスタム IAM ポリシーを作成して、CodeDeploy アクションとリソースのアクセス許可を付与することもできます。こうしたカスタムポリシーを IAM ロールにアタッチし、ロールをアクセス許可が必要なユーザーまたはグループに割り当てます。

## CodeDeploy のマネージドポリシーと通知
<a name="notifications-permissions"></a>

CodeDeploy は、デプロイへの重要な変更をユーザーに知らせるための通知をサポートしています。CodeDeploy のマネージドポリシーには、通知機能のポリシーステートメントが含まれます。詳細については、[通知とは](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/welcome.html) を参照してください。

### フルアクセスマネージドポリシー内の通知へのアクセス許可
<a name="notifications-fullaccess"></a>

`AWSCodeDeployFullAccess` マネージドポリシーには、通知へのフルアクセスを許可する次のステートメントが含まれています。このマネージドポリシーが適用されたユーザーは、Amazon SNS 通知関連トピックの作成と管理、トピックへのユーザーの登録および登録解除、そして通知ルールのターゲットとして選択するトピックの一覧表示を行うことができます。

```
    {
        "Sid": "CodeStarNotificationsReadWriteAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:CreateNotificationRule",
            "codestar-notifications:DescribeNotificationRule",
            "codestar-notifications:UpdateNotificationRule",
            "codestar-notifications:DeleteNotificationRule",
            "codestar-notifications:Subscribe",
            "codestar-notifications:Unsubscribe"
        ],
        "Resource": "*",
        "Condition" : {
            "ArnLike" : {"codestar-notifications:NotificationsForResource" : "arn:aws:codedeploy:*:*:application:*"} 
        }
    },    
    {
        "Sid": "CodeStarNotificationsListAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:ListNotificationRules",
            "codestar-notifications:ListTargets",
            "codestar-notifications:ListTagsforResource"
        ],
        "Resource": "*"
    },
    {
        "Sid": "CodeStarNotificationsSNSTopicCreateAccess",
        "Effect": "Allow",
        "Action": [
            "sns:CreateTopic",
            "sns:SetTopicAttributes"
        ],
        "Resource": "arn:aws:sns:*:*:codestar-notifications*"
    },
    {
      "Sid" : "CodeStarNotificationsChatbotAccess",
      "Effect" : "Allow",
      "Action" : [
        "chatbot:DescribeSlackChannelConfigurations"
      ],
      "Resource" : "*"
    },
    {
        "Sid": "SNSTopicListAccess",
        "Effect": "Allow",
        "Action": [
            "sns:ListTopics"
        ],
        "Resource": "*"
    }
```

### 読み取り専用マネージドポリシー内の通知へのアクセス許可
<a name="notifications-readonly"></a>

`AWSCodeDeployReadOnlyAccess` マネージドポリシーには、通知への読み取り専用アクセスを許可する以下のステートメントが含まれています。このマネージドポリシーが適用されたユーザーは、リソースの通知を表示することはできますが、リソースの作成や管理、リソースへのサブスクライブを行うことはできません。

```
   {
        "Sid": "CodeStarNotificationsPowerUserAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:DescribeNotificationRule"
        ],
        "Resource": "*",
        "Condition" : {
            "ArnLike" : {"codestar-notifications:NotificationsForResource" : "arn:aws:codedeploy:*:*:application:*"} 
        }
    },    
    {
        "Sid": "CodeStarNotificationsListAccess",
        "Effect": "Allow",
        "Action": [
            "codestar-notifications:ListNotificationRules"
        ],
        "Resource": "*"
    }
```

### その他のマネージドポリシーの通知に関連するアクセス許可
<a name="notifications-deployer"></a>

`AWSCodeDeployDeployerAccess` マネージドポリシーには、ユーザーがリソースの通知を作成、更新、サブスクライブ、表示することを許可する以下のステートメントが含まれていますが、削除することはできません。このマネージドポリシーが適用されたユーザーは、通知の Amazon SNS トピックを作成および管理することもできます。

このポリシーには以下を実行するための許可が含まれます。
+ `codestar-notifications:CreateNotificationRule` – プリンシパルが通知を作成できるようにします。
+ `codestar-notifications:DescribeNotificationRule` — プリンシパルが通知に関する情報を取得できるようにします。
+ `codestar-notifications:UpdateNotificationRule` – プリンシパルが通知を更新できるようにします。
+ `codestar-notifications:Subscribe` – プリンシパルが通知更新をサブスクライブできるようにします。
+ `codestar-notifications:Unsubscribe` – プリンシパルが通知更新のサブスクリプションを解除できるようにします。
+ `codestar-notifications:ListNotificationRules` – プリンシパルが通知ルールのリストを取得できるようにします。
+ `codestar-notifications:ListTargets` – プリンシパルがターゲットのリストを取得できるようにします。
+ `codestar-notifications:ListTagsforResource` – プリンシパルがタグのリストを取得できるようにします。
+ `codestar-notifications:ListEventTypes` – プリンシパルがイベントタイプのリストを取得できるようにします。
+ `chatbot:DescribeSlackChannelConfiguration` - プリンシパルがスタックチャネル設定に関する情報を取得できるようにします。
+ `sns:ListTopics` – プリンシパルが通知用の Amazon SNS トピックのリストを取得できるようにします。

```
   {
      "Sid" : "CodeStarNotificationsReadWriteAccess",
      "Effect" : "Allow",
      "Action" : [
        "codestar-notifications:CreateNotificationRule",
        "codestar-notifications:DescribeNotificationRule",
        "codestar-notifications:UpdateNotificationRule",
        "codestar-notifications:Subscribe",
        "codestar-notifications:Unsubscribe"
      ],
      "Resource" : "*",
      "Condition" : {
        "ArnLike" : {
          "codestar-notifications:NotificationsForResource" : "arn:aws:codedeploy:*:*:application:*"
        }
      }
    },
    {
      "Sid" : "CodeStarNotificationsListAccess",
      "Effect" : "Allow",
      "Action" : [
        "codestar-notifications:ListNotificationRules",
        "codestar-notifications:ListTargets",
        "codestar-notifications:ListTagsforResource",
        "codestar-notifications:ListEventTypes"
      ],
      "Resource" : "*"
    },
    {
      "Sid" : "CodeStarNotificationsChatbotAccess",
      "Effect" : "Allow",
      "Action" : [
        "chatbot:DescribeSlackChannelConfigurations"
      ],
      "Resource" : "*"
    },
    {
      "Sid" : "SNSTopicListAccess",
      "Effect" : "Allow",
      "Action" : [
        "sns:ListTopics"
      ],
      "Resource" : "*"
    }
```

詳細については、「[AWS CodeStar Notifications の Identity and Access Management](https://docs.aws.amazon.com/codestar-notifications/latest/userguide/security-iam.html)」を参照してください。