Skip to content

Instantly share code, notes, and snippets.

@MatthewJDavis
Last active April 6, 2019 01:03
Show Gist options
  • Select an option

  • Save MatthewJDavis/d7cdf0c32d28ea69971b5a56841ae108 to your computer and use it in GitHub Desktop.

Select an option

Save MatthewJDavis/d7cdf0c32d28ea69971b5a56841ae108 to your computer and use it in GitHub Desktop.
output an AWS subnet(s) with name tag
# Very basic, works if only name tag is set
Get-EC2Subnet| ForEach-Object {
$properties = [ordered]@{
AZ = $_.availabilityzone
SubnetID = $_.subnetid
Name = ($_ | Select-Object -ExpandProperty Tags).value
CidrBlock = $_.cidrblock
}
New-Object -TypeName PSObject -Property $properties
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment