【问题标题】:Attach more than one IAM inline policy from cloudformation to the same role将来自 cloudformation 的多个 IAM 内联策略附加到同一角色
【发布时间】:2019-01-13 13:30:39
【问题描述】:

我正在检查是否可以将多个 IAM 策略附加到云形成中。 我已经附加了托管策略,并且可以附加内联策略,但想检查是否可以附加多个内联策略。

我想加入同一个角色

1) 托管策略 2) 内联政策 - 1 3) 内联策略 - 2

谢谢 纳塔拉杰

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation amazon-iam aws-iam


    【解决方案1】:

    这是完全可能的。相关字段为ManagedPolicyArnsPolicies

    Resources: 
      RootRole: 
        Type: "AWS::IAM::Role"
        Properties: 
          AssumeRolePolicyDocument: 
            Version: "2012-10-17"
            Statement: 
              - Effect: "Allow"
                Principal: 
                  Service: 
                    - "ec2.amazonaws.com"
                Action: 
                  - "sts:AssumeRole"
          Path: "/"
          ManagedPolicyArns:
            - 'arn:aws:iam::ACCOUNT_ID:policy/myname/ManagedPolicy'
          Policies: 
            - PolicyName: "Inline Policy 1"
              PolicyDocument: 
                Version: "2012-10-17"
                Statement: 
                  - Effect: "Allow"
                    Action: "*"
                    Resource: "*"
            - PolicyName: "Inline Policy 2"
              PolicyDocument: 
                Version: "2012-10-17"
                Statement: 
                  - Effect: "Allow"
                    Action: "*"
                    Resource: "*"
    

    有关更多详细信息/标注,请查看文档:https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html

    【讨论】:

    • Cheruvian 非常感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 2020-09-01
    • 2017-05-17
    • 2018-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-13
    相关资源
    最近更新 更多