Skip to content

Instantly share code, notes, and snippets.

@mlf4aiur
Last active December 2, 2016 09:44
Show Gist options
  • Select an option

  • Save mlf4aiur/acdbeb271ccda86934866e1310d6fb7c to your computer and use it in GitHub Desktop.

Select an option

Save mlf4aiur/acdbeb271ccda86934866e1310d6fb7c to your computer and use it in GitHub Desktop.
function update_ecs_agent () {
local cluster_name=$1
local container_arns
local container_arn
# Get container instances
container_arns=$(aws --output json \
ecs list-container-instances \
--cluster "${cluster_name}" | \
jq '.containerInstanceArns[]' | tr -d '"' | tr "\n" " ")
for container_arn in ${container_arns}; do
echo "Update ${container_arn}"
aws ecs update-container-agent \
--cluster "${cluster_name}" --container-instance "${container_arn}" >/dev/null
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment