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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南