Automated EBS Snapshot Creation on EC2 Shutdown using Amazon EventBridge

Amazon EC2 → Amazon EventBridge

This pattern deploys an EventBridge rule that automatically creates EBS snapshots when an EC2 instance shuts down using direct EBS target integration.

This pattern creates an automated EBS snapshot system using EventBridge event-driven rules with direct EBS target integration.
The EventBridge rule monitors EC2 instance state changes and triggers when an instance enters shutting-down or stopping state.
The solution requires Volume ID and Instance ID parameters and uses pure infrastructure-as-code approach without Lambda functions.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/sam-eventbridge-ebs-snapshot

Deploy

sam buildsam deploy --guided


Testing

Stop or terminate the monitored EC2 instance after deployment.
Check EC2 console snapshots section - snapshot will be created when instance shuts down.

Cleanup

sam delete
Note: Existing snapshots must be deleted manually if needed.

Created by:

Anirudh Gupta

Anirudh Gupta

Technical Account Manager at AWS

Follow on LinkedIn