LoginSignup
2
0

CloudWatchAgentAdminPolicyとCloudWatchAgentServerPolicyの違いを調べた

Posted at

CloudWatchへログやメトリクスを送信するため、AWSリソースに(のロールに)IAMポリシーを付与する必要がありますが、CloudWatchAgentAdminPolicyとCloudWatchAgentServerPolicyという似たようなやつがあり、その違いを調べてみた。

結論から言うと

・CloudWatchAgentAdminPolicyはCloudWatchAgentServerPolicyより権限が大きく、ssm:PutParameterが許可される
・最初の何かのセットアップ時に(何かの設定ファイルの書き込み?)、ssm:PutParameterが必要なので、CloudWatchAgentAdminPolicyが必要となり、
 運用時はもうssm:PutParameterが要らないらしく、cloudwatch:PutMetricDatalogs:PutLogEventsのあるCloudWatchAgentServerPolicyだけでOKとのことでした。

CloudWatchAgentAdminPolicyの中身

CloudWatchAgentAdminPolicy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "cloudwatch:PutMetricData",
                "ec2:DescribeTags",
                "logs:PutLogEvents",
                "logs:DescribeLogStreams",
                "logs:DescribeLogGroups",
                "logs:CreateLogStream",
                "logs:CreateLogGroup"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ssm:GetParameter",
                "ssm:PutParameter"#←ここだけ違う
            ],
            "Resource": "arn:aws:ssm:*:*:parameter/AmazonCloudWatch-*"
        }
    ]
}

CloudWatchAgentServerPolicyの中身

CloudWatchAgentServerPolicy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "cloudwatch:PutMetricData",
                "ec2:DescribeVolumes",
                "ec2:DescribeTags",
                "logs:PutLogEvents",
                "logs:DescribeLogStreams",
                "logs:DescribeLogGroups",
                "logs:CreateLogStream",
                "logs:CreateLogGroup"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ssm:GetParameter"
            ],
            "Resource": "arn:aws:ssm:*:*:parameter/AmazonCloudWatch-*"
        }
    ]
}
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0