Skip to content

Added Throughput and tag changes #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<#
Get-AWS-EBS-Volume-Information.ps1
Version: 1.0
Version: 1.1
Authors: David Stamen @ Pure Storage
Edited: Mike Carpendale @ Pure Storage
#>

# Get all regions
$Regions = (Get-AWSRegion).Region
$Regions = (Get-AWSRegion).Region #comment this line if you want target specific regions
# Define specific regions you may want to target
#$Regions = @("ap-southeast-1", "us-west-2") #uncomment this line if you dont want to run this across all regions

# Get all Volumes in each region
$Volumes = foreach ($Region in $Regions) {
Expand All @@ -23,7 +26,7 @@ $VolumeDetailsOutArray = @()
#The computer loop you already have
foreach ($Volume in $Volumes) {
#Construct an object for the Collection
$myobj = "" | Select-Object "Region","AvailabilityZone","VolumeType","Size","Iops","VolumeId","Name","Device","PlatformDetails","InstanceId","State","InstanceState","InstanceType"
$myobj = "" | Select-Object "Region","AvailabilityZone","VolumeType","Size","Iops","Throughput","VolumeId","Name","Device","PlatformDetails","InstanceId","State","InstanceState","InstanceType","Tags"

#Fill the object with the values mentioned above
if ($Volume.State -eq "available") {
Expand All @@ -33,8 +36,11 @@ foreach ($Volume in $Volumes) {
$myobj.Region = $Volume.AvailabilityZone.Substring(0,$Volume.AvailabilityZone.Length-1)
$myobj.AvailabilityZone = $Volume.AvailabilityZone
$myobj.Iops = $Volume.Iops
$myobj.Throughput = $Volume.Throughput # Add this line to get Throughput
$myobj.Size = $Volume.Size
$myobj.Name = ($Volume.Tags | ? {$_.Key -EQ "Name"}).Value | Out-String -Stream
# Add Tags to the object as a single string (key-value pairs)
$myobj.Tags = ($Volume.Tags | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join "; "

#Add the objects to the Volume Out Arrays
$VolumeDetailsOutArray += $myobj
Expand All @@ -59,8 +65,10 @@ foreach ($Volume in $Volumes) {
$myobj.Region = $Volume.AvailabilityZone.Substring(0,$Volume.AvailabilityZone.Length-1)
$myobj.AvailabilityZone = $Volume.AvailabilityZone
$myobj.Iops = $Volume.Iops
$myobj.Throughput = $Volume.Throughput # Add this line to get Throughput
$myobj.Size = $Volume.Size
$myobj.Name = ($Volume.Tags | ? {$_.Key -EQ "Name"}).Value | Out-String -Stream
# Add Tags to the object as a single string (key-value pairs)
$myobj.Tags = ($Volume.Tags | ForEach-Object { "$($_.Key)=$($_.Value)" }) -join "; "

#Add the objects to the Volume Out Arrays
$VolumeDetailsOutArray += $myobj
Expand Down