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 年前633 查看次数
2 回答
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
支持工程师
已回答 2 年前
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
专家
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则