Posts

Showing posts from July, 2018

AWS - Basic EC2 / Snapshot Cleanup

Image
As you migrate from AWS to Azure ;) you may find that you need to clear up resources to save costs.

For example, you may continue to incur costs for snapshots after you de-provision your EC2 instances (virtual machines, for the lamen).

To clear out the snapshots you can use the AWS Powershell commands to clear out any snapshot older then 90 days.

See the example below - by default Get-EC2Snapshot will show all public snapshots, so the -owner self switch is required.
Get-EC2Snapshot -Owner self | ? { $_.StartTime -lt $(get-date).adddays(-90)} | Remove-EC2Snapshot  This command may show an error indicating that a Snapshot is still in use.
Remove-EC2Snapshot : The snapshot snap-xxxxxx is currently in use by ami-xxxxxxx