Skip to main content

Interactive shell for AWS ECS tasks with service and task selection.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecs_shell-0.0.1.dev14.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecs_shell-0.0.1.dev14-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file ecs_shell-0.0.1.dev14.tar.gz.

File metadata

  • Download URL: ecs_shell-0.0.1.dev14.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for ecs_shell-0.0.1.dev14.tar.gz
Algorithm Hash digest
SHA256 786c8ae5dd3e1435eaeeb477d3e0e072918e0a53fb893c7bd9a9aca750bd2cbd
MD5 187318c006f53d7a5469d21e4a3b0d8d
BLAKE2b-256 2aebaca06cc993cca0bbca9d90683e0c42fe97eeaf3883839dd33eb5104c9eb5

See more details on using hashes here.

File details

Details for the file ecs_shell-0.0.1.dev14-py3-none-any.whl.

File metadata

File hashes

Hashes for ecs_shell-0.0.1.dev14-py3-none-any.whl
Algorithm Hash digest
SHA256 3392bf2a7070677304078b7406fe538efd42049b114804d3a3d500c80c013546
MD5 90640ceeeaa26133272d3c089c49a34e
BLAKE2b-256 c5268312ee628868c18e2e5446445b87e2270b14e17a0bb487fd5cdc2d402f40

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page