Skip to main content

ecs-shell

PyPI version ecs-shell

ecs-shell is yet another interactive CLI tool for connecting to AWS ECS (Elastic Container Service) tasks. It provides a user-friendly interface to browse services, select tasks, and establish shell sessions - all without having to remember complex AWS CLI commands or task IDs.

I have created this as an utility for me in the past, and only later found that there are plenty of others out there. I think the CLI UX with this one is better, so I decided to publish it anyways.

https://github.com/user-attachments/assets/065ad13e-38fc-4e71-a9bc-d57973d347f7

✨ Features

  • 🎯 Interactive Selection: Browse and select ECS services and tasks using arrow keys
  • 🎨 Rich UI: Beautiful terminal interface with color-coded output
  • ⚡ Fast Navigation: Quickly filter through services and tasks
  • 📊 Task Details: View task creation time, CPU/Memory allocation, and container information
  • 🔄 Session Management: Seamless shell session establishment with AWS ECS Exec
  • 🔐 Profile Support: Use any AWS CLI profile for multi-account workflows

📋 Requirements

Before using ecs-shell, ensure you have the following installed and configured:

1. AWS CLI

The AWS CLI must be installed and authenticated with appropriate permissions.

# Install AWS CLI (macOS)
brew install awscli

# Configure your AWS credentials
aws configure

Required AWS Permissions:

  • ecs:ListServices
  • ecs:ListTasks
  • ecs:DescribeTasks
  • ecs:ExecuteCommand

2. Session Manager Plugin

The Session Manager plugin is required for establishing interactive sessions with ECS tasks.

# Install Session Manager plugin (macOS)
brew install --cask session-manager-plugin

# Verify installation
session-manager-plugin --version

For other operating systems, see the AWS Session Manager Plugin installation guide.

3. Python

Python 3.10 or higher is required.

# Check your Python version
python3 --version

4. ECS Task Configuration

Your ECS tasks must have ECS Exec enabled. This is configured in your task definition:

{
  "enableExecuteCommand": true
}

🚀 Installation

pipx installs CLI tools in isolated environments, avoiding conflicts:

# Install pipx if you haven't already
brew install pipx
pipx ensurepath

# Install ecs-shell
pipx install ecs-shell

Upgrading

# With pipx
pipx upgrade ecs-shell

📖 Usage

ecs-shell <profile> <cluster>

Arguments:

  • profile: AWS CLI profile name (from ~/.aws/credentials)
  • cluster: ECS cluster name

Examples

# Connect to staging cluster using 'production' profile
ecs-shell production my-cluster-staging

# Connect to development cluster
ecs-shell dev-profile dev-cluster

# Use default profile
ecs-shell default my-cluster

🛠️ Development

Setup

# Clone the repo
# Create and activate virtual environment
make setup-venv
source venv/bin/activate

# Install dependencies
make install-deps

# Install ecs-shell globally, from source
make local-install

Commands

make lint           # Run linting checks
make format         # Auto-format code
make local-install  # Install package locally (in active environment)

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

Release files for ecs-shell 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ecs-shell 1.1.0
File Size Uploaded
ecs_shell-1.1.0.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ecs-shell 1.1.0
File Interpreter ABI Platform
ecs_shell-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / ecs_shell-1.1.0.tar.gz

Download URL ecs_shell-1.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
95cdc32445aa7987a3378994ce5e7374abef973a0f1517c2de4b06859a351b36
BLAKE2b-256 checksum
How to use checksums
b01e8f9432b68728f79c0ff651bc0b0875bab1394eac75437dedc33f522c299e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / ecs_shell-1.1.0-py3-none-any.whl

Download URL ecs_shell-1.1.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
81f1ca1b302356208909eb6aa86e63de1dc8b5e9910c154635b0f8aadf9d45c4
BLAKE2b-256 checksum
How to use checksums
60e12f18a93aa37823e7afac02e640f0f195542a9b0f6028b00c541bf2bdc9af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page