Amazon が所有する AWS Systems Manager ドキュメントの一覧を AWS CLI で取得して眺めてみた

まだ見ぬ便利機能を求めて。

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

コンバンハ、千葉(幸)です。

先日、以下のエントリを書きました。

ここでは、 SSM オートメーションドキュメントの一種であるAWSSupport-TroubleshootRDPを使用し、 EC2 インスタンス上の OS に操作を行う、ということを試しました。

コマンドを一切考慮する必要がなく、ドキュメントを実行するだけで事前定義された内容を適用できました。そんなところがとても便利だなと感じたので、他にどういったドキュメントが用意されているのか気になってきました。

AWS CLI を使用すれば簡単に一覧が取得できたので、その結果を記載します。

先に補足

  • ドキュメントは全部で 250個超あった
  • 特に Automation と Command ドキュメントの種類が豊富
  • 「プラットフォーム」の部分の情報は参考程度にした方が良さそう
  • すべて 2021年3月現在の情報です

AWS Systems Manager ドキュメントとは

一覧を確認する前に、少しおさらいしておきましょう。

AWS Systems Manager ドキュメントは、Systems Manager が実行するアクションが定義されたドキュメントです。

いくつかドキュメントタイプがあり、タイプによって使用される機能が異なります。

ドキュメントタイプ 使用する機能
コマンド Run Command、ステートマネージャー、メンテナンスウインドウ
オートメーション オートメーション、ステートマネージャー、メンテナンスウインドウ
パッケージ ディストリビューター
セッション セッションマネージャー
ポリシー ステートマネージャー
変更カレンダー Change Calendar

Amazon が所有するものがあるほか、カスタマー側で作成することもできます。他のアカウントと共有したり、パブリックに公開することもできます。

詳細は以下を参照してください。

Amazon が所有するドキュメントのタイプを確認する

今回は以下の AWS CLI コマンドを使用し、 SSM ドキュメントをリスト化します。

先に結論から言うと、 Amazon が所有するドキュメントは 250個以上あります。

一気に出力しても分かりづらいので、まずはどういったドキュメントタイプが用意されているかを確認します。

aws ssm list-documents\
 --filters Key=Owner,Values=Amazon\
 --query 'DocumentIdentifiers[*].[DocumentType]'\
 --output text\
 | sort | uniq

Automation
Automation.ChangeTemplate
Command
Package
Policy
Session

以下のドキュメントタイプが該当することが分かりました。

  • Automation
  • Automation.ChangeTemplate
  • Command
  • Package
  • Policy
  • Session

ちなみに、AWS CLI リファレンスで確認できるドキュメントタイプは以下の通りです。

  • ApplicationConfiguration
  • ApplicationConfigurationSchema
  • Automation
  • ChangeCalendar
  • Command
  • DeploymentStrategy
  • Package
  • Policy
  • Session

冒頭で確認したドキュメントタイプに当てはまらないものがあるし、コマンドで確認した結果のAutomation.ChangeTemplateが CLI リファレンスに載ってないしで、いろいろと気になる部分はあるのですが、深追いはしないでおきましょう。

ドキュメントの一覧を出力してみた

今回は以下のコマンドを使用して一覧を確認していきます。

aws ssm list-documents --output table \
 --filters Key=Owner,Values=Amazon Key=DocumentType,Values=<ドキュメントタイプ>\
 --query 'DocumentIdentifiers[*].{DocumentName:Name, DocumentType:DocumentType,Platform1:PlatformTypes[0],Platform2:PlatformTypes[1],Platform3:PlatformTypes[2],Format:DocumentFormat,TargetType:TargetType,DocVer:DocumentVersion,Schema:SchemaVersion}'

ドキュメントタイプごとに、以下の情報を出力します。

  • ドキュメントバージョン
  • ドキュメント名
  • ドキュメントタイプ
  • フォーマット
    • JSON or YAML
  • プラットフォーム
  • スキーマバージョン
  • ターゲットタイプ

各項目について補足

上記で太字にした項目について補足します。

プラットフォーム

プラットフォームには、以下の値が入ります。

  • Windows
  • Linux

複数の値が入ることもあれば、一つも入らないこともあります。Systems Manager ドキュメントが対応している OS プラットフォームを表すものですが、直感的に受ける印象とは異なる場合が多いので、参考程度に捉えるのがよいかと思います。

また、AWS CLI は最新のバージョン(2.1.29)を使用したのですが、コマンドの結果と AWS リファレンスで確認できるものとは違いがあるように見受けられました。

例えば以下のリファレンスではプラットフォームとしてWindowsのみが記載されているのですが、aws ssm list-documents の結果ではWindowsLinuxが含まれています。

加えて、以下のリファレンスのようにプラットフォームとしてmacOS が記載されているドキュメントは複数あるのですが、aws ssm list-documents の結果としてmacOSが含まれるドキュメントはありませんでした。

ざっと見ただけでもかなり差異がありそうだったので、やはりここでの結果は参考程度にするのが良さそうです。

スキーマバージョン

スキーマバージョンは、ドキュメントのタイプごとに対応しているバージョンが異なります。詳細については以下を参照してください。

ターゲットタイプ

ターゲットタイプはドキュメントの実行対象となる AWS リソースのタイプを表すものですが、これも直感的には理解しづらい場合があります。こちらも参考程度に捉えるのがいいでしょう。ほぼオートメーションドキュメントでのみ値が入ります。

早速一覧を確認していきます。

Automation ドキュメント

一番種類が豊富です。

AWSSupport-の接頭辞を持つものはトラブルシュートの用途で使用できますし、AWSConfigRemediation-の接頭辞を持つものは Config ルールと組み合わせて修復アクションとして使用するために準備されたものです。(単体でも実行できます。)

% aws ssm list-documents --output table \
 --filters Key=Owner,Values=Amazon Key=DocumentType,Values=Automation\
 --query 'DocumentIdentifiers[*].{DocumentName:Name, DocumentType:DocumentType,Platform1:PlatformTypes[0],Platform2:PlatformTypes[1],Platform3:PlatformTypes[2],Format:DocumentFormat,TargetType:TargetType,DocVer:DocumentVersion,Schema:SchemaVersion}'
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|                                                                                               ListDocuments                                                                                               |
+--------+------------------------------------------------------------------------+---------------+---------+------------+------------+------------+---------+----------------------------------------------+
| DocVer |                             DocumentName                               | DocumentType  | Format  | Platform1  | Platform2  | Platform3  | Schema  |                 TargetType                   |
+--------+------------------------------------------------------------------------+---------------+---------+------------+------------+------------+---------+----------------------------------------------+
|  1     |  AWS-ASGEnterStandby                                                   |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Volume                           |
|  1     |  AWS-ASGExitStandby                                                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Volume                           |
|  1     |  AWS-AttachEBSVolume                                                   |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-AttachIAMToInstance                                               |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-ConfigureCloudTrailLogging                                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-ConfigureCloudWatchOnEC2Instance                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-ConfigureS3BucketLogging                                          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::S3::Bucket                            |
|  1     |  AWS-ConfigureS3BucketVersioning                                       |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::S3::Bucket                            |
|  1     |  AWS-CopySnapshot                                                      |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Snapshot                         |
|  1     |  AWS-CreateDynamoDbBackup                                              |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-CreateImage                                                       |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-CreateJiraIssue                                                   |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-CreateManagedLinuxInstance                                        |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-CreateManagedLinuxInstanceWithApproval                            |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-CreateManagedWindowsInstance                                      |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-CreateManagedWindowsInstanceWithApproval                          |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-CreateRdsSnapshot                                                 |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWS-CreateServiceNowIncident                                          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-CreateSnapshot                                                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Volume                           |
|  1     |  AWS-DeleteCloudFormationStack                                         |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CloudFormation::Stack                 |
|  1     |  AWS-DeleteCloudFormationStackWithApproval                             |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CloudFormation::Stack                 |
|  1     |  AWS-DeleteDynamoDbBackup                                              |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-DeleteDynamoDbTableBackups                                        |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-DeleteEKSCluster                                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-DeleteEbsVolumeSnapshots                                          |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Volume                           |
|  1     |  AWS-DeleteImage                                                       |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-DeleteSnapshot                                                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Snapshot                         |
|  1     |  AWS-DetachEBSVolume                                                   |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Volume                           |
|  1     |  AWS-DisablePublicAccessForSecurityGroup                               |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::SecurityGroup                    |
|  1     |  AWS-DisableS3BucketPublicReadWrite                                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::S3::Bucket                            |
|  1     |  AWS-EnableCloudTrail                                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-EnableExplorer                                                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-EnableS3BucketEncryption                                          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::S3::Bucket                            |
|  1     |  AWS-ExportOpsDataToS3                                                 |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-HelloWorld                                                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-PatchAsgInstance                                                  |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-PatchInstanceWithRollback                                         |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-PublishSNSNotification                                            |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::SNS::Topic                            |
|  1     |  AWS-RebootRdsInstance                                                 |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWS-ReleaseElasticIP                                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::EIP                              |
|  1     |  AWS-ResizeInstance                                                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-RestartEC2Instance                                                |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-RestartEC2InstanceWithApproval                                    |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-RunCfnLint                                                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-RunPacker                                                         |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-SetupInventory                                                    |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-SetupManagedInstance                                              |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-SetupManagedRoleOnEc2Instance                                     |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-StartEC2Instance                                                  |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-StartEC2InstanceWithApproval                                      |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-StartRdsInstance                                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWS-StopEC2Instance                                                   |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-StopEC2InstanceWithApproval                                       |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-StopRdsInstance                                                   |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWS-TerminateEC2Instance                                              |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-TerminateEC2InstanceWithApproval                                  |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWS-UpdateCloudFormationStack                                         |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CloudFormation::Stack                 |
|  1     |  AWS-UpdateCloudFormationStackWithApproval                             |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CloudFormation::Stack                 |
|  1     |  AWS-UpdateEKSManagedNodegroupVersion                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-UpdateLinuxAmi                                                    |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWS-UpdateWindowsAmi                                                  |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  6     |  AWSSupport-ActivateWindowsWithAmazonLicense                           |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSSupport-CheckAndMountEFS                                           |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSSupport-CollectEKSInstanceLogs                                     |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSSupport-ConnectivityTroubleshooter                                 |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  13    |  AWSSupport-ExecuteEC2Rescue                                           |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  5     |  AWSSupport-GrantPermissionsToIAMUser                                  |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  4     |  AWSSupport-ListEC2Resources                                           |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  2     |  AWSSupport-ManageRDPSettings                                          |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  4     |  AWSSupport-ManageWindowsService                                       |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  2     |  AWSSupport-MigrateEC2ClassicToVPC                                     |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSSupport-RecoverWorkSpace                                           |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSSupport-RecoverWorkSpaceWithApproval                               |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  10    |  AWSSupport-ResetAccess                                                |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  5     |  AWSSupport-SendLogBundleToS3Bucket                                    |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSSupport-SetupConfig                                                |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  2     |  AWSSupport-SetupIPMonitoringFromVPC                                   |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  2     |  AWSSupport-ShareRDSSnapshot                                           |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  11    |  AWSSupport-StartEC2RescueWorkflow                                     |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  2     |  AWSSupport-TerminateIPMonitoringFromVPC                               |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSSupport-TroubleshootConnectivityToRDS                              |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSSupport-TroubleshootDirectoryTrust                                 |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  3     |  AWSSupport-TroubleshootRDP                                            |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  4     |  AWSSupport-TroubleshootS3PublicRead                                   |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  2     |  AWSSupport-TroubleshootSSH                                            |  Automation   |  JSON   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  6     |  AWSSupport-UpgradeWindowsAWSDrivers                                   |  Automation   |  JSON   |  Windows   |  None      |  None      |  0.3    |  None                                        |
|  13    |  AWSEC2-CloneInstanceAndUpgradeSQLServer                               |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  18    |  AWSEC2-CloneInstanceAndUpgradeWindows                                 |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  6     |  AWSEC2-CloneInstanceAndUpgradeWindows2019                             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  3     |  AWSEC2-SQLServerDBRestore                                             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSDocs-ClassicLoadBalancerSSMDocument                                |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSDocs-Configure-SSL-TLS-AL                                          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSDocs-Configure-SSL-TLS-AL2                                         |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  3     |  AWSDocs-HostingAWordPressBlog-AL                                      |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  3     |  AWSDocs-HostingAWordPressBlog-AL2                                     |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSDocs-IncreaseAppAvailability                                       |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  4     |  AWSDocs-InstallALAMPServer-AL                                         |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  4     |  AWSDocs-InstallALAMPServer-AL2                                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSDocs-LambdaWithS3SSMDocument                                       |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSDocs-S3StaticWebsite                                               |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSDocs-S3StaticWebsiteCustomDomain                                   |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSDocs-ScaleLoadBalanced                                             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  2     |  AWSConfigRemediation-CancelKeyDeletion                                |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::KMS::Key                              |
|  1     |  AWSConfigRemediation-ConfigureCodeBuildProjectWithKMSCMK              |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CodeBuild::Project                    |
|  1     |  AWSConfigRemediation-ConfigureLambdaFunctionXRayTracing               |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Lambda::Function                      |
|  1     |  AWSConfigRemediation-ConfigureS3BucketPublicAccessBlock               |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::S3::Bucket                            |
|  2     |  AWSConfigRemediation-ConfigureS3PublicAccessBlock                     |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  2     |  AWSConfigRemediation-CreateCloudTrailMultiRegionTrail                 |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CloudTrail::Trail                     |
|  1     |  AWSConfigRemediation-CreateGuardDutyDetector                          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  None                                        |
|  1     |  AWSConfigRemediation-DeleteAPIGatewayStage                            |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::ApiGateway::Stage                     |
|  1     |  AWSConfigRemediation-DeleteAccessKeysFromCodeBuildProject             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CodeBuild::Project                    |
|  1     |  AWSConfigRemediation-DeleteDefaultVPCRoutes                           |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::RouteTable                       |
|  1     |  AWSConfigRemediation-DeleteDynamoDbTable                              |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::DynamoDB::Table                       |
|  1     |  AWSConfigRemediation-DeleteEgressOnlyInternetGateway                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::EgressOnlyInternetGateway        |
|  1     |  AWSConfigRemediation-DeleteElasticsearchDomain                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Elasticsearch::Domain                 |
|  1     |  AWSConfigRemediation-DeleteIAMRole                                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::IAM:Role                              |
|  1     |  AWSConfigRemediation-DeleteLambdaFunction                             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Lambda::Function                      |
|  1     |  AWSConfigRemediation-DeleteRDSCluster                                 |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBCluster                        |
|  1     |  AWSConfigRemediation-DeleteRDSInstanceSnapshot                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWSConfigRemediation-DeleteRedshiftCluster                            |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Redshift::Cluster                     |
|  2     |  AWSConfigRemediation-DeleteUnusedEBSVolume                            |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Volume                           |
|  1     |  AWSConfigRemediation-DeleteUnusedENI                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::NetworkInterface                 |
|  1     |  AWSConfigRemediation-DeleteUnusedIAMGroup                             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::IAM::Group                            |
|  1     |  AWSConfigRemediation-DeleteUnusedSecurityGroup                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::SecurityGroup                    |
|  1     |  AWSConfigRemediation-DeleteUnusedVPCNetworkACL                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::NetworkAcl                       |
|  1     |  AWSConfigRemediation-DetachIAMPolicy                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::IAM::Policy                           |
|  1     |  AWSConfigRemediation-DisableSubnetAutoAssignPublicIP                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Subnet                           |
|  1     |  AWSConfigRemediation-EnableAPIGatewayTracing                          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::ApiGateway::Stage                     |
|  1     |  AWSConfigRemediation-EnableAccountAccessAnalyzer                      |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::AccessAnalyzer::Analyzer              |
|  1     |  AWSConfigRemediation-EnableCLBCrossZoneLoadBalancing                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::ElasticLoadBalancing::LoadBalancer    |
|  1     |  AWSConfigRemediation-EnableCloudFrontOriginAccessIdentity             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CloudFront::Distribution              |
|  1     |  AWSConfigRemediation-EnableCloudFrontOriginFailover                   |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CloudFront::Distribution              |
|  1     |  AWSConfigRemediation-EnableCloudFrontViewerPolicyHTTPS                |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::CloudFront::Distribution              |
|  1     |  AWSConfigRemediation-EnableCopyTagsToSnapshotOnRDSCluster             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBCluster                        |
|  1     |  AWSConfigRemediation-EnableCopyTagsToSnapshotOnRDSDBInstance          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::Instance                         |
|  1     |  AWSConfigRemediation-EnableELBDeletionProtection                      |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::ElasticLoadBalancingV2::LoadBalancer  |
|  1     |  AWSConfigRemediation-EnableEbsEncryptionByDefault                     |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::::Account                             |
|  1     |  AWSConfigRemediation-EnableElasticBeanstalkEnvironmentLogStreaming    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::ElasticBeanstalk::Environment         |
|  1     |  AWSConfigRemediation-EnableEncryptionOnDynamoDbTable                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::DynamoDB::Table                       |
|  2     |  AWSConfigRemediation-EnableEnhancedMonitoringOnRDSInstance            |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWSConfigRemediation-EnableKeyRotation                                |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::KMS::Key                              |
|  1     |  AWSConfigRemediation-EnableLoggingForALBAndCLB                        |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::ElasticLoadBalancing::LoadBalancer    |
|  1     |  AWSConfigRemediation-EnableMinorVersionUpgradeOnRDSDBInstance         |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWSConfigRemediation-EnableMultiAZOnRDSInstance                       |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWSConfigRemediation-EnableNLBCrossZoneLoadBalancing                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::ElasticLoadBalancingV2::LoadBalancer  |
|  1     |  AWSConfigRemediation-EnablePITRForDynamoDbTable                       |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::DynamoDB::Table                       |
|  1     |  AWSConfigRemediation-EnablePerformanceInsightsOnRDSInstance           |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWSConfigRemediation-EnableRDSClusterDeletionProtection               |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBCluster                        |
|  1     |  AWSConfigRemediation-EnableRDSInstanceBackup                          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWSConfigRemediation-EnableRDSInstanceDeletionProtection              |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWSConfigRemediation-EnableRedshiftClusterAuditLogging                |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Redshift::Cluster                     |
|  1     |  AWSConfigRemediation-EnableRedshiftClusterAutomatedSnapshot           |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Redshift::Cluster                     |
|  1     |  AWSConfigRemediation-EnableRedshiftClusterEncryption                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Redshift::Cluster                     |
|  1     |  AWSConfigRemediation-EnableRedshiftClusterEnhancedVPCRouting          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Redshift::Cluster                     |
|  1     |  AWSConfigRemediation-EnableSecurityHub                                |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::SecurityHub::Hub                      |
|  1     |  AWSConfigRemediation-EnableSystemsManagerSessionManagerAuditLogsToS3  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::SSM::Document                         |
|  1     |  AWSConfigRemediation-EnableWAFClassicRegionalLogging                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::WAFRegional::WebACL                   |
|  1     |  AWSConfigRemediation-EncryptLambdaEnvironmentVariablesWithCMK         |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Lambda::Function                      |
|  1     |  AWSConfigRemediation-EncryptSNSTopic                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::SNS::Topic                            |
|  1     |  AWSConfigRemediation-EnforceEC2InstanceIMDSv2                         |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  1     |  AWSConfigRemediation-EnforceHttpsOnEsDomain                           |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Elasticsearch::Domain                 |
|  1     |  AWSConfigRemediation-EnforceSSLOnlyConnectionsToRedshiftCluster       |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Redshift::Cluster                     |
|  1     |  AWSConfigRemediation-ModifyRDSInstancePortNumber                      |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::RDS::DBInstance                       |
|  1     |  AWSConfigRemediation-ModifyRedshiftClusterMaintenanceSettings         |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Redshift::Cluster                     |
|  1     |  AWSConfigRemediation-ModifyRedshiftClusterNodeType                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Redshift::Cluster                     |
|  1     |  AWSConfigRemediation-MoveLambdaToVPC                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Lambda::Function                      |
|  1     |  AWSConfigRemediation-RemoveVPCDefaultSecurityGroupRules               |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::SecurityGroup                    |
|  1     |  AWSConfigRemediation-RevokeUnusedIAMUserCredentials                   |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Lambda::Function                      |
|  1     |  AWSConfigRemediation-RotateSecret                                     |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::SecretsManager::Secret                |
|  1     |  AWSConfigRemediation-SetIAMPasswordPolicy                             |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::::Account                             |
|  1     |  AWSConfigRemediation-UpdateAPIGatewayMethodCaching                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::ApiGateway::Stage                     |
|  1     |  AWSConfigRemediation-UpdateElasticsearchDomainSecurityGroups          |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::Elasticsearch::Domain                 |
|  1     |  AWSConfigRemediation-UpdateXRayKMSKey                                 |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::XRay::EncryptionConfig                |
|  2     |  AWSSQLServer-Backup                                                   |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  2     |  AWSSQLServer-DBCC                                                     |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  2     |  AWSSQLServer-Index                                                    |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
|  2     |  AWSSQLServer-Restore                                                  |  Automation   |  YAML   |  Windows   |  Linux     |  None      |  0.3    |  /AWS::EC2::Instance                         |
+--------+------------------------------------------------------------------------+---------------+---------+------------+------------+------------+---------+----------------------------------------------+

よくあるマネジメントコンソール上での操作に対応したドキュメントがあるため、手順書を作ったり手作業で操作する代わりにオートメーションドキュメントを実行する、という置き換えもできそうですね。

各ドキュメントの詳細は以下から確認できます。

Automation.ChangeTemplate ドキュメント

こちらの結果は一つだけです。

% aws ssm list-documents --output table \
 --filters Key=Owner,Values=Amazon Key=DocumentType,Values=Automation.ChangeTemplate\
 --query 'DocumentIdentifiers[*].{DocumentName:Name, DocumentType:DocumentType,Platform1:PlatformTypes[0],Platform2:PlatformTypes[1],Platform3:PlatformTypes[2],Format:DocumentFormat,TargetType:TargetType,DocVer:DocumentVersion,Schema:SchemaVersion}'
 
--------------------------------------------------------------------------------------------------------------------------------------------------
|                                                                  ListDocuments                                                                 |
+--------+-------------------------------+----------------------------+---------+------------+------------+------------+----------+--------------+
| DocVer |         DocumentName          |       DocumentType         | Format  | Platform1  | Platform2  | Platform3  | Schema   | TargetType   |
+--------+-------------------------------+----------------------------+---------+------------+------------+------------+----------+--------------+
|  1     |  AWS-HelloWorldChangeTemplate |  Automation.ChangeTemplate |  YAML   |  None      |  None      |  None      |  0.3     |  None        |
+--------+-------------------------------+----------------------------+---------+------------+------------+------------+----------+--------------+

