Interactive multi-execution shell

0

Hello All,

I am looking for a way to interactively run shell commands in multiple instances simultaneously.

I know I can run (shell) commands interactively with a single instance through SSM console, and non-interactive scripts, document, with multiple instances through Run Command.

I am using the SSH client tool with 'multi-execution mode' to perform this kind of interactive work. However, I have to open the port to do the work.

If Systems Manager can add 'multi-execution mode' to SSM or interactivity to Run Command, or just a new tool. Then I do not have to poke a hole in my VPC to do the work.

Best regards,

Tiger

2 Answers
0

Hello! SSM has the AWS-StartInteractiveCommand document. For more information you can read the following links:

  1. https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-restrict-command-access.html
  2. https://aws.amazon.com/blogs/mt/limit-ssm-interactive-session-commands-by-users/

Please let me know if the above helps!

AWS
SUPPORT ENGINEER
answered 2 years ago
0

Systems Manager allows you to use your SSH client to interactively access instances without requiring network ingress to your EC2 instances.

You will need:

  1. An SSH client that can be configured with ProxyCommand, such as OpenSSH; and
  2. A recent version of the AWS CLI installed.

Once you have that, you can set up your SSH configuration file to access your instances, like so:

# ~/.ssh/config file
# SSH over Session Manager
host i-* mi-*
    ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"

Then, when you run something like ssh i-01234567890, the session will be transported via SSM.

If your multi-session manager uses the standard ssh program under the hood, your experience should be identical to that of using ssh directly.

See Enabling SSH connections for Session Manager for details.

AWS
EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions