Amazon-Web-Services

限制每個 IAM 執行自動化文件的 AWS 內聯策略

  • June 30, 2019

限制每個 IAM 執行自動化文件的 AWS 內聯策略是我的目標,但了解目前的限制後,我可以看到我只能使用*萬用字元並且不能指定特定文件。

有沒有辦法限制特定的 IAM 只能訪問特定的自動化文件。

{
   "Version": "2012-10-17",
   "Statement": [
       {
           "Sid": "test",
           "Effect": "Allow",
           "Action": [
               "ssm:StartAutomationExecution"
           ],
           "Resource": "*"
       }
   ]
}

@JohnRotenstein,@HenrikPingel,我找到了一種方法來實現我想要的:{a "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ssm:*" ], "Resource": [ "arn:aws:ssm:eu-west-2:{accountnumberplaceholder}:automation-definition/{documentnameplaceholder}:$DEFAULT", "arn:aws:ssm:eu-west-2:{accountnumberplaceholder}:automation-definition/{documentnameplaceholder}:$DEFAULT", "arn:aws:ssm:eu-west-2:{accountnumberplaceholder}:automation-definition/{documentnameplaceholder}:$DEFAULT", "arn:aws:ssm:eu-west-2:{accountnumberplaceholder}:*", "arn:aws:ec2:eu-west-2:{accountnumberplaceholder}:instance/*", "arn:aws:ssm:eu-west-2::document/AWS-RunPowerShellScript" ] } ]

您可以通過在資源欄位中指定文件的 ARN 來限制 IAM 權限。AWS Systems Manager 的 ARN構造如下:

arn:aws:ssm:region:account-id:document/document-name

您可以指定文件的完整 arn 或將星號放在 arn 中以將權限限制為文件的子集。就像在文件中一樣:

arn:aws:ssm:us-west-2:111222333444:document:West*

引用自:https://serverfault.com/questions/968885