個別の内容を確認すると以下の通り。

% aws ssm get-document --name AWS-HelloWorldChangeTemplate
{
    "Name": "AWS-HelloWorldChangeTemplate",
    "DocumentVersion": "1",
    "Status": "Active",
    "Content": "{\n  \"description\" : \"This change template demonstrates the feature set available for creating change templates for Change Manager. This template starts a Runbook workflow for the Automation document called AWS-HelloWorld.\",\n  \"templateInformation\" : \"### Document Name: HelloWorldChangeTemplate\\n\\n## What does this document do?\\nThis change template demonstrates the feature set available for creating change templates for Change Manager. This template starts a Runbook workflow for the Automation document called AWS-HelloWorld.\\n\\n## Input Parameters\\n* ApproverSnsTopicArn: (Required) Amazon Simple Notification Service ARN for approvers.\\n* Approver: (Required) The name of the approver to send this request to.\\n* ApproverType: (Required) The type of reviewer.\\n  * Allowed Values: IamUser, IamGroup, IamRole, SSOGroup, SSOUser\\n\\n## Output Parameters\\nThis document has no outputs \\n\",\n  \"schemaVersion\" : \"0.3\",\n  \"parameters\" : {\n    \"ApproverSnsTopicArn\" : {\n      \"type\" : \"String\",\n      \"description\" : \"Amazon Simple Notification Service ARN for approvers.\"\n    },\n    \"Approver\" : {\n      \"type\" : \"String\",\n      \"description\" : \"IAM approver\"\n    },\n    \"ApproverType\" : {\n      \"type\" : \"String\",\n      \"description\" : \"Approver types for the request. Allows values include IamUser, IamGroup, IamRole, SSOGroup, and SSOUser.\"\n    }\n  },\n  \"executableRunBooks\" : [ {\n    \"name\" : \"AWS-HelloWorld\",\n    \"version\" : \"1\"\n  } ],\n  \"emergencyChange\" : false,\n  \"mainSteps\" : [ {\n    \"name\" : \"SimpleApproveAction\",\n    \"action\" : \"aws:approve\",\n    \"timeoutSeconds\" : 3600,\n    \"inputs\" : {\n      \"Message\" : \"A sample change request has been submitted for your review in Change Manager. You can approve or reject this request.\",\n      \"EnhancedApprovals\" : {\n        \"NotificationArn\" : \"{{ ApproverSnsTopicArn }}\",\n        \"Approvers\" : [ {\n          \"approver\" : \"{{ Approver }}\",\n          \"type\" : \"{{ ApproverType }}\",\n          \"minRequiredApprovals\" : 1\n        } ]\n      }\n    }\n  } ]\n}",
    "DocumentType": "Automation.ChangeTemplate",
    "DocumentFormat": "JSON",
    "ReviewStatus": "APPROVED"
}

