Skip to content

Instantly share code, notes, and snippets.

@ThisIsMissEm
Last active December 28, 2017 16:14
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ThisIsMissEm/6c38b89087328482b1f4884948c499c3 to your computer and use it in GitHub Desktop.
Save ThisIsMissEm/6c38b89087328482b1f4884948c499c3 to your computer and use it in GitHub Desktop.
{
// The standard ECS options, place in your own values:
"cluster": "",
"serviceName": "my-side-car-container",
"taskDefinition": "",
"role": "",
// desireCount should be greater than the number of instances that are in the ECS cluster.
"desiredCount": 1000,
// These two configuration options may be used, but typically you'll deploy these containers once,
// and then not update them frequently, unless you're updating the entire ECS instance.
"deploymentConfiguration": {
"maximumPercent": 0,
"minimumHealthyPercent": 0
},
// Ensure that the container instances are spread evenly across multiple availability zones.
// Not really a concern if you're only running in a single AZ, but you should NOT be doing that.
"placementStrategy": [{
"field": "attribute:ecs.availability-zone",
"type": "spread"
}],
// Ensure that only one container instance can run on a given ECS instance at any one time,
// Anymore than one would result in the ECS instance having it's metrics double reported.
"placementConstraints": [{
"type": "distinctInstance"
}]
}

For a former client, I needed to be able to deploy the docker-stats-statsd image to every single instance in my ECS cluster, however, I couldn't have more than one instance of the collector running per ECS instance; Additionally, I needed to be able to scale up and down the number of ECS instances without worrying whether or not they would be monitored. This is roughly what I used, if I recall correctly — there is certainly better ways to do this, and I highly encourage you look at Kubernetes instead of ECS, as it has better support for this sort of monitoring container: https://kubernetes.io/docs/user-guide/monitoring/ & https://kubernetes.io/docs/admin/daemons/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment