Updated: 28 September 2026 · Applies to: Amazon EC2 (Data Lifecycle Manager, AWS Backup)

You can automate EC2 backups (AMIs and EBS snapshots) without writing your own Lambda code. AWS now provides managed services for this, which also delete old backups for you.

Option 1: Amazon Data Lifecycle Manager (EBS snapshots and AMIs)

  1. In the EC2 console, open Elastic Block Store › Lifecycle Manager and click Create lifecycle policy.
  2. Choose EBS snapshot policy or EBS-backed AMI policy.
  3. Select the instances or volumes by tag (for example Backup = daily), and add that tag to them.
  4. Set the schedule (for example every 24 hours at 02:00 UTC) and the retention (for example keep 7).
  5. Create the policy. New snapshots appear at the next scheduled time.

Option 2: AWS Backup

AWS Backup covers EC2, EBS, RDS, EFS and more with backup plans, vaults and cross-region or cross-account copies. Create a backup plan, then assign resources by tag.

If you still want Lambda

A Lambda function (Python 3.12 runtime with boto3) triggered by an Amazon EventBridge schedule can call create_image or create_snapshot and delete old ones. Give its IAM role only the EC2 permissions it needs. The managed services above are simpler to maintain.

Tip: Test a restore regularly: launch an instance from an AMI or create a volume from a snapshot.

Related services

AWS managed services

monitoring, cost optimisation, security and 24/7 support.

Hire an expert

engineers per 15 minutes, per hour or per month, with no contract.

Was this answer helpful?

Still stuck? Open a ticket