これは先日のアップデートで対応した新機能 Systems Manager 変更マネージャーのためのドキュメントですね。使用イメージは以下エントリをご参照ください。

Command ドキュメント

OS に対して直接アクションを実行するものはこの括りになっていることが多いです。以下を使用したことがある方は多いのではないでしょうか。

  • AWS-RunPowerShellScript
  • AWS-RunShellScript
% aws ssm list-documents --output table \
 --filters Key=Owner,Values=Amazon Key=DocumentType,Values=Command\
 --query 'DocumentIdentifiers[*].{DocumentName:Name, DocumentType:DocumentType,Platform1:PlatformTypes[0],Platform2:PlatformTypes[1],Platform3:PlatformTypes[2],Format:DocumentFormat,TargetType:TargetType,DocVer:DocumentVersion,Schema:SchemaVersion}'
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|                                                                           ListDocuments                                                                           |
+--------+----------------------------------------------------------------+---------------+---------+------------+------------+------------+---------+--------------+
| DocVer |                         DocumentName                           | DocumentType  | Format  | Platform1  | Platform2  | Platform3  | Schema  | TargetType   |
+--------+----------------------------------------------------------------+---------------+---------+------------+------------+------------+---------+--------------+
|  1     |  AWS-ApplyAnsiblePlaybooks                                     |  Command      |  JSON   |  Linux     |  None      |  None      |  2.2    |  None        |
|  1     |  AWS-ApplyChefRecipes                                          |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  1     |  AWS-ApplyDSCMofs                                              |  Command      |  JSON   |  Windows   |  None      |  None      |  2.2    |  None        |
|  1     |  AWS-ApplyPatchBaseline                                        |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-ConfigureAWSPackage                                       |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.0    |  None        |
|  1     |  AWS-ConfigureCloudWatch                                       |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-ConfigureDocker                                           |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.0    |  None        |
|  1     |  AWS-ConfigureKernelLivePatching                               |  Command      |  YAML   |  Linux     |  None      |  None      |  2.2    |  None        |
|  1     |  AWS-ConfigureWindowsUpdate                                    |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-FindWindowsUpdates                                        |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-InstallApplication                                        |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-InstallMissingWindowsUpdates                              |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-InstallPowerShellModule                                   |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-InstallSpecificWindowsUpdates                             |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-InstallWindowsUpdates                                     |  Command      |  YAML   |  Windows   |  None      |  None      |  2.2    |  None        |
|  1     |  AWS-JoinDirectoryServiceDomain                                |  Command      |  JSON   |  Windows   |  Linux     |  None      |  1.2    |  None        |
|  1     |  AWS-ListWindowsInventory                                      |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-RefreshAssociation                                        |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.0    |  None        |
|  1     |  AWS-RunAnsiblePlaybook                                        |  Command      |  JSON   |  Linux     |  None      |  None      |  2.0    |  None        |
|  1     |  AWS-RunDockerAction                                           |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.0    |  None        |
|  1     |  AWS-RunDocument                                               |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  1     |  AWS-RunInspecChecks                                           |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  1     |  AWS-RunPatchBaseline                                          |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  1     |  AWS-RunPatchBaselineAssociation                               |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  1     |  AWS-RunPatchBaselineWithHooks                                 |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  1     |  AWS-RunPowerShellScript                                       |  Command      |  JSON   |  Windows   |  Linux     |  None      |  1.2    |  None        |
|  1     |  AWS-RunRemoteScript                                           |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  1     |  AWS-RunSaltState                                              |  Command      |  JSON   |  Linux     |  None      |  None      |  2.0    |  None        |
|  1     |  AWS-RunShellScript                                            |  Command      |  JSON   |  Linux     |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-UpdateEC2Config                                           |  Command      |  JSON   |  Windows   |  None      |  None      |  1.2    |  None        |
|  1     |  AWS-UpdateSSMAgent                                            |  Command      |  JSON   |  Windows   |  Linux     |  None      |  1.2    |  None        |
|  12    |  AmazonInspector-ManageAWSAgent                                |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  6     |  AmazonCloudWatch-ManageAgent                                  |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  2     |  AmazonCloudWatch-MigrateCloudWatchAgent                       |  Command      |  JSON   |  Windows   |  None      |  None      |  2.2    |  None        |
|  14    |  AWSSupport-RunEC2RescueForWindowsTool                         |  Command      |  JSON   |  Windows   |  None      |  None      |  2.2    |  None        |
|  5     |  AWSSAP-InstallBackint                                         |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  2     |  AWSEC2-ApplicationInsightsCloudwatchAgentInstallAndConfigure  |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  2     |  AWSEC2-CheckPerformanceCounterSets                            |  Command      |  JSON   |  Windows   |  None      |  None      |  2.2    |  None        |
|  5     |  AWSEC2-ConfigureSTIG                                          |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  7     |  AWSEC2-CreateVssSnapshot                                      |  Command      |  JSON   |  Windows   |  None      |  None      |  2.2    |  None        |
|  2     |  AWSEC2-DetectWorkload                                         |  Command      |  JSON   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  7     |  AWSEC2-ManageVssIO                                            |  Command      |  JSON   |  Windows   |  None      |  None      |  2.2    |  None        |
|  6     |  AWSEC2-RunSysprep                                             |  Command      |  JSON   |  Windows   |  None      |  None      |  2.2    |  None        |
|  4     |  AWSEC2Launch-RunMigration                                     |  Command      |  JSON   |  Windows   |  None      |  None      |  2.2    |  None        |
|  8     |  AWSFleetManager-AddUsersToGroups                              |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  8     |  AWSFleetManager-CreateGroup                                   |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  8     |  AWSFleetManager-CreateUser                                    |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  6     |  AWSFleetManager-CreateWindowsRegistryKey                      |  Command      |  YAML   |  Windows   |  None      |  None      |  2.2    |  None        |
|  8     |  AWSFleetManager-DeleteGroup                                   |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  8     |  AWSFleetManager-DeleteUser                                    |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  6     |  AWSFleetManager-DeleteWindowsRegistryKey                      |  Command      |  YAML   |  Windows   |  None      |  None      |  2.2    |  None        |
|  6     |  AWSFleetManager-DeleteWindowsRegistryValue                    |  Command      |  YAML   |  Windows   |  None      |  None      |  2.2    |  None        |
|  4     |  AWSFleetManager-GetFileSystemContent                          |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  7     |  AWSFleetManager-GetGroups                                     |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  4     |  AWSFleetManager-GetUsers                                      |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  6     |  AWSFleetManager-GetWindowsEvents                              |  Command      |  YAML   |  Windows   |  None      |  None      |  2.2    |  None        |
|  1     |  AWSFleetManager-GetWindowsRegistryContent                     |  Command      |  YAML   |  Windows   |  None      |  None      |  2.2    |  None        |
|  8     |  AWSFleetManager-RemoveUsersFromGroups                         |  Command      |  YAML   |  Windows   |  Linux     |  None      |  2.2    |  None        |
|  6     |  AWSFleetManager-SetWindowsRegistryValue                       |  Command      |  YAML   |  Windows   |  None      |  None      |  2.2    |  None        |
+--------+----------------------------------------------------------------+---------------+---------+------------+------------+------------+---------+--------------+

