ecsexec
is a tool designed to access a shell session within a container running in an ECS task.
Before using ecsexec, ensure that you have the following prerequisites installed on your local machine:
AWS CLI: The AWS Command Line Interface (CLI) is required for managing AWS resources from the command line. Installation instructions for the AWS CLI can be found in the AWS documentation: Installing the AWS CLI.
Session Manager Plugin (session-manager-plugin
):
Installation instructions for session-manager-plugin can be found in the AWS documentation: Session Manager Plugin Installation.
You can install this tool by running the following command:
brew install Taiki130/ecsexec/ecsexec
go install -a github.com/Taiki130/ecsexec/cmd/ecsexec@latest
The ecsexec
command can be used with the following syntax:
ecsexec [global options]
If any of the required information is not provided through environment variables or command-line options, ecsexec
will prompt you interactively to select the necessary details.
--region value
: Specifies the AWS region name. Default is $AWS_REGION
.--profile value
: Specifies the AWS profile name. Default is $AWS_PROFILE
.--cluster value
: Specifies the ECS cluster name. Default is $ECSEXEC_CLUSTER
.--service value
: Specifies the ECS service name. Default is $ECSEXEC_SERVICE
.--container value
: Specifies the container name. Default is $ECSEXEC_CONTAINER
.--command value
: Specifies the login shell. Default is /bin/sh, and it can be overridden by $ECSEXEC_COMMAND
.--help, -h
: Displays the help message.ecsexec
ecsexec --region us-east-1 --cluster my-cluster --service my-service --container my-container
ecsexec --command /bin/bash
You can customize the behavior of the ecsexec command using environment variables. Here are the available environment variables:
AWS_REGION
: AWS region nameAWS_PROFILE
: AWS profile nameECSEXEC_CLUSTER
: ECS cluster nameECSEXEC_SERVICE
: ECS service nameECSEXEC_CONTAINER
: Container nameECSEXEC_COMMAND
: Login shellThis project is licensed under the MIT License. See the LICENSE file for details.