MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / main

Function main

javascriptv3/example_code/ssm/actions/send-command.js:12–29  ·  view source on GitHub ↗
({ documentName })

Source from the content-addressed store, hash-verified

10 * @param {{ documentName: string }}
11 */
12export const main = async ({ documentName }) => {
13 const client = new SSMClient({});
14 try {
15 await client.send(
16 new SendCommandCommand({
17 DocumentName: documentName,
18 }),
19 );
20 console.log("Command sent successfully.");
21 return { Success: true };
22 } catch (caught) {
23 if (caught instanceof Error && caught.name === "ValidationError") {
24 console.warn(`${caught.message}. Did you provide a valid document name?`);
25 } else {
26 throw caught;
27 }
28 }
29};
30// snippet-end:[ssm.JavaScript.Basics.sendCommand]
31import { fileURLToPath } from "node:url";
32// Call function if run directly

Calls 2

sendMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected