1
1
<#
2
2
Get-AWS-EBS-Volume-Information.ps1
3
- Version: 1.0
3
+ Version: 1.1
4
4
Authors: David Stamen @ Pure Storage
5
+ Edited: Mike Carpendale @ Pure Storage
5
6
#>
6
7
7
8
# Get all regions
8
- $Regions = (Get-AWSRegion ).Region
9
+ $Regions = (Get-AWSRegion ).Region # comment this line if you want target specific regions
10
+ # Define specific regions you may want to target
11
+ # $Regions = @("ap-southeast-1", "us-west-2") #uncomment this line if you dont want to run this across all regions
9
12
10
13
# Get all Volumes in each region
11
14
$Volumes = foreach ($Region in $Regions ) {
@@ -23,7 +26,7 @@ $VolumeDetailsOutArray = @()
23
26
# The computer loop you already have
24
27
foreach ($Volume in $Volumes ) {
25
28
# Construct an object for the Collection
26
- $myobj = " " | Select-Object " Region" , " AvailabilityZone" , " VolumeType" , " Size" , " Iops" , " VolumeId" , " Name" , " Device" , " PlatformDetails" , " InstanceId" , " State" , " InstanceState" , " InstanceType"
29
+ $myobj = " " | Select-Object " Region" , " AvailabilityZone" , " VolumeType" , " Size" , " Iops" , " Throughput " , " VolumeId" , " Name" , " Device" , " PlatformDetails" , " InstanceId" , " State" , " InstanceState" , " InstanceType" , " Tags "
27
30
28
31
# Fill the object with the values mentioned above
29
32
if ($Volume.State -eq " available" ) {
@@ -33,8 +36,11 @@ foreach ($Volume in $Volumes) {
33
36
$myobj.Region = $Volume.AvailabilityZone.Substring (0 , $Volume.AvailabilityZone.Length - 1 )
34
37
$myobj.AvailabilityZone = $Volume.AvailabilityZone
35
38
$myobj.Iops = $Volume.Iops
39
+ $myobj.Throughput = $Volume.Throughput # Add this line to get Throughput
36
40
$myobj.Size = $Volume.Size
37
41
$myobj.Name = ($Volume.Tags | ? {$_.Key -EQ " Name" }).Value | Out-String - Stream
42
+ # Add Tags to the object as a single string (key-value pairs)
43
+ $myobj.Tags = ($Volume.Tags | ForEach-Object { " $ ( $_.Key ) =$ ( $_.Value ) " }) -join " ; "
38
44
39
45
# Add the objects to the Volume Out Arrays
40
46
$VolumeDetailsOutArray += $myobj
@@ -59,8 +65,10 @@ foreach ($Volume in $Volumes) {
59
65
$myobj.Region = $Volume.AvailabilityZone.Substring (0 , $Volume.AvailabilityZone.Length - 1 )
60
66
$myobj.AvailabilityZone = $Volume.AvailabilityZone
61
67
$myobj.Iops = $Volume.Iops
68
+ $myobj.Throughput = $Volume.Throughput # Add this line to get Throughput
62
69
$myobj.Size = $Volume.Size
63
- $myobj.Name = ($Volume.Tags | ? {$_.Key -EQ " Name" }).Value | Out-String - Stream
70
+ # Add Tags to the object as a single string (key-value pairs)
71
+ $myobj.Tags = ($Volume.Tags | ForEach-Object { " $ ( $_.Key ) =$ ( $_.Value ) " }) -join " ; "
64
72
65
73
# Add the objects to the Volume Out Arrays
66
74
$VolumeDetailsOutArray += $myobj
0 commit comments