首页 > 解决方案 > Allowing IAM access to only a specific subdomain on Route 53

问题描述

I need to give an IAM user Route 53 access to create records under a subdomain, say data.example.com. For example, the user should be able to create a CNAME for server1.data.example.com. At the same time, I don't want the user to be able to add/modify/delete any records other than *.data.example.com.

Is it possible to write a policy that does that?

标签: amazon-web-servicesdnsamazon-iamamazon-route53

解决方案


您可以按托管区域进行限制,但不能按子域进行限制。如果您想限制到特定的子域,您的 Route53 托管区域应按子域进行拆分。您可以为子域创建托管区域

例如,如果您想要一个名为的子域test,您可以这样做,因为这里的答案总结得很好:

为 test.example.com 创建一个托管区域。

请注意 Route 53 为其分配新托管区域的 4 个名称服务器。

返回主区域,创建一个新的资源记录,主机名为“test”,记录类型为 NS,并在下面的框中输入 Route 53 分配的 4 个名称服务器。

以上将子域的控制权委托给这个新的托管区域,它有一个唯一的区域 ID,我们可以在 IAM 策略中使用

然后,您可以构建一个 IAM 策略来限制对该区域的操作:

{
   "Statement":[
      {
         "Action":[
            "route53:*"
         ],
         "Effect":"Allow",
         "Resource":[
            "arn:aws:route53:::hostedzone/<The new zone ID>"
         ]
      },
      {
         "Action":[
            "route53:ListHostedZones"
         ],
         "Effect":"Allow",
         "Resource":[
            "*"
         ]
      }
   ]
}

从这里您可以调整此策略以适应您希望用户能够在此区域中执行的操作。


推荐阅读