Forgotten AWS EC2 instances have made everyone’s pockets hurt (including Puppet!). Take it from us (https://puppet.com/ team) — if you don’t proactively clean up unused EC2 instances, cloud spending can quickly get out of control.

This post walks you through de-provisioning unused EC2 instances by using AWS Lambda and CloudFormation to deploy an EC2 reaper that uses simple Tags to cut down on spending.

The AWS Reaper works by checking and enforcing tags that are set on the EC2 instances.

The main reaper logic for handling instances is in the terminate_expired_instances function which lists instances and looks up the termination date tag for each instance: Improperly Tagged Instances

Related Articles