File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,8 @@ def cli():
125125
126126@cli .command ()
127127@click .option ("--region" , required = True , default = os .getenv ("AWS_DEFAULT_REGION" , "eu-west-2" ))
128- def ecs_shell (region ):
128+ @click .option ("--command" , default = "bash" )
129+ def ecs_shell (region , command ):
129130 ecs_tools = EcsTools (region )
130131
131132 "Shell into an ECS task container"
@@ -142,7 +143,7 @@ def ecs_shell(region):
142143 container = ecs_tools .get_task_containers (cluster , task_arn )[int (click .prompt ("Please select a container" ))]["name" ]
143144 click .secho ("Connecting to Cluster:" + cluster + " Service:" + service_arn .split ("/" ).pop () + " Task:" + task_arn .split ("/" ).pop () + " Container: " + container , fg = "green" )
144145 task_id = task_arn .split ("/" ).pop ()
145- command = f"aws ecs execute-command --cluster { cluster } --task { task_id } --container { container } --interactive --command bash "
146+ command = f"aws ecs execute-command --cluster { cluster } --task { task_id } --container { container } --interactive --command { command } "
146147 click .secho ("Executing command" , fg = "green" )
147148 click .secho (command , fg = "cyan" )
148149 os .system (command )
You can’t perform that action at this time.
0 commit comments