AWS – Use PowerShell to list VPC and Instance information in one view

One thing I am missing in the Amazon Web Services  interface/dashboard is the ability to see information from both the VPC and the instance in one screen.
For example: I want the name of the vpc, the vpc id, the name of the instance, the instance id, the state of the vpc and the name of the keypair it’s using.
For this, I’ve written the following small script, just to get a quick overview:

Note: A next step could be that you can turn this into a function and pipe this function to Out-GridView 🙂


  1. Julian says:


    Some really cool blogs/scripts.

    Maybe a silly question, but how would you output this is a grid view. I can’t seem to figure it out.

  2. Jeff Wouters says:

    $Instances = (Get-EC2Instance).instances
    $VPCS = Get-EC2Vpc
    $Output = foreach ($VPC in $VPCS) {
    $Instances | Where-Object {$_.VpcId -eq $VPC.VpcId} | foreach {
    New-Object -TypeName PSObject -Property @{
    ‘VpcId’ = $_.VpcId
    ‘VPCName’ = ($VPC.Tags | Where-Object {$_.Key -eq ‘Name’}).Value
    ‘InstanceId’ = $_.InstanceId
    ‘InstanceName’ = ($_.Tags | Where-Object {$_.Key -eq ‘Name’}).Value
    ‘LaunchTime’ = $_.LaunchTime
    ‘State’ = $_.State.Name
    ‘KeyName’ = $_.KeyName
    $Output | out-gridview

  3. aqeel says:

    Hi Jeff,

    Your scripts are really useful, can i knew where i can find more aws scirpts from your webpage, as there is nosearch option to find scripts related to aws.

    Hope to hear from you soon.



Leave a Reply

Your email address will not be published. Required fields are marked *