Optimizing costs for unused EC2 instances on AWS
I have a few old EC2 instances that I’m no longer using. These idle instances still incur monthly charges due to their attached EBS storage, which is substantially more expensive than say, S3 storage ($0.08/GB-month vs $0.023/GB-month).
In order to cut the cost, I want to first backup the data on the instance, and then terminate the instance. Of course, if I didn’t care about the data on the instance, I could just terminate it without making a backup.
I had a quick look around for the best way to do this and came across EBS snapshots. EBS snapshots are point-in-time backups of your EBS volumes. They’re stored in S3 (though not directly accessible), making them much cheaper to maintain than full EBS volumes. Another nice feature of snapshots is that you only pay for the size of the data being backed up, not the size of the source volume.
Snapshot costs are $0.05/GB-month for standard tier storage and $0.0125/GB-month for archive tier storage. Archive tier means the data has to be retrieved (24-72 hrs) before you can access it again.
Here’s a quick guide on backing up your instance volume:
- Create Snapshots:
- Navigate to EC2 > Volumes
- Select the volume associated with your instance
- Actions > Create Snapshot
- Add a description
- Navigate to EC2 > Snapshots and verify that your snapshot shows “completed”
- (Optional) Archive your snapshot
- Select the snapshot > Actions > Archiving > Archive snapshot
- Terminate the Instance: With your data safely backed up, you can now terminate the unused instance.
- Restore When Needed:
- To access the data later, create a new volume from the snapshot
- Attach this volume to a running EC2 instance