Connecting to AWS EC2 instances via Session Manager
2021-04-02 04:45:16 Author: derflounder.wordpress.com(查看原文) 阅读量:186 收藏

Home > Amazon Web Services, Linux, macOS EC2 > Connecting to AWS EC2 instances via Session Manager

Connecting to AWS EC2 instances via Session Manager

When folks have needed command line access to instances running in Amazon Web Service’s EC2 service, SSH has been the usual method used. However, in addition to using SSH to connect to EC2 instances in AWS, it is also possible to connect remotely via Session Manager, one of the services provided by AWS’s Systems Manager tool.

Session Manager uses the Systems Manager agent to provide secure remote access to the Mac’s command line interface without needing to change security groups and allow SSH access to the instance. In fact, Session Manager allows remote access to EC2 instances which have security groups configured to allow no inbound access at all. For more details, please see below the jump.

To access EC2 instances via Session Manager, please use the procedure shown below:

1. Verify that the Systems Manager agent is installed and configured properly.
2. Select the desired EC2 instance.

Screen Shot 2021 04 01 at 3 04 54 PM

3. Click the Connect button.

Screen Shot 2021 04 01 at 3 04 55 PM

4. In the Connect to instance window, select the Session Manager tab then click the Connect button.

Screen Shot 2021 04 01 at 3 03 22 PM

5. A new browser window will open up.

Screen Shot 2021 04 01 at 3 03 50 PM

Note: The active user at this point is the Systems Manager agent’s user account, which is ssm-user.

Screen Shot 2021-04-01 at 3.03.59 PM

To get access to the ec2-user account (the default account used on most EC2 instances running macOS or Linux), you’ll need to switch accounts. To do this, run the command shown below to change to the ec2-user account:

sudo su ec2-user

Screen Shot 2021 04 01 at 3 04 19 PM

6. You should now be logged in as the ec2-user account.

Screen Shot 2021 04 01 at 3 04 27 PM

To close the remote session, use the procedure shown below.

1. Verify that all work has been completed.
2. Click the Terminate button.

Screen Shot 2021 04 01 at 3 04 28 PM

3. When prompted for confirmation, click the Terminate button.

Screen Shot 2021 04 01 at 3 04 41 PM


文章来源: https://derflounder.wordpress.com/2021/04/01/connecting-to-aws-ec2-instances-via-session-manager/
如有侵权请联系:admin#unsafe.sh