-
-
Save grohiro/84c978c05b34e98055e1db30b5a8896e to your computer and use it in GitHub Desktop.
ecsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ecs_cluster_arn=$(aws ecs list-clusters | jq -r '.clusterArns[]' | fzf --layout=reverse-list) | |
| ecs_cluster=${ecs_cluster_arn##*/} | |
| container=$(aws ecs describe-tasks --tasks $(aws ecs list-tasks --cluster $ecs_cluster | jq -r '.taskArns[]') --cluster $ecs_cluster | jq -r '.tasks[] | (.group + "|" + (.containers[] | (.name + "|" + .taskArn)))' | fzf --layout=reverse-list) | |
| task_id=$(echo $container | cut -d'|' -f3) | |
| container_name=$(echo $container | cut -d'|' -f2) | |
| aws ecs execute-command --cluster $ecs_cluster \ | |
| --task $task_id \ | |
| --container $container_name \ | |
| --interactive \ | |
| --command "/bin/sh" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ chmod 755 ecsh $ export AWS_PROFILE=your-profile $ ecsh