1.EC2 vocabulary: instances, AMIs, and instance types
An 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.
Key features
- AMI: a template containing the OS, and optionally pre-installed software
- Instance type (e.g. m6g.large): a fixed bundle of vCPU, memory, and network performance
- User data: a script that runs once, at first boot, unless explicitly re-triggered
- Instance metadata (IMDS, 169.254.169.254): lets the instance query its own instance ID, role credentials, and more
- Lifecycle states: pending → running → stopping/stopped → (terminated), each with distinct implications
Instance lifecycle states and what changes in each
- AMI — the template — OS + software
- Instance type — fixed vCPU/memory/network bundle
- User data — runs once, at first boot only
Command
aws ec2 run-instances --image-id ami-0abc123 --instance-type m6g.large \
--user-data file://init.sh --security-group-ids sg-0def456An 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.