2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS.SSM.sendCommand の罠

Posted at

同じことではまらないようにするための備忘録。

TL; DR

SSM.sendCommand で実行タイムアウトを設定する場合はこうする。

params.js
const params = {
    InstanceIds: [ "instance_id" ],
    DocumentName: "AWS-RunShellScript",
    Parameters: {
        "commands": [
            "hoge",    // コマンド1
            "foo",     // コマンド2
            ...
        ],
        "executionTimeout": ["86400"]    // これも Array !!
    },
};

何が問題か

AWSのドキュメントでは、commands のタイプは StringListexecutionTimeout のタイプは String となっている。
AWS Systems Manager - Documents ドキュメント名: AWS-RunShellScript

だから、素直に考えると、以下のようなコードを書いてしまう。

paramsWrong.js
const params = {
    InstanceIds: [ "instance_id" ],
    DocumentName: "AWS-RunShellScript",
    Parameters: {
        "commands": [
            "hoge",    // コマンド1
            "foo",     // コマンド2
            ...
        ],
        "executionTimeout": "86400"    // 普通のString
    },
};
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?