Restore volumes from VSS-enabled EBS snapshots - Amazon Elastic Compute Cloud

Restore volumes from VSS-enabled EBS snapshots

You can use the RestoreVssSnapshotSampleScript.ps1 script to restore volumes on an instance from VSS-enabled EBS snapshots. This script performs the following tasks:

  • Stops an instance

  • Removes all existing drives from the instance (except the boot volume, if it was excluded)

  • Creates new volumes from the snapshots

  • Attaches the volumes to the instance by using the device ID tag on the snapshot

  • Restarts the instance


The following script detaches all volumes attached to an instance, and then creates new volumes from a snapshot. Make sure that you have properly backed-up the instance. The old volumes are not deleted. If you want, you can edit the script to delete the old volumes.

To restore volumes from VSS-enabled EBS snapshots

  1. Open AWS Tools for Windows PowerShell and run the following command to specify your credentials. You must either have administrator privileges in Amazon EC2 or have been granted the appropriate permission in IAM. For more information, see Setting Up AWS Systems Manager in the AWS Systems Manager User Guide.

    Set-AWSCredentials –AccessKey key_name –SecretKey key_name
  2. Run the following command to set the Region for your PowerShell session. The example uses the us-east-2 Region.

    Set-DefaultAWSRegion -Region us-east-2
  3. Download the file and extract the file contents.

  4. Open in a text editor and edit the sample call at the bottom of the script with a valid EC2 instance ID and EBS snapshot ID, and then run the script from PowerShell.