Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create IAM role only with managed cloudformation policy

I am trying to create IAM role with existing maneged policy:

"SomeRole": 
        {
            "Type": "AWS::IAM::Role",
            "Properties": 
            {
                "AssumeRolePolicyDocument": {},
                "ManagedPolicyArns": 
                [
                    "arn:aws:iam::aws:policy/AmazonKinesisReadOnlyAccess",
                    "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess",
                    "arn:aws:iam::aws:policy/CloudWatchFullAccess"
                ],

                "RoleName": "SomeRole"
            }
        },

But it is failing with error: Syntax error at position (1,3)

like image 805
Vivek Goel Avatar asked Sep 23 '16 00:09

Vivek Goel


1 Answers

Looks like you have to have some value in the AssumeRolePolicyDocument.

Try with this one.

{
  "Resources": {
    "NewRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": {
                "Service": [
                  "ec2.amazonaws.com"
                ]
              },
              "Action": [
                "sts:AssumeRole"
              ]
            }
          ]
        },
        "ManagedPolicyArns": [
          "arn:aws:iam::aws:policy/AmazonKinesisReadOnlyAccess",
          "arn:aws:iam::aws:policy/AmazonDynamoDBFullAccess",
          "arn:aws:iam::aws:policy/CloudWatchFullAccess"
        ]
      }
    }
  }
}
like image 198
Ravindra Godbole Avatar answered Sep 29 '22 14:09

Ravindra Godbole



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!