efanon / AWS-ECS-Session-Connector

Simple script to help with execute and connect to AWS ECS EC2 and Fargate instances via Session manager plugin for AWS-CLI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS SESSION MANAGER CONNECTOR

It is a simple script to help with execute command or connect to ECS instances.

Using

This script use aws profiles to manage multi-account architecture and etc. To use it you have to use credentails file https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html

python3 ./aws_session_connector.py {region} {command}

arguments

  • region - code of AWS region (required)
  • command - command to execute (default: /bin/sh)

Requirements

Troubleshooting

  • No items to show. Exit - there is no clusters or services or tasks or containers to show
  • Region not set, please pass region as first argument. - you must pass region at first argument
  • Client error... - there is problem with communication with aws. Token expired?
  • An error occurred (InvalidParameterException) when calling the ExecuteCommand operation: The execute command failed because execute command was not enabled when the task was run or the execute command agent isn’t running. Wait and try again or run a new task with execute command enabled and try again. - Command execute is disabled. Every problem with connection to container you can check using awsome tool: https://github.com/aws-containers/amazon-ecs-exec-checker

About

Simple script to help with execute and connect to AWS ECS EC2 and Fargate instances via Session manager plugin for AWS-CLI

License:MIT License


Languages

Language:Python 100.0%