Skip to content

Instantly share code, notes, and snippets.

@lantrix
Created June 1, 2015 08:02
Show Gist options
  • Select an option

  • Save lantrix/b72884d6b79725debb35 to your computer and use it in GitHub Desktop.

Select an option

Save lantrix/b72884d6b79725debb35 to your computer and use it in GitHub Desktop.
Count number of AWS Resource Types with specific Tag Value in Powershell
$tagKey="Stream"
$tagValue="se"
$data = (Get-EC2Tag -Filter @{name="tag:${tagKey}"; Value=$tagValue})
$gps = @()
foreach ($t in $data.ResourceType | ? { $_.Key -eq $groupkey} ) {
$gps += $t.Value
}
$gps | group | Sort Count -Descending | Select Count, Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment