title: AWS EC2 metadata Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/
body: <p>I have Windows EC2 and trying to fetch metadata</p>
  
  <pre><code>Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/
  
  Invoke-RestMethod : Unable to connect to the remote server
  At line:1 char:1
  + Invoke-RestMethod -uri http://169.254.169.254/latest/meta-data/
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
     eption
      + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
  </code></pre>
  
  <p>How can I see the the metadata of EC2 instance?</p>