Introduction
AMI is the EC2 instance template; includes OS and application layer. EBS snapshot forms the basis of AMI.
Regular snapshot and golden AMI strategy enables disaster recovery and fast scaling.
This guide covers AMI creation, snapshot lifecycle, and automation.
AMI Creation
create-image produces AMI from instance. No reboot=false ensures consistent disk image. AMI sharing can be cross-account or public.
Golden AMI: template with security patches, agents, and base config pre-applied.
aws ec2 create-image \
--instance-id i-0123456789abcdef0 \
--name "myapp-golden-2026-01-06" \
--description "Patched golden image" \
--no-rebootEBS Snapshot
Snapshot is incremental; only changed blocks are saved. create-snapshot manual; DLM schedules automatically.
Snapshots stored in region; cross-region copy for disaster recovery.
aws ec2 create-snapshot \
--volume-id vol-0123456789abcdef0 \
--description "Daily backup"
aws ec2 copy-snapshot \
--source-region us-east-1 \
--source-snapshot-id snap-xxx \
--destination-region eu-west-1DLM Lifecycle Policy
Data Lifecycle Manager creates snapshots automatically and deletes old ones. Tag-based targeting.
Daily snapshot + 30 day retention is standard production start.
{
"PolicyType": "EBS_SNAPSHOT_MANAGEMENT",
"ResourceTypes": ["VOLUME"],
"TargetTags": [{"Key": "Backup", "Value": "true"}],
"Schedules": [{
"CreateRule": {"Interval": 24, "IntervalUnit": "HOURS"},
"RetainRule": {"Count": 30}
}]
}AMI Lifecycle
Deregister old AMIs; delete attached snapshots (cost). AMI versioning enables rollback.
Build automated golden AMI pipeline with Packer.
- create-image → test → launch template güncelle
- Eski AMI deregister
- Snapshot orphan temizliği
- Packer CI/CD entegrasyonu
Disaster Recovery
Set snapshot frequency by RTO/RPO targets. Cross-region AMI copy enables region failover.
Restore: create volume from snapshot, attach to instance or launch new instance from AMI.
Snapshot'ları test edin; restore prosedürünü çeyrekte bir dry-run yapın.
Conclusion
AMI and snapshot management is fundamental to AWS operations. Automate with DLM, use golden AMI, plan cross-region copy.
Clean old snapshots and AMIs regularly for cost.