AWS Storage Gateway User Guide
Deleting Snapshots
schedule for disaster recovery purposes. However, you can set up a snapshot schedule at any time if you
need to. Creating snapshot for your cached volume provides an additional way to recover your data if
necessary.
By using the following steps, you can edit the snapshot schedule for a volume.
To edit the snapshot schedule for a volume
1. Open the AWS Storage Gateway console at
https://console.amazonaws.cn/storagegateway/home
.
2. In the navigation pane, choose
Volumes
, and then choose the volume the snapshot was created
from.
3. On the
Actions
menu, choose
Edit snapshot schedule
.
4. In the
Edit snapshot schedule
dialog box, modify the schedule, and then choose
Save
.
Deleting a Snapshot
You can delete a snapshot of your storage volume. For example, you might want to do this if you have
taken many snapshots of a storage volume over time and you don't need the older snapshots. Because
snapshots are incremental backups, if you delete a snapshot, only the data that is not needed in other
snapshots is deleted.
Topics
•
Deleting Snapshots by Using the AWS SDK for Java (p. 163)
•
Deleting Snapshots by Using the AWS SDK for .NET (p. 166)
•
Deleting Snapshots by Using the AWS Tools for Windows PowerShell (p. 170)
On the Amazon EBS console, you can delete snapshots one at a time. For information about how to
delete snapshots using the Amazon EBS console, see
Deleting an Amazon EBS Snapshot
in the
Amazon
EC2 User Guide.
To delete multiple snapshots at a time, you can use one of the AWS SDKs that supports AWS Storage
Gateway operations. For examples, see
Deleting Snapshots by Using the AWS SDK for Java (p. 163)
,
Deleting Snapshots by Using the AWS SDK for .NET (p. 166)
, and
Deleting Snapshots by Using the AWS
Tools for Windows PowerShell (p. 170)
Deleting Snapshots by Using the AWS SDK for Java
To delete many snapshots associated with a volume, you can use a programmatic approach. The example
following demonstrates how to delete snapshots using the AWS SDK for Java. To use the example
code, you should be familiar with running a Java console application. For more information, see
AWS SDK for Java Developer Guide
. If you need to just delete a few snapshots, use the
console as described in
Example : Deleting Snapshots by Using the AWS SDK for Java
The following Java code example lists the snapshots for each volume of a gateway and whether the
snapshot start time is before or after a specified date. It uses the AWS SDK for Java API for AWS Storage
Gateway and Amazon EC2. The Amazon EC2 API includes operations for working with snapshots.
Update the code to provide the service endpoint, your gateway Amazon Resource Name (ARN), and
the number of days back you want to save snapshots. Snapshots taken before this cutoff are deleted.
You also need to specify the Boolean value
viewOnly
, which indicates whether you want to view the
snapshots to be deleted or to actually perform the snapshot deletions. Run the code first with just
API Version 2013-06-30
163