◾️はじめに
https://dk521123.hatenablog.com/entry/2019/10/05/121119
の続き。 今回は、AWS SSM Document(Systems Manager Document) について、 メモしておく
目次
【1】AWS SSM Document 1)利点 【2】ドキュメントの作成 1)構文 2)サンプル
【1】AWS SSM Document
* SSMで実行する操作を定義したもの
1)利点
* 決まったコマンド群を定義することにより、複雑な処理が簡単に操作可能 => オペレーションミスを減らすことができる
【2】ドキュメントの作成
* YAML/JSON 形式で定義 * 作成する手順は、以下の公式ドキュメント参照
https://docs.aws.amazon.com/ja_jp/systems-manager/latest/userguide/create-ssm-console.html
1)構文
* 以下の公式ドキュメントを見ながら作れば良さそう
2)サンプル
schemaVersion: "2.2" description: "Hello world Document" assumeRole: '{{ AutomationAssumeRole }}' ## 【parameters】に実行時のパラメータを定義 parameters: workingDirectory: # type: (必須) String、StringList、Integer、Boolean、MapList、StringMap type: "String" default: "/home/user/work" description: "実行ディレクトリ" executionTimeout: type: "String" default: "36000" description: "最大実行時間" inputData: type: "String" default: "HelloWorld" description: "入力値" allowedValues: - HelloWorld - Hi - Thanks ## 【mainSteps】に処理ステップを定義 mainSteps: - action: "aws:runShellScript" name: "HelloWorld" inputs: runCommand: - "echo {{ inputData }}" workingDirectory: "{{ workingDirectory }}" timeoutSeconds: "{{ executionTimeout }}"
参考文献
https://dev.classmethod.jp/articles/ssm-document-first/
https://qiita.com/myoshioka/items/c9294fc8f02d8578dff4
関連記事
AWS Systems Manager ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2019/10/05/121119
AWS Systems Manager ~ Parameter Store ~
https://dk521123.hatenablog.com/entry/2020/01/31/231636
AWS Systems Manager ~ Session Manager ~
https://dk521123.hatenablog.com/entry/2020/04/09/215235
AWS Systems Manager ~ AWS CLI ~
https://dk521123.hatenablog.com/entry/2024/05/01/000000