【AWS CLI サンプル集】Systems Manager

Systems Manager

コマンドの実行可否は、主に AWS Cloud9 で確認しています。
コマンド例を提供してくださる方は、お問い合わせフォームから送信してください。
記載されているコマンド例の修正もこちらからご連絡ください。


Session Manager プラグインをインストール

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

Session Manager で 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をコピーしました