Schedule an Amazon AWS Snapshot Using WIndows Powershell

One time setups:

In Windows Powershell, execute the following:

1) Set-ExecutionPolicy RemoteSigned

2) Import-Module "C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell\AWSPowerShell.psd1"

3) Get-Module

NOTE: should see awspowershell in results


Set-AWSCredentials -AccessKey YourAccessKey -SecretKey YourSecretKey -StoreAs YourProfileName

5) Initialize-AWSDefaults -ProfileName YourProfileName -Region us-west-2

6) To get default region:


NOW, to test it:

New-EC2Snapshot "vol-9e49828e" -Description "DevinScript"

NOTE: Had to add user to a security group with roles in AWS Managmeent console

Save the above command as a ".ps1" file.

To schedule in WIndows task scheduler:

Run Program: Powershell.exe

Add argument: c:\yourfolder\Snapshot.ps1