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
-
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
–SecretKeykey_name
-
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
-
Download the RestoreVssSnapshotSampleScript.zip file and extract the file contents.
-
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.