The first two of the four choices: what the machine boots and how big it is.
The image
An Amazon Machine Image is a disk image with an operating system and whatever else was baked in. Launching an instance copies the image onto a fresh disk. AMI ids look like ami-0c7217cdde317cfec and are different in every region for the same image, and they change when AWS publishes a new build.
So nobody memorises them. AWS publishes the current id of each of its images under a fixed name in Parameter Store, a small key-value service inside Systems Manager (ssm):
aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 --query Parameter.Value --output textget-parameter reads one parameter by name; the --query keeps only its value. The answer is the id of today's Amazon Linux 2023, the operating system this course uses. Saving it in a shell variable makes the next lesson's launch command short:
AMI=$(aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 --query Parameter.Value --output text)
echo $AMIThe size
An instance type names the hardware. The name has two parts: a family with a generation number, and a size.
| Family | Built for | Examples |
|---|---|---|
| t | burstable general purpose, the cheapest; a CPU baseline with credits for bursts | t3.micro, t3.small |
| m | balanced general purpose | m5.large |
| c | compute optimized, more CPU per gigabyte | c5.large |
| r | memory optimized, more gigabytes per CPU | r5.large |
Sizes double as they go up: large is 2 CPUs, xlarge 4, 2xlarge 8. micro and small exist only in the t family. t3.micro has 2 CPUs and 1 GiB, is free-tier eligible, and is enough for everything in this course.
aws ec2 describe-instance-types --instance-types t3.micro c5.large r5.large --query "InstanceTypes[].[InstanceType,VCpuInfo.DefaultVCpus,MemoryInfo.SizeInMiB,FreeTierEligible]" --output tableSame command as the last lab, one more column. The pattern to remember: pick the family for the shape of the work, then the smallest size that fits, and grow later.