title: How can I get AWS Instance Tags in user-data?
body: <p>I use aws ec2 userdata with windows powershell scripts. I need instance bootstrapping. My idea is:</p>
  
  <ul>
  <li>EC2 instance tag adds.It's key name "Version", it's value "1.0.0.158-branchname"</li>
  </ul>
  
  <p>I have tried to get version tag value in userdata. I checked aws http api. It can't return tags. I wrote simple powershell scripts:</p>
  
  <pre><code>$instanceId = (New-Object System.Net.WebClient).DownloadString("http://169.254.169.254/latest/meta-data/instance-id")
  aws ec2 describe-tags --filters $filter --query 'Tags[*]'
  </code></pre>
  
  <p>I can get instance Id with aws http api. I can't get instance tags because AWS ec2 userdata can't start "aws.exe".</p>
  
  <p>This script is correct - it is manually run before the instance is started. </p>
  
  <p>Note: "aws" is "aws.exe" (<a href="https://aws.amazon.com/cli/" rel="nofollow">https://aws.amazon.com/cli/</a>)</p>