Attach to running Tasks #
You can set up a connection to a running task using the SetOps CLI. This allows you to use a shell, or a REPL (read-eval-print loop) console, for example.
There are some prerequisites for attaching to tasks:
- You need to install the AWS
session-manager-pluginbinary. See their documentation for instructions on how to install the tool. Note that it is also available on Homebrew:brew install session-manager-plugin
Auto Attach #
You can attach to a specific running task using the task:attach command providing a taskID
setops -p <PROJECT> -s <STAGE> --app <APPNAME> task:attach --interactive <taskID> -- bash
or the latest started task of an app by omitting the taskID:
setops -p <PROJECT> -s <STAGE> --app <APPNAME> task:attach --interactive -- bash
The command will automatically start a session using the session-manager-plugin in the same terminal.
To exit the session, hit ctrl + d.
Attach via command #
To output the command for the session-manager-plugin instead of connecting automatically, use the --command flag:
setops -p <PROJECT> -s <STAGE> --app <APPNAME> task:attach --command --interactive <taskID> -- bash
The output will contain the command to run to start the session:
You can connect to the session with the following command:
session-manager-plugin [...]
Run the session-manager-plugin command in a new terminal to access your interactive session. Note that the command can only be used once, and you must connect to the session before a timeout of one minute.