Skip to main content

AWS ECS Cli tool for connecting to ecs container and update secret manager

Project description

ecs_connect_cli

AWS ECS Exec command cli tool is aimed to :

  • connect to your container instance running under ECS Fargate.
  • tail the log from cloudwatch logs (if you configure a logconfiguration in your task definition)
  • update secret value into secret manager

 

The aws ecs execute-command command is quite complicated to remember and the tool give you the ability to parse and retrieve:

  • your clusters
  • your services
  • your tasks
  • your container

To let you choose which one you want to connect into.

Enhancements :sunglasses: You can now connect to ECS and tail your logs from an EC2 instance or AWS CloudShell without the need of aws cli and aws credentials file.

At start, you are asked what kind of credentials you want to use and which default region.

You can now also update your secret directly from the command line.

 ecs-connect-cli update-secret your-secret-name

I also add the possibility to run directly with pipx

 pipx run ecs-connect-cli --help

 

Installation

Requirements

  • Install awscli via [https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html] (not necessary if you are connected to an EC2 instance)

  • Install ssm tools via [https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html]

 

To install you have several options:

  • Install it globally with your pip:
 pip install ecs-connect-cli
  • Install it into a virtualenv (after creating a virtualenv with the tool of your choice):
 source .venv_3.11.0/bin/activate
❯ pip install ecs-connect-cli
  • Run the cli directly with pipx
 pipx run ecs-connect-cli --help

 

if it is the first time you connect to aws-cli, you have to get credentials key from your aws administrator.

 

Usage

If you use it with with pip, you can call the CLI as below or directly call it with pipx

 ecs-connect-cli --help


Welcome in AWS ECS Exec command Cli !

                                                                                                                                                                                       
 Usage: ecs_connect_cli [OPTIONS] COMMAND [ARGS]...                                                                                                                                        
                                                                                                                                                                                       
╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --version             -v        Show the application's version and exit.                                                                   │
│ --install-completion            Install completion for the current shell.                                                                  │
│ --show-completion               Show completion for the current shell, to copy it or customize the installation.                           │
│ --help                          Show this message and exit.                                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ connect                           Connect to an ECS Fargate container                                                                      │
│ exec-command                      Execute manage.py command with args                                                                      │
│ list-cluster                      List cluster into an AWS account                                                                         │
│ list-service                      List service(s) into a cluster                                                                           │
│ list-task                         List task(s) into a service into a cluster                                                               │
│ tail                              Tail logs of a selected  ECS container                                                                   | update-secret                     Update secret from secret manager                                                                        |
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

 

Thanks to Typer from @tiangolo

Thanks to @kraymer for echoprompt :sunglasses:

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_connect_cli-1.17.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

ecs_connect_cli-1.17.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file ecs_connect_cli-1.17.0.tar.gz.

File metadata

  • Download URL: ecs_connect_cli-1.17.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1018-azure

File hashes

Hashes for ecs_connect_cli-1.17.0.tar.gz
Algorithm Hash digest
SHA256 61ca040fabf34bfdde88c24369a0fcd1e4d2fada1227a460066823db8db915b0
MD5 0cf3a345fdf1f22a90dc99e8ef879cab
BLAKE2b-256 d0818f12807f8473bfa8debe2bbe39cab6f03dcb402a2fe834e935b0697817ff

See more details on using hashes here.

File details

Details for the file ecs_connect_cli-1.17.0-py3-none-any.whl.

File metadata

  • Download URL: ecs_connect_cli-1.17.0-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.19 Linux/6.5.0-1018-azure

File hashes

Hashes for ecs_connect_cli-1.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 052658c7ca7574688be1d5ec90fc108037c84735b96513f60ae3e389659613e0
MD5 e07dd91ddfa6dfb8323de137c0c50813
BLAKE2b-256 b2d7c6bf4151808df78ebb0bf45d32ffecbb310c1e16f079b48620154186c6c7

See more details on using hashes here.

Supported by

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