EC2 vocabulary: instances, AMIs, and instance types
coreintermediateAn instance is a running virtual server, launched from an AMI (a template of a disk image) at a chosen instance type (a fixed bundle of CPU/memory/network). User data runs once at first boot; the instance metadata service answers questions the instance asks about itself.
Think of it as
An AMI is a recipe. An instance type is the size of pan you cook it in — the same recipe in a bigger pan gets you more of everything at once. User data is the instructions taped to the pan for exactly what to do the first time it comes out of the oven.
What we're doing: See a user-data script that runs once at first boot, and where it gets its instructions from.
- 1
- The shebang tells EC2 how to execute this user-data payload — bash here, but it could equally be cloud-init YAML.
- 3
- This install only happens on first boot — restarting the instance later does not re-run this script.
Why this works: User data is the mechanism that turns a generic AMI into a specifically configured instance at launch time, without needing a custom AMI baked for every possible configuration.
Assuming user data re-runs on every instance restart
Wrong
Better
What you see: An updated user-data script has no effect on an already-running instance, even after a full reboot.
Why: User data executes on first boot only, by design — cloud-init (the component that runs it) tracks that it has already executed and skips it on subsequent boots unless explicitly reset, which is not the default reboot behavior.
- AMI — the template — OS + software
- Instance type — fixed vCPU/memory/network bundle
- User data — runs once, at first boot only
Instance lifecycle states and what changes in each
Together
Remember: An AMI is the template, an instance type is the fixed CPU/memory/network bundle, user data runs once at first boot only — and it stays retrievable for the instance's whole life, so it is not a safe place for secrets.
See also: purchasing options · instance store vs ebs

