Restore volumes from VSS-enabled EBS snapshots - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

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

Important

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 Amazon Tools for Windows PowerShell and run the following command to specify your user access keys. Your user must either have administrative access for Amazon EC2 or it must have the required permissions granted. For more information, see Setting Up Amazon Systems Manager in the Amazon 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 RestoreVssSnapshotSampleScript.zip file and extract the file contents.

  4. Open RestoreVssSnapshotSampleScript.zip 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.