ssm.sendcommandのパラメータを受け取る方法

0

const Result = await ssm.sendCommand(~).promise(); 上記コマンドを実行するとResultにCommandId,DocumentName,InstanceIds,Status: 'Pending',StatusDetails: 'Pending'等が表示されます。 この後Statusを監視して終了次第情報を受け取りたいのですが、(sendCommandResult.status)等でログを見てみても「INFO undefined」と表示されてしまいます。 どのようにしてStatusを受け取ればよいでしょうか、どなたかご助力をお願いします

処理の後続をwhileで回してfulfilledが出たら処理を終わらせることを想定しています pending(保留): まだ非同期処理は終わっていない fulfilled(成功): 非同期処理が正常に終了した rejected(拒否): 非同期処理が失敗した

已提問 1 年前檢視次數 930 次
1 個回答
0

恐れ入りますが、SendCommand API は特定のコマンドを実行する API となっており、こちらの API よりそのコマンドの実行結果や、Status の更新結果を取得することはできません。

Runs commands on one or more managed nodes.

SendCommand API

SendCommand API にて実行されたコマンドについて、Status の進行状況や、コマンドの実行結果を取得する場合には、 GetCommandInvocation API や ListCommandInvocations API などを使用し別途確認をいただく必要がございます。

ListCommandInvocations provide status about command execution.

ListCommandInvocations

Returns detailed information about command execution for an invocation or plugin.

GetCommandInvocation

つきまして、SendCommand API にて実行したコマンドのステータス状況について確認をいただく必要がございます場合は、定期的に GetCommandInvocation API 、または、 ListCommandInvocations API を実施いただき、別処理としてご確認いただけますと幸いでございます。

AWS SDK for JavaScript: SSM - sendCommand

AWS SDK for JavaScript: SSM - getCommandInvocation

AWS SDK for JavaScript: SSM - listCommandInvocations

AWS
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南