AWSFleetManager-接頭辞を持つものがいくつかあります。これは変更マネージャーと同じく去年のアップデートで対応した、 Systems Manager フリートマネージャーに関連するものです。

詳細は以下を参照してください。

Package ドキュメント

Package ドキュメントは Systems Manager ディストリビューターで使用するものです。AWS 謹製のツールをインストールする際に使用できます。

% aws ssm list-documents --output table \
 --filters Key=Owner,Values=Amazon Key=DocumentType,Values=Package\
 --query 'DocumentIdentifiers[*].{DocumentName:Name, DocumentType:DocumentType,Platform1:PlatformTypes[0],Platform2:PlatformTypes[1],Platform3:PlatformTypes[2],Format:DocumentFormat,TargetType:TargetType,DocVer:DocumentVersion,Schema:SchemaVersion,Owner:Owner}'
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|                                                                                  ListDocuments                                                                                  |
+--------+-----------------------------------------------------------+---------------+---------+---------+------------+------------+------------+---------+-----------------------+
| DocVer |                       DocumentName                        | DocumentType  | Format  |  Owner  | Platform1  | Platform2  | Platform3  | Schema  |      TargetType       |
+--------+-----------------------------------------------------------+---------------+---------+---------+------------+------------+------------+---------+-----------------------+
|  28    |  AmazonCloudWatchAgent                                    |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  5     |  AWSSupport-EC2Rescue                                     |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  4     |  AWSSAP-Backint                                           |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  9     |  AWSEC2Launch-Agent                                       |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  4     |  AmazonEFSUtils                                           |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  3     |  AWSObservabilityExporter-JMXExporterInstallAndConfigure  |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  6     |  AWSCodeDeployAgent                                       |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  /AWS::EC2::Instance  |
|  3     |  AWSKinesisTap                                            |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  5     |  AwsVssComponents                                         |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  13    |  AWSPVDriver                                              |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  2     |  AWSNVMe                                                  |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
|  9     |  AwsEnaNetworkDriver                                      |  Package      |  JSON   |  Amazon |  None      |  None      |  None      |  2.0    |  None                 |
+--------+-----------------------------------------------------------+---------------+---------+---------+------------+------------+------------+---------+-----------------------+

また、所有者がThirdPartyとなるドキュメントも存在するので確認してみます。( Owner で複数条件が指定できると嬉しかったです、、)

% aws ssm list-documents --output table \
 --filters Key=Owner,Values=ThirdParty Key=DocumentType,Values=Package\
 --query 'DocumentIdentifiers[*].{DocumentName:Name, DocumentType:DocumentType,Platform1:PlatformTypes[0],Platform2:PlatformTypes[1],Platform3:PlatformTypes[2],Format:DocumentFormat,TargetType:TargetType,DocVer:DocumentVersion,Schema:SchemaVersion,Owner:Owner}'
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
|                                                                            ListDocuments                                                                           |
+--------+---------------------------------------+---------------+---------+------------------------+------------+------------+------------+----------+--------------+
| DocVer |             DocumentName              | DocumentType  | Format  |         Owner          | Platform1  | Platform2  | Platform3  | Schema   | TargetType   |
+--------+---------------------------------------+---------------+---------+------------------------+------------+------------+------------+----------+--------------+
|  3     |  TrendMicro-CloudOne-WorkloadSecurity |  Package      |  JSON   |  Trend Micro Cloud One |  None      |  None      |  None      |  2.0     |  None        |
|  3     |  DynatraceOneAgent                    |  Package      |  JSON   |  Dynatrace             |  None      |  None      |  None      |  2.0     |  None        |
+--------+---------------------------------------+---------------+---------+------------------------+------------+------------+------------+----------+--------------+

ディストリビューターを使用することで、パッケージ配布を効率的に行うことができます。全体像のイメージは以下を参照してください。

Policy ドキュメント

タイプが Policy のドキュメントは一つだけです。これは Systems Manager インベントリで使用されるものです。

% aws ssm list-documents --output table \
 --filters Key=Owner,Values=Amazon Key=DocumentType,Values=Policy\
 --query 'DocumentIdentifiers[*].{DocumentName:Name, DocumentType:DocumentType,Platform1:PlatformTypes[0],Platform2:PlatformTypes[1],Platform3:PlatformTypes[2],Format:DocumentFormat,TargetType:TargetType,DocVer:DocumentVersion,Schema:SchemaVersion}'
------------------------------------------------------------------------------------------------------------------------------------
|                                                           ListDocuments                                                          |
+--------+------------------------------+---------------+---------+------------+------------+------------+----------+--------------+
| DocVer |        DocumentName          | DocumentType  | Format  | Platform1  | Platform2  | Platform3  | Schema   | TargetType   |
+--------+------------------------------+---------------+---------+------------+------------+------------+----------+--------------+
|  1     |  AWS-GatherSoftwareInventory |  Policy       |  JSON   |  Windows   |  Linux     |  None      |  2.0     |  None        |
+--------+------------------------------+---------------+---------+------------+------------+------------+----------+--------------+

少し長いですが、ドキュメントの内訳は以下のようなものです。

{
  "schemaVersion": "2.0",
  "description": "Software Inventory Policy Document.",
  "parameters": {
    "applications": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional) Collect data for installed applications.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    },
    "awsComponents": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional) Collect data for AWS Components like amazon-ssm-agent.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    },
    "files": {
      "type": "String",
      "default": "",
      "description": "<p>(Optional, requires SSMAgent version 2.2.64.0 and above)<br/><br/>Linux example:<br/><em>[{\"Path\":\"/usr/bin\", \"Pattern\":[\"aws*\", \"*ssm*\"],\"Recursive\":false},{\"Path\":\"/var/log\", \"Pattern\":[\"amazon*.*\"], \"Recursive\":true, \"DirScanLimit\":1000}]<br/></em><br/>Windows example:<br/><em>[{\"Path\":\"%PROGRAMFILES%\", \"Pattern\":[\"*.exe\"],\"Recursive\":true}]</em><br/><br/>Learn More: http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-inventory-about.html#sysman-inventory-file-and-registry  </p>",
      "displayType": "textarea"
    },
    "networkConfig": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional) Collect data for Network configurations.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    },
    "windowsUpdates": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional, Windows OS only) Collect data for all Windows Updates.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    },
    "instanceDetailedInformation": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional) Collect additional information about the instance, including the CPU model, speed, and the number of cores, to name a few.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    },
    "services": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional, Windows OS only, requires SSMAgent version 2.2.64.0 and above) Collect data for service configurations.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    },
    "windowsRegistry": {
      "type": "String",
      "default": "",
      "description": "<p>(Optional, Windows OS only, requires SSMAgent version 2.2.64.0 and above)<br/><br/>Example:<br />[{\"Path\":\"HKEY_CURRENT_CONFIG\\System\",\"Recursive\":true},{\"Path\":\"HKEY_LOCAL_MACHINE\\SOFTWARE\\Amazon\\MachineImage\", \"ValueNames\":[\"AMIName\"]}]<br/><br/>Learn More: http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-inventory-about.html#sysman-inventory-file-and-registry </p>",
      "displayType": "textarea"
    },
    "windowsRoles": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional, Windows OS only, requires SSMAgent version 2.2.64.0 and above) Collect data for Microsoft Windows role configurations.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    },
    "customInventory": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional) Collect data for custom inventory.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    },
    "billingInfo": {
      "type": "String",
      "default": "Enabled",
      "description": "(Optional) Collect billing info for license included applications.",
      "allowedValues": [
        "Enabled",
        "Disabled"
      ]
    }
  },
  "mainSteps": [
    {
      "action": "aws:softwareInventory",
      "name": "collectSoftwareInventoryItems",
      "inputs": {
        "applications": "{{ applications }}",
        "awsComponents": "{{ awsComponents }}",
        "networkConfig": "{{ networkConfig }}",
        "files": "{{ files }}",
        "services": "{{ services }}",
        "windowsRoles": "{{ windowsRoles }}",
        "windowsRegistry": "{{ windowsRegistry}}",
        "windowsUpdates": "{{ windowsUpdates }}",
        "instanceDetailedInformation": "{{ instanceDetailedInformation }}",
        "billingInfo": "{{ billingInfo }}",
        "customInventory": "{{ customInventory }}"
      }
    }
  ]
}

Systems Manager インベントリを使用することで、マネージドインスタンスの各種メタデータを収集可能です。どういった項目を収集するかの定義をこのドキュメントで行っています。

インベントリの使用イメージは以下を参照してください。

Session ドキュメント

最後は Session ドキュメントです。Systems Manager セッションマネージャーで使用されるドキュメントです。

% aws ssm list-documents --output table \
 --filters Key=Owner,Values=Amazon Key=DocumentType,Values=Session\
 --query 'DocumentIdentifiers[*].{DocumentName:Name, DocumentType:DocumentType,Platform1:PlatformTypes[0],Platform2:PlatformTypes[1],Platform3:PlatformTypes[2],Format:DocumentFormat,TargetType:TargetType,DocVer:DocumentVersion,Schema:SchemaVersion}'
-----------------------------------------------------------------------------------------------------------------------------------------------
|                                                                ListDocuments                                                                |
+--------+------------------------------------------+---------------+---------+------------+------------+------------+---------+--------------+
| DocVer |              DocumentName                | DocumentType  | Format  | Platform1  | Platform2  | Platform3  | Schema  | TargetType   |
+--------+------------------------------------------+---------------+---------+------------+------------+------------+---------+--------------+
|  1     |  AWS-PasswordReset                       |  Session      |  JSON   |  Windows   |  Linux     |  None      |  1.0    |  None        |
|  1     |  AWS-StartInteractiveCommand             |  Session      |  JSON   |  Windows   |  Linux     |  None      |  1.0    |  None        |
|  1     |  AWS-StartPortForwardingSession          |  Session      |  JSON   |  Windows   |  Linux     |  None      |  1.0    |  None        |
|  1     |  AWS-StartPortForwardingSessionToSocket  |  Session      |  JSON   |  Windows   |  Linux     |  None      |  1.0    |  None        |
|  1     |  AWS-StartSSHSession                     |  Session      |  JSON   |  Windows   |  Linux     |  None      |  1.0    |  None        |
|  8     |  AWSFleetManager-CreateUserInteractive   |  Session      |  YAML   |  Windows   |  Linux     |  None      |  1.0    |  None        |
|  3     |  AWSFleetManager-GetFileContent          |  Session      |  YAML   |  Windows   |  Linux     |  None      |  1.0    |  None        |
|  3     |  AWSFleetManager-GetPerformanceCounters  |  Session      |  YAML   |  Windows   |  Linux     |  None      |  1.0    |  None        |
|  1     |  AmazonECS-ExecuteInteractiveCommand     |  Session      |  JSON   |  Windows   |  Linux     |  None      |  1.0    |  None        |
+--------+------------------------------------------+---------------+---------+------------+------------+------------+---------+--------------+

例えばAWS-StartSSHSessionを使用する例は以下ページに記載があります。

以下のように IAM ポリシーの中にドキュメントを含めてアクセス制御することもできます。

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "ssm:StartSession",
            "Resource": [
                "arn:aws:ec2:region:987654321098:instance/i-02573cafcfEXAMPLE",
                "arn:aws:ssm:*:*:document/AWS-StartSSHSession"
            ]
        }
    ]
}

終わりに

AWS Systems Manager ドキュメントの一覧を確認してみました。セッション、ポリシーあたりは機能を使用する際に裏側で呼び出されている、というイメージが強いです。「こんな便利そうな機能あったんだ!」という意味ではやはりオートメーションやコマンドドキュメントを眺めるのが楽しかったです。

AWS-PublishSNSNotificationオートメーションドキュメントを修復アクションとして使用し、通知を実現するという使用例もあります。こんな風に使い道はいろいろありそうなので、ステキ用途を探っていきたいです。

以上、千葉(幸)がお送りしました。

参考

--query オプションの指定については以下エントリを参考にさせてもらいました。