title: AWS ECS Exec fails on shell access to ECS Fargate task (Unable to start shell: Failed to start pty: fork/exec C:/Program: no such file or directory)
body: <p>I am attempting to gain shell level access from a windows machine to a Linux ECS Task in an AWS Fargate Cluster via the AWS CLI (v2.1.38) through aws-vault.</p>
  <p>The redacted command I  am using is</p>
  <blockquote>
  <p>aws-vault exec <em><strong>my-profile</strong></em> -- aws ecs execute-command --cluster
  <em><strong>my-cluster-name</strong></em> --task <em><strong>my-task-id</strong></em>  --interactive --command &quot;/bin/sh&quot;</p>
  </blockquote>
  <p>but this fails with this output</p>
  <pre><code>The Session Manager plugin was installed successfully. Use the AWS CLI to start a session.
  Starting session with SessionId: ecs-execute-command-0bc2d48dbb164e010
  SessionId: ecs-execute-command-0bc2d48dbb164e010 :
  ----------ERROR-------
  Unable to start shell: Failed to start pty: fork/exec C:/Program: no such file or directory
  </code></pre>
  <p>I can see that ECS Exec is enabled on this task because an aws describe shows the following.
  <a href="https://i.stack.imgur.com/x70GR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/x70GR.png" alt="enter image description here" /></a></p>
  <p>It appears that its recognising the host is a windows machine and attempting to initialise based on a variable that is windows specific.</p>
  <p>Is anyone able to suggest what I can do to resolve this.</p>