Skip to content

Instantly share code, notes, and snippets.

@jamieparkinson
Created January 4, 2018 11:17
Show Gist options
  • Save jamieparkinson/abb65c2b82fa4198b0e2f0595d1d1cef to your computer and use it in GitHub Desktop.
Save jamieparkinson/abb65c2b82fa4198b0e2f0595d1d1cef to your computer and use it in GitHub Desktop.
Run one task per host from CLI
nInstances=$(aws ecs list-container-instances --cluster ${CLUSTER_NAME} | jq -r '.containerInstanceArns | length')
aws ecs run-task \
--cluster ${CLUSTER_NAME} \
--task-definition ${TASK_NAME} \
--count ${nInstances} \
--placement-constraints type="distinctInstance"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment