【AWS CLI 示例集】Systems Manager

Systems Manager

我们主要检查是否可以使用AWS Cloud9执行命令。
如果您想提供示例命令,请使用下面的表格提交。
如果列出的命令示例有任何错误,请在此处更正。

建议
建议内容可能会被修改。在提出任何建议之前请注意这一点。


安装会话管理器插件

sudo yum install -y https://s3.amazonaws.com/session-manager-downloads/plugin/latest/linux_64bit/session-manager-plugin.rpm

输出

Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
session-manager-plugin.rpm                                                                                                                | 3.0 MB  00:00:01     
Examining /var/tmp/yum-root-AQ3Eap/session-manager-plugin.rpm: session-manager-plugin-1.2.633.0-1.x86_64
Marking /var/tmp/yum-root-AQ3Eap/session-manager-plugin.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package session-manager-plugin.x86_64 0:1.2.633.0-1 will be installed
--> Finished Dependency Resolution
amzn2-core/2/x86_64                                                                                                                       | 3.6 kB  00:00:00     

Dependencies Resolved

=================================================================================================================================================================
 Package                                      Arch                         Version                           Repository                                     Size
=================================================================================================================================================================
Installing:
 session-manager-plugin                       x86_64                       1.2.633.0-1                       /session-manager-plugin                        13 M

Transaction Summary
=================================================================================================================================================================
Install  1 Package

Total size: 13 M
Installed size: 13 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : session-manager-plugin-1.2.633.0-1.x86_64                                                                                                     1/1 
ln: failed to create symbolic link ‘/usr/local/bin/session-manager-plugin’: File exists
warning: %posttrans(session-manager-plugin-1.2.633.0-1.x86_64) scriptlet failed, exit status 1
Non-fatal POSTTRANS scriptlet failure in rpm package session-manager-plugin-1.2.633.0-1.x86_64
  Verifying  : session-manager-plugin-1.2.633.0-1.x86_64                                                                                                     1/1 

Installed:
  session-manager-plugin.x86_64 0:1.2.633.0-1                                                                                                                    

Complete!

by ton

使用会话管理器启动 EC2 会话

aws ssm start-session --target i-0af01c0123456789a

输出

Starting session with SessionId: cloud9-045c8a0b949a60213
$ 

by ton

结束会话

aws ssm terminate-session --session-id cloud9-045c8a0b949a60213

输出

{
    "SessionId": "cloud9-045c8a0b949a60213"
}

by ton

タイトルとURLをコピーしました