Code Day's Night

ichikawayのブログ

Route53のDNSレコード操作のみ許可するIAMロール

Route53を操作するIAMで、下記の要件を満たすロール設定

  • コンソール画面での操作を想定
  • 特定ゾーンのみのレコードの作成、更新、削除を許可
  • ゾーン一覧の表示
  • ゾーンの削除は不可
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "route53:GetHostedZone",
                "route53:ListHostedZonesByName",
                "route53:ListResourceRecordSets",
                "route53:ChangeResourceRecordSets",
                "route53:ListTagsForResource",
                "route53:ListTagsForResources"
            ],
            "Resource": [
                "arn:aws:route53:::hostedzone/Z3PYYYYYY",
                "arn:aws:route53:::hostedzone/Z3PXXXXXX"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "route53:ListHostedZones"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Resourceの arn:aws:route53:::hostedzone/Z3PYYYYYY は、アクセスを許可したいドメインのホストゾーンIDを記載する。今回は2つのゾーンを許可している。

Route53の管理ページで、ゾーンの一覧が表示できないとコンソールでの操作が面倒(ゾーンIDを含むURLに直接遷移が必要)なため、 route53:ListHostedZonesを全てのリソース*で許可する。
全てのリソースで許可する理由は、route53:ListHostedZonesは、リソースの範囲を特定ゾーンに絞れないため。

参考URL docs.aws.amazon.com