snippetMinor
How to avoid output being truncated when running AWS SSM command?
Viewed 0 times
ssmoutputavoidbeingrunningwhenawshowcommandtruncated
Problem
I've got the following AWS CLI commands to run the PowerShell's
However, the output is truncated:
How I can run
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 textHowever, the output is truncated:
...
StatusCode : 200
StatusDescription : OK
Content :
Example Domain
<meta name="viewport" conten...
------------------Output truncated-------------------How I can run
aws ssm list-command-invocations command, so the output won't be truncated?Solution
According to this ssm tutorial, SSM send-command output is truncated at 2500 characters. To work around that, you must send your output to an S3 bucket using the
--output-s3-bucket-name parameter.Context
StackExchange DevOps Q#3372, answer score: 5
Revisions (0)
No revisions yet.