I have hundreds of instances in the EC2 web console.
Some are shutdown. I can see that they were created many months or years ago. They seem abandoned and forgotten for a while but it's hard to tell if terminating them is safe.
e.g. They could be some old backup, someone could have just migrated a load to new instances and keep the old ones for a few weeks as precaution, etc...
We end up keeping most of them as it's the safest choice.
We are still paying for the EBS volumes when the instance is shutdown (but not terminated). The price can escalate over time with many unused instances (EBS is $140 per month per TB). So I'd like to do some cleanup.
I'm thinking that if I could find the time when the instance was shutdown, that would be a good indicator of how "abandoned" it is.
How can I find when an instance was last shutdown?
Using the awscli.
pip install awscli
Output:
We can see what happened to the instance and at what time.
For instance, this one was shutdown manually at 2015-11-16 13:36:40 GMT.
As you mentioned those machines are created many years ago, I think you should check if they are using the old kind of storage call instance store.
In my experience, if you need to shutdown those EC2 machines with instance store, the only option is to terminate it but it would cause data loss.
So my suggestion is to either add a new EBS to backup all data and create a new EC2 with latest settings or simply backup the data remotely. Then terminate the old EC2 instances which should eliminate your storage cost.
If your goal is to save money, then you could create an EBS Snapshot of the disks and then delete the volumes.
EBS Snapshots are charged at a lower price than the actual volumes.
For example, in US-East:
However, EBS snapshots only require storage space for used blocks. If the EBS volumes have unused space (eg only used 10GB out of 30GB), then EBS snapshots will be cheaper.
If the EBS volumes are mostly full, you could snapshot them and then recreate them as Cold HDD EBS volumes, which are charged at 2.5c/GB of provisioned storage.