AWS EBS Snapshot Lifecycle Policy: Every 7 Days, Keep 4

Use AWS EC2 Lifecycle Manager to back up EBS volumes via EBS snapshots, every 7 days, and keep only 4.

We're looking to create something robust, automated, and AWS-native.

Step 0 - Prerequisites

  • Your EC2 instance uses EBS volumes.
  • Volumes are tagged (we’ll use this to target them).
  • You have necessary IAM permissions to manage DLM.

Step 1: Tag Your Volume

  • Go to EC2 → Volumes
  • Find the EBS volume you want to back up (likely the one attached to your EC2 running Docker).
  • Add a tag:
Key: Backup
Value: True

Step 2: Create Lifecycle Policy

  1. Go to EC2 → Lifecycle Manager (or search “Lifecycle Manager” in AWS Console).
  2. Click Create Lifecycle Policy.
  3. Policy type: EBS Snapshot Policy.

Step 3: Configure Policy

Target Resources

  • Target resource types: Volume
  • Resource tags:
Key: Backup
Value: True

Schedule

  • Name: WeeklyBackup
  • Frequency: 7 days
  • Start time: Pick a low-traffic time (e.g. 2:00 AM UTC)
  • Retention type: Count
  • Retain: 4 snapshots