UFO Exec Into Container

The ufo exec command allows you to hop into a container and debug. It essentially calls aws ecs execute-command.


Here’s a demo. First, list the ECS Tasks or containers and confirm that there are running containers.

$ ufo ps
|             Task Id              | Name |     Release     |    Started    | Status  |
| d5e7b8e238154e25b07ef5bd66e20abf | web  | demo-web-dev:25 | 3 minutes ago | RUNNING |

To hop into the container, it’s simple:

$ ufo exec
=> aws ecs execute-command --cluster dev --task d5e7b8e238154e25b07ef5bd66e20abf --container web --interactive --command /bin/bash
Starting session with SessionId: ecs-execute-command-0412e0b1acbfd230e
root@62e996573a7a:/# grep ID /etc/os-release

The default command is /bin/bash, if that shell is not available try:

$ ufo exec --command /bin/sh
# grep ID /etc/os-release

You can also configure the default command with config.exec.command. Example:


Ufo.configure do |config|
  config.exec.command = "/bin/sh"

Prerequisites for exec

To use the exec feature, some prerequisites must be set up. More info: Debugging with Exec


The table below covers each setting. Each option is configured in .ufo/config.rb with config.OPTION. The config. portion is not shown for conciseness. IE: logger.level vs config.logger.level.

Name Default Description
exec.command /bin/bash The default command to run for ufo exec which calls aws ecs execute-command
exec.enabled true Enable the execute command feature for the ECS service.

See Full Config Reference