Monitor the resizing of EBS volumes

Monitor EBS volume resizing
Monitor EBS volume resizing (click to enlarge)

Recently, AWS announced a major new capability: the ability to dynamically modify EBS volumes. AWS calls the new capabilities “Elastic Volumes” and many properties of EBS volumes are now changeable — though reduction of a volume’s size is not.

I was blown away by the announcement but didn’t have time until now to explore Elastic Volumes. This week, a client asked me to show him how to expand Windows Server EBS volumes — and I got my chance.

As always, AWS Console operations are really just calls to the AWS API and so I was very pleased to see that AWS updated its PowerShell cmdlets the same day that Elastic Volumes was announced. New cmdlets to manage Elastic Volumes include Edit-EC2Volume and Get-EC2VolumeModification. That’s the good news. The bad news is that the AWS documentation for Windows describes using the AWS CLI to monitor modifications instead of the PowerShell cmdlets. (I’ve left a feedback and the doc writers are amazingly responsive, so by the time you find this on Google it may have been updated.)

That piqued my curiosity and resulted in the script you see below. This is a simple (or, given the way the output is formatted, maybe not so simple) PowerShell script that uses Get-EC2VolumeModification to display the results of modifications. (I am in awe of the things you can do with PowerShell when combined with the AWS API.)

Here are some usage notes:

  • The calculated duration field (using PowerShell calculated expressions with, essentially, an embedded script within a script) is inaccurate until the modification is complete
  • I eliminated fields in the output that I don’t especially care about like “OriginalIops” and “TargetSize”. If you want those, just add them back to the Select-Object statement
  • Obviously, Ctrl-C breaks stops the endless loop 🙂
  • Bonus! It appears that Get-EC2VolumeModification will report all Elastic Volume modifications that have ever occurred in the account. In the screenshot nearby, you can see I had one volume being modified and two that were previously modified. I don’t know how long the history is maintained. But if it is permanent, what a wonderful record of changes this could become. You can even see how to use this in billing reports.

As always, I hope this is of some use to you.

Import-Module AWSPowerShell
        Watches EBS volume modifications via Get-Ec2VolumeModification

        Loops endlessly issuing Get-Ec2VolumeModification every 30 seconds to report progress, status, start time, stop time and duration of each volume modification

    .PARAMETER none


        Formatted console output

        PS C:\> ./Watch-EBS-volume-resizing.ps1

        Outputs to the console modified output from Get-Ec2VolumeModification

        For more information on EBS volume modification, see

        (c) 2017 Air11 Technology LLC -- licensed under the Apache OpenSource 2.0 license,
        Licensed under the Apache License, Version 2.0 (the "License");
        you may not use this file except in compliance with the License.
        You may obtain a copy of the License at

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
        Author's blog:

While (1)
    Get-EC2VolumeModification | Select-Object -Property VolumeId,  Progress,
        @{ Name = 'Duration'; Expression = { $d = (New-TimeSpan -Start $_.StartTime -End $_.EndTime); "{0:hh}:{0:mm}" -f $d } },
        @{ Name = 'Status'; Expression = { $_.ModificationState } },
        StartTime, EndTime |
        Format-Table -AutoSize -Wrap
    Start-Sleep -Seconds 30




, , , ,



One response to “Monitor the resizing of EBS volumes”

  1. Maria Khan Avatar

    This is a wonderful post!

Leave a Reply

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