この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。
こんにちは、菊池です。
re:Inventで発表された新サービス、EC2 System Managerの機能の1つであるRun Commandを使って、Window Updateを試してみました。
前提・事前準備
- リージョン:東京リージョン
- AMI:Windows_Server-2012-R2_RTM-Japanese-64Bit-Base-2016.11.09 - ami-8e64ceef
- 対象のインスタンスに、IAMロールとしてAWSサービスロールのAmazon EC2 Role for Simple Systems Managerを付与しておきます。
やってみた
マネジメントコンソールのEC2の画面で、左メニューからコマンド履歴 -> コマンドの実行を選択します。
まずは、適用可能なWIndows Updatesを確認するため、AWS-FindWindowsUpdatesを実行します。
ターゲットインスタンスを選択し、Update LevelはAllを選びます。タイムアウトはデフォルトで600秒となっていますが、場合によっては長めに設定した方がいいかもしれません。また、結果を出力するS3バケットを選択しておきます。
実行します。しばらく待って、問題なければ成功と表示されます。
出力先に指定したS3バケットを確認すると、コマンドIDのフォルダが作成され、結果のテキストが格納されていますので確認します。
WIN-T9B0NO61KR5 - PatchNow Assessment Results - 2016-12-11T11:08:10.234
Important Updates: 0
Critical: 0
Important: 0
Moderate: 0
Low: 0
Unspecified: 2
Optional Updates: 2
Total Updates: 2
Unspecified (Optional)
3196684 3197875
KBArticleId : 3196684
Name : November, 2016 Preview of Quality Rollup for .NET Framewo
rk 3.5, 4.5.2, 4.6, 4.6.1 on Windows 8.1 and Windows Serv
er 2012 R2 for x64 (KB3196684)
Id : 660aaa6c-4e63-4a7c-a54e-1c5db83ad1be
ReleaseDate : 2016/11/15 0:00:00 +00:00
Severity : Unspecified
Category : PatchNow.Implementations.UpdateCategory
CategoryName : Updates
IsDownloaded : False
IsInstalled : False
Size : 74949
RebootRequired : False
EulaAccepted : True
CanRequestUserInput : False
SecurityBulletinIds : {}
SupersededUpdateIds : {7d152848-d766-4b74-896a-f8a82d436b67, 65c5519e-53e5-4ae6
-8ba4-d296b989c510}
Identity : System.__ComObject
HResult : 0
Description : Install this update to resolve issues in Windows. For a c
omplete listing of the issues that are included in this u
pdate, see the associated Microsoft Knowledge Base articl
e for more information. After you install this item, you
may have to restart your computer.
IsImportant : False
KBArticleId : 3197875
Name : 2016 年 11 月 Windows Server 2012 R2 向けマンスリー品質ロー
ルアップのプレビュー (KB3197875)
Id : 60cb29fb-e3a6-4cc8-946f-e3face565808
ReleaseDate : 2016/11/15 0:00:00 +00:00
Severity : Unspecified
Category : PatchNow.Implementations.UpdateCategory
CategoryName : Updates
IsDownloaded : False
IsInstalled : False
Size : 176582
RebootRequired : False
EulaAccepted : True
CanRequestUserInput : False
SecurityBulletinIds : {}
SupersededUpdateIds : {c37ddf6f-38c9-4430-a52e-0334df68731f}
Identity : System.__ComObject
HResult : 0
Description : この更新プログラムをインストールすると、Windows の問題が修
正されます。この更新プログラムの対象となる問題の完全な一覧
については、サポート技術情報を参照してください。インストール
後には、コンピュータの再起動が必要になる場合があります。
IsImportant : False
KB3196684、KB3197875の2つのアップデートが見つかりました。
この2つのアップデートを適用します。同様にコマンドの実行に進み、今度はAWS-InstallSpecificWindowsUpdatesを選択します。
適用するパッチのIDを入力します。一度に選択できるパッチは1つなので、2回に分けて実行します。先ほどと同様に、結果を格納するS3バケットを入力し、実行します。
実行しました。状態が進行中になりますので、しばらく待ちます。
完了し、成功となりました。
結果の出力を確認すると、しっかりと適用されているようです。
WIN-T9B0NO61KR5 - PatchNow Installation Results - 2016-12-11T11:25:01.713
Important Updates: 0
Critical: 0
Important: 0
Moderate: 0
Low: 0
Unspecified: 1
Optional Updates: 1
Total Updates: 1
KbArticleId Installed Message
----------- ----------- -----------
3196684 Yes Success
KBArticleId : 3196684
Name : November, 2016 Preview of Quality Rollup for .NET Framewo
rk 3.5, 4.5.2, 4.6, 4.6.1 on Windows 8.1 and Windows Serv
er 2012 R2 for x64 (KB3196684)
Id : 660aaa6c-4e63-4a7c-a54e-1c5db83ad1be
ReleaseDate : 2016/11/15 0:00:00 +00:00
Severity : Unspecified
Category : PatchNow.Implementations.UpdateCategory
CategoryName : Updates
IsDownloaded : True
IsInstalled : True
Size : 74949
RebootRequired : True
EulaAccepted : True
CanRequestUserInput : False
SecurityBulletinIds :
SupersededUpdateIds :
Identity :
HResult : 0
Description : Install this update to resolve issues in Windows. For a c
omplete listing of the issues that are included in this u
pdate, see the associated Microsoft Knowledge Base articl
e for more information. After you install this item, you
may have to restart your computer.
IsImportant : False
WIN-T9B0NO61KR5 - PatchNow Installation Results - 2016-12-11T11:38:32.990
Important Updates: 0
Critical: 0
Important: 0
Moderate: 0
Low: 0
Unspecified: 1
Optional Updates: 1
Total Updates: 1
KbArticleId Installed Message
----------- ----------- -----------
3197875 Yes Success
KBArticleId : 3197875
Name : 2016 年 11 月 Windows Server 2012 R2 向けマンスリー品質ロー
ルアップのプレビュー (KB3197875)
Id : 60cb29fb-e3a6-4cc8-946f-e3face565808
ReleaseDate : 2016/11/15 0:00:00 +00:00
Severity : Unspecified
Category : PatchNow.Implementations.UpdateCategory
CategoryName : Updates
IsDownloaded : True
IsInstalled : True
Size : 176582
RebootRequired : True
EulaAccepted : True
CanRequestUserInput : False
SecurityBulletinIds :
SupersededUpdateIds :
Identity :
HResult : 0
Description : この更新プログラムをインストールすると、Windows の問題が修
正されます。この更新プログラムの対象となる問題の完全な一覧
については、サポート技術情報を参照してください。インストール
後には、コンピュータの再起動が必要になる場合があります。
IsImportant : False
2つのWindowsUpdatesが適用できたので、再度、AWS-FindWindowsUpdatesを実行してみました。
WIN-T9B0NO61KR5 - PatchNow Assessment Results - 2016-12-11T11:42:33.985
Important Updates: 0
Critical: 0
Important: 0
Moderate: 0
Low: 0
Unspecified: 0
Optional Updates: 0
Total Updates: 0
WIndowsUpdatesがしっかりと適用され、未適用のパッチはなくなりました。
まとめ
いかがでしょうか。Run Commandを使うことで、WIndowsにログインすることなく、WindowsUpdatesの適用をリモートで実施することができました。
System Managerは他にもたくさんの機能がありますので、うまく使うことで効率的なサーバ管理を可能にし、今までと全く異なった運用スタイルを実現できます。
他の機能も今後検証し、紹介していきたいと思います。