I've got the following AWS CLI commands to run the PowerShell's Invoke-WebRequest command:
instanceId=i-0xyz # Change this.
cmdId=$(aws ssm send-command --instance-ids "$instanceId" --document-name "AWS-RunPowerShellScript" --query "Command.CommandId" --output text --parameters commands='"While ($i -le 10) {Invoke-WebRequest -UseBasicParsing -Uri http://example.com; $i += 1}"')
sleep 1
aws ssm list-command-invocations --command-id "$cmdId" --details --query "CommandInvocations[*].CommandPlugins[*].Output[]" --output text
However, the output is truncated:
...
StatusCode : 200
StatusDescription : OK
Content : <!doctype html>
<html>
<head>
<title>Example Domain</title>
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html;
charset=utf-8" />
<meta name="viewport" conten...
------------------Output truncated-------------------
How I can run aws ssm list-command-invocations command, so the output won't be truncated?
InProgress, will check if I gotPendingas well, 3. If SSM command has been completed, I think we can assume the files are already there. Didn't have problems so far, althought still testing this script heavily. – kenorb Feb 21 '18 at 15:09list-command-invocationslink, the possible values for Status areInProgress, Success, TimedOut, Cancelled, Failed, so no pending as far as I could find. – kenorb Feb 21 '18 at 15:15list-commandsas I target multiples instances, this command has a "Pending" status also. – Tensibai Feb 21 '18 at 15:23