Amazon EC2 SAA 高频

AMI: Custom Images, Snapshots, and User Data

Amazon Machine Image, EBS Snapshot, and EC2 User Data

AMIEBS SnapshotUser DataEC2
Last organized

Separate bootable templates, volume point-in-time copies, and initialization scripts, then combine Golden AMIs with user data.

In one sentence

An AMI is a bootable EC2 template, a snapshot is a point-in-time copy of an EBS volume, and user data initializes an instance at launch.

ConceptStoresMain purposeDoes not store
AMISystem template, block device mapping, related snapshotsLaunch consistent EC2 instancesOriginal instance ID, ENI, IP, RAM, or processes
EBS snapshotBlock-level volume data at a point in timeRestore volumes and move data across AZs or RegionsComplete EC2 launch configuration
User dataA launch-time scriptLightweight, environment-specific configurationA reusable image
HibernateRAM on the root EBS volumeRestore the prior process stateA deployment template

Design points

  • Creating an EBS-backed AMI creates related snapshots; the default reboot improves filesystem consistency.
  • AMIs are regional resources and must be copied across Regions.
  • A public AMI is not automatically trusted; verify the owner, patch level, and provenance.
  • Cross-account encrypted AMIs also require snapshot and KMS key permissions.
  • Deregistering an AMI does not automatically remove every backing snapshot.

Bake stable, large, slow-changing dependencies into a Golden AMI. Use user data for environment settings, service registration, and last-mile initialization. Keep scripts repeatable and never embed long-term credentials.

Remember

An AMI defines what starts, a snapshot captures volume data, and user data defines what happens after launch.