Skip to content

Instantly share code, notes, and snippets.

@leandrosiow
Created March 2, 2020 23:10
Show Gist options
  • Save leandrosiow/f5e9f81933902245aeb8e4b8f108c080 to your computer and use it in GitHub Desktop.
Save leandrosiow/f5e9f81933902245aeb8e4b8f108c080 to your computer and use it in GitHub Desktop.
This script simply displays the capacity provider in a ECS Cluster
#!/bin/bash
CLUSTER=ecs-fargate-spot-only
ECS_SERVICE_NAME=ecs-fargate-hybrid
TASK_ARNS=$(aws ecs list-tasks --cluster $CLUSTER --service-name $ECS_SERVICE_NAME)
TASK_ARNS_STRING=$(echo $TASK_ARNS | jq --raw-output .taskArns[])
# echo $TASK_ARNS_STRING
# aws ecs describe-tasks --cluster ecs-fargate-spot-only --tasks $TASK_ARNS_STRING | grep capacityProviderName
# This line is working
aws ecs describe-tasks --cluster $CLUSTER --tasks $TASK_ARNS_STRING | jq '.tasks[] | .capacityProviderName'
#This line is working too
# aws ecs describe-tasks --cluster ecs-fargate-spot-only --tasks $TASK_ARNS_STRING | jq '.tasks[] | [.capacityProviderName, .taskArn]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment