title: AWS CLI describe-instances inconsistency
body: <p>I have a Bamboo task that invokes a batch file on a remote EC2. That batch file executes a test, then calls a PowerShell script to parse the test.<br/>Finally I grab the instance Id of our bamboo server and send the results of the test back via ssm.<br/></p>
  
  <p>My problem exists in the PowerShell script when I attempt to send my results. I use "describe-instances" to retrieve the Bamboo Server ID:</p>
  
  <pre><code>Set-AWSCredential -StoreAs default -AccessKey &lt;key&gt; -SecretKey &lt;key&gt;
  
  $instanceid = aws ec2 describe-instances --profile default --region "us-east-1" --filters 'Name=tag:Name,Values=Bamboo Server' --query 'Reservations[*].Instances[*].InstanceId' --output text
  
  Send-SSMCommand -InstanceId $instanceId -DocumentName AWS-RunPowerShellScript -Parameter -Comment
  </code></pre>
  
  <p><strong>*NOTE</strong>: my Bamboo Server resides on a different EC2 than my tests.
  <br/><hr/><br/>
  So, if I invoke the batch file from my Bamboo Build Plan. The "describe-instances" command does not run correctly.
  <br/>
  But, if I run the batch file locally on that remote EC2, the process runs smoothly.</p>
  
  <p>I've tried:<br/>
  - multiple variations of the "describe-instances" including the Get-EC2Instance and others. <br/>
  - I believe my permissions are being set correctly. But maybe the "describe-instances" does not catch it. I have tried many variations of setting the creds including aws configure, manually loading from environment variables and from a file.<br/>
  - I put Start-Sleeps in to ensure I am not having async issues.
  <br/><br/>
  It is like the command refuses to run when I invoke it from the Bamboo Task.
  <br/><br/>
  I noticed that the tests run in the foreground locally, and in the background when invoked from Bamboo.</p>
  
  <p>Could my problem be a security issue? Like running from Bamboo doesn't allow the commands to run the same? I cannot find any documentation explaining that from AWS or Bamboo.</p>
  
  <p>Any ideas?</p>