How do you get command output from Invoke-ECSCommand? #264
-
When using the ECS powershell apis, how can I get the streamed output of the resulting command? Example:
This returns an object, within it I can see there's some wss:// urls, but for the life of me I can't get the command result (e.g. the stdout from the ls -la command). The non powershell utility, aws, works fine with the 'aws ecs execute-command' api. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
@JasonDictos |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
@JasonDictos
Invoke-ECSCommand
CmdLet uses ExecuteCommand service API operation. AWS CLI behind the scenes appears to be using session manager plugin to display command output from ECS ExecuteCommand (refer StackOverflow post https://stackoverflow.com/questions/70367030/how-can-i-get-output-from-boto3-ecs-execute-command). ExecuteCommand response contains the details of the SSM session that was created for this instance of execute-command. With PowerShell, this automatic plumbing does not happen automatically (as with the other SDKs). To workaround this, you would need to use this session information and use Simple System Management API (.NET SDK or PowerShell) to get detailed output. Hop…