Day 64: Managing volumes with Snapshots in AWS

Welcome to Day 64 of the “100 Days of DevOps with PowerShell”! For background on our goals in this series, see Announcing the “100 Days of Devops with PowerShell” Series here at SCC.

In Day 59 of this series we were introduced to snapshots in AWS and looked at the basics of how to create a snapshot.  In this post we’re going to dig a little deeper and look at how we create a snapshot, restore that snapshot and then how to increase the size of a volume through a snapshot.  In the DevOps world the ability to revert to a known state through automation allows development teams to deploy, test and redeploy at a much higher cadence that perhaps provisioning a new environment.  In addition if development requirements demand more disk, either through additional volumes (see Day 54) or through an increase to existing volumes then this can easily be done via snapshots as we shall see.

Restoring a volume via a snapshot

In this first part of this example we are going to deploy a new instance, retrieve the volumeID and then take a snapshot.  Lets assume that after taking the snaphshot an application upgrade has been performed on the instance, but it has not gone to plan, so therefore we’re going to restore our snapshot.  Because we are restoring the system partition, we do need to shutdown the instance first.

Once we have shutdown the instance, we need to create a new volume based off the snapshot we have already taken.  Next we dismount volume, waiting  a minute for it complete.  Once the volume has been dismounted, it is removed before adding the new volume we previously created.  Start up the instance and you should be back to where you were prior to the application upgrade.

Increasing the size of an existing volume

Another common use case scenario with snapshots is to increase the size of a volume.  Essentially what we do here is create a snapshot of an existing volume and then create a new volume based off that snapshot, but when creating that new volume we specify the desired size.  In the example below we are working with the same instance as before.  Note that when creating the snapshot and the new volume we wait until the snapshot is in a complete state and for the volume we are waiting until it’s available.  In addition, because we are resizing a system partition we also make sure the instance is stopped.   Once the new volume is available, dismount the existing one and attach the new one.

Finally, let’s take a look in the console for the old volume (30GB) and the new volume (65GB).  As you can see the old is showing as available, while the new volume is already attached to our instance with an ‘in-use’ state.


The final step of the process is login to the server, go to disk management and extend the volume into the newly available space.


in this post we looked at how snapshots are used to restore an environment to an existing state, as you would typically do in an on-premise environment, but snapshots are also to increase the size of a volume.  In the next post we’re going to dig even further into snapshots and look at how they can be used to automate our backups.

Previous Installments

To see the previous installments in this series, visit “100 Days of DevOps with PowerShell”.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.