Simple bash script to provide info about an ECS cluster, services, task definitions and containers
The plan is to implement the functionality/features into the existing tool cloudman to support both EC2 and ECS.
This tool cannot function without the aws-cli version 2 and the ecs-cli.
To install the aws-cli, checkout the AWS aws-cli install guide.
To install the ecs-cli, checkout the AWS ecs-cli install guide.
The shell's current AWS profile will be used to perform all aws
and ecs-cli
. If you need to change profile, checkout the AWS aws-cli configure profiles page.
bash ecs-insight.sh {cluster-name}
Will output all service arns for the provided cluster as well as all containers inside the cluster with a --desired-status RUNNING
.
bash ecs-insight.sh {cluster-name} {service-search-name}
Will output the service arn, task definition arn, the containers related to the service and command line hint to:
- show the task definition
- start a ssm session in the container (equivalent of the
docker exec
command)
If any failures occured that cause the task to fail, will also be displayed.
bash ecs-insight.sh {cluster-name} {service-search-name} --logs
Will output all of the items of the previous command, and adds:
- tailing logs for all the containers defined in the task definition for the service
bash ecs-insight.sh {cluster-name} {service-search-name} --single
Same output of the previous command, except will show logs of a single container considered as the 'main' app for the service