ecsgo

Heavily inspired by incredibly useful gossm, this tool makes use of the new ECS ExecuteCommand API to connect to running ECS tasks. It provides an interactive prompt to select your cluster, task and container (if only one container in the task it will default to this), and opens a connection to it.

That’s it! Nothing fancy.

⚠️
The ExecuteCommand API is quite new at time of creation and existing Services and Tasks may need to be updated/created with the --enable-execute-command flag via the CLI. Terraform support for this option is now available)

Prereqs

You’ll need to follow the prerequisites for ECS Exec as outlined in the blog post. You can also view some additional documentation on using ECS Exec here

Installation

MacOS/Homebrew

brew tap tedsmitt/ecsgo
brew install ecsgo

Linux

wget https://github.com/tedsmitt/ecsgo/releases/download/0.1.3/ecsgo_Linux_x86_64.tar.gz
tar xzf ecsgo_*.tar.gz

Move the ecsgo binary into your $PATH

Usage

The tool uses your AWS Config/Environment Variables to run. If you aren’t familiar with working on AWS via the CLI, you can read more about how to configure your environment here

Flag Description Default Value
-p Specify the profile to load the credentials default
-c Specify the command to be run on the container, defaults to /bin/sh
-r Specify the AWS region to run in N/A

In future releases there will be more flags that will allow you to narrow down the results so you can find your desired task/container quicker.

The tool makes use of the wonderful survey package which allows us to filter down our results by typing at the prompt.

See below for some examples:

Connect to a task with multiple containers

multicontainer

Tasks that are not part of a service can be viewed by selecting *

listall

Issuing a specific command to a container

command

GitHub

https://github.com/tedsmitt/ecsgo