title: Cloudformation template to create a role for SQS
body: <p>I am trying to create a role with embedded policy using cloudformation template :   </p>
  
  <pre><code>{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "SQSRole": {
       "Type": "AWS::IAM::Role",
       "Properties": {
          "AssumeRolePolicyDocument": {
             "Version" : "2012-10-17",
             "Statement": [ {
                "Effect": "Allow",
                "Principal": {
                   "Service": [ "sqs.amazonaws.com" ]
                },
                "Action": [
                      "SQS:SendMessage",
                      "SQS:ReceiveMessage",
                      "SQS:DeleteMessage",
                      "SQS:GetQueueUrl"
                  ]
             } ]
          },
          "Path": "/"
          }
    },
    "RootInstanceProfile": {
       "Type": "AWS::IAM::InstanceProfile",
       "Properties": {
          "Path": "/",
          "Roles": [ {
             "Ref": "SQSRole"
          } ]
       }
    }
  }
  }
  </code></pre>
  
  <p>It gives an error " Invalid principal in policy: "SERVICE":"sqs.amazonaws.com".</p>
  
  <p>I also tried by replacing exact URL of SQS queue : "SERVICE":"sqs.ap-south-1.amazonaws.com/710161973367/CFI-Trace"</p>
  
  <p>Still it gives same error. Not sure what service to specify for sqs.</p>