title: ECS CLI - You cannot specify an IAM role for services that require a service linked role
body: <p>I'm trying to deploy a container to ECS (Fargate) via aws cli. I'm able to create the task definition successfully, the problem comes when I want to add a new service to my Fargate cluster.</p>
  <p>This is the command a execute:</p>
  <pre><code>aws ecs create-service --cli-input-json file://aws_manual_cfn/ecs-service.json
  </code></pre>
  <p>This is the error that I'm getting:</p>
  <pre><code>An error occurred (InvalidParameterException) when calling the CreateService operation: You cannot specify an IAM role for services that require a service linked role.`
  </code></pre>
  <p><strong>ecs-service.json</strong></p>
  <pre><code>{
  &quot;cluster&quot;: &quot;my-fargate-cluster&quot;,
  &quot;role&quot;: &quot;AWSServiceRoleForECS&quot;,
  &quot;serviceName&quot;: &quot;dropinfun-spots&quot;,
  &quot;desiredCount&quot;: 1,
  &quot;launchType&quot;: &quot;FARGATE&quot;,
  &quot;networkConfiguration&quot;: {
      &quot;awsvpcConfiguration&quot;: {
          &quot;assignPublicIp&quot;: &quot;ENABLED&quot;,
          &quot;securityGroups&quot;: [&quot;sg-06d506f7e444f2faa&quot;],
          &quot;subnets&quot;: [&quot;subnet-c8ffcbf7&quot;, &quot;subnet-1c7b6078&quot;, &quot;subnet-d47f7efb&quot;, &quot;subnet-e704cfad&quot;, &quot;subnet-deeb43d1&quot;, &quot;subnet-b59097e8&quot;]
       }
  },
  &quot;taskDefinition&quot;: &quot;dropinfun-spots-task&quot;,
  &quot;loadBalancers&quot;: [
      {
          &quot;targetGroupArn&quot;: &quot;arn:aws:elasticloadbalancing:us-east-1:************:targetgroup/dropinfun-spots-target-group/c21992d4a411010f&quot;,
          &quot;containerName&quot;: &quot;dropinfun-spots-service&quot;,
          &quot;containerPort&quot;: 80
      }
  ]
  }
  </code></pre>
  <p><strong>task-definition.json</strong></p>
  <pre><code>{
  &quot;family&quot;: &quot;dropinfun-spots-task&quot;,
  &quot;executionRoleArn&quot;: &quot;arn:aws:iam::************:role/aws-service-role/ecs.amazonaws.com/AWSServiceRoleForECS&quot;,
  &quot;memory&quot;: &quot;0.5GB&quot;,
  &quot;cpu&quot;: &quot;256&quot;,
  &quot;networkMode&quot;: &quot;awsvpc&quot;,
  &quot;requiresCompatibilities&quot;: [
    &quot;FARGATE&quot;
  ],
  &quot;containerDefinitions&quot;: [
    {
      &quot;name&quot;: &quot;dropinfun-spots-service&quot;,
      &quot;image&quot;: &quot;************.dkr.ecr.us-east-1.amazonaws.com/dropinfun-spots-service:latest&quot;,
      &quot;memory&quot;: 512,
      &quot;portMappings&quot;: [
          {
            &quot;containerPort&quot;: 80
          }
        ],
      &quot;essential&quot;: true
    }
  ]
  }
  </code></pre>
  <p>Any idea on how to manage this <strong>linked-role</strong> error?</p>