Creating and Managing AWS Snapshots in Powershell

Creating a snapshot of an Amazon Web Services EBS volume is a simple method to back up your AWS instances. For more details on AWS snapshots make sure to read this.

Below is a Powershell script I modified to

  • Create a snapshot of all EBS volumes tagged with “AWSBackupEnabled”=True
  • Tag new snapshots with the backup date (tag=BackupDate) and “AWSBackupEnabled”=True
  • Delete snapshots older than 14 days
  • Write results to a log file
  • Send an email with the log to notify the administrator(s) that the backup has completed.

The critical difference between this script and the original found here is the use of Amazon.EC2.Model.Filter, which is used to identify the assets you are working with. Somehow I could not get this code to work

so I modified it slightly

Here is the script: