title: Error registering: NoCredentialProviders: no valid providers in chain ECS agent error
body: <p>Im trying to use EC2 Container service. Im using terraform for creating it.
  I have defined a ecs cluster, autoscaling group, launch configuration. All seems to work. Except one thing. The ec2 instances are creating, but they are not register in the cluster, cluster just says no instances available.</p>
  
  <p>In ecs agent log on created instance i found logs flooded with one error:</p>
  
  <blockquote>
    <p>Error registering: NoCredentialProviders: no valid providers in chain</p>
  </blockquote>
  
  <p>The ec2 instances are created with a proper role  ecs_role. This role has two policies, one of them is following, like docs required:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": [
          "ecs:CreateCluster",
          "ecs:DeregisterContainerInstance",
          "ecs:DiscoverPollEndpoint",
          "ecs:Poll",
          "ecs:RegisterContainerInstance",
          "ecs:StartTelemetrySession",
          "ecs:Submit*",
          "ecs:StartTask"
        ],
        "Resource": "*"
      }
    ]
  }
  </code></pre>
  
  <p>Im using ami <a href="http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html" rel="noreferrer">ami-6ff4bd05</a>. Latest terraform.</p>