title: resource:memory error when trying to run an ECS task using AWS CLI
body: <p>I'm trying to set up CI with AWS ECS and docker. I use Codeship as a CI tool, but that should not really matter much.</p>
  
  <p>I do the following steps in a shell script:</p>
  
  <ul>
  <li>build an image with my Dockerfile, </li>
  <li>push the image to ECS repository,</li>
  <li>push a task-definition.json to ECS <code>aws ecs register-task-definition --family postgraphile --cli-input-json file:///deploy/ecs-task-def.json --region us-east-2</code></li>
  <li>run the ECS task <code>aws ecs run-task --task-definition postgraphile --cluster testcluster --region us-east-2</code></li>
  </ul>
  
  <p>Shell script runs successfully, however I see an error in output after I try to run my ECS task:</p>
  
  <pre><code>{
      "tasks": [],
      "failures": [
          {
              "arn": "arn:aws:ecs:us-east-2:99999999999:container-instance/050ab165-7669-45d5-8be7-d990cf4fff42",
              "reason": "RESOURCE:MEMORY"
          }
      ]
  }
  </code></pre>
  
  <p>my <code>ecs-task-def.json</code>:</p>
  
  <pre><code>{
    "containerDefinitions": [
      {
        "name": "postgraphile-container",
        "image": "999999999999.dkr.ecr.us-east-2.amazonaws.com/test-repository",
        "memory": 500,
        "essential": true,
        "portMappings": [
          {
            "hostPort": 5000,
            "containerPort": 5000
          }
        ]
      }
    ],
    "volumes": [],
    "memory": "900",
    "cpu": "128",
    "placementConstraints": [],
    "family": "postgraphile",
    "taskRoleArn": ""
  }
  </code></pre>
  
  <p>I think I already checked all the memory limits.. am I missing anything? </p>
  
  <p>UPDATE:
  After couple of reboots of ec2 instance I can finally run the ecs task with no errors. After running task several times, the error returns</p>