What is an AMI and what does it contain?
BeginnerConceptEC2, Auto Scaling and Load Balancing
Answer
An Amazon Machine Image is a template with the root volume snapshot (or instance-store image), launch permissions, and block device mappings. AMIs are regional; copy them (aws ec2 copy-image) to use elsewhere, and share them to accounts or the Org with launch permissions. Encrypted AMIs need the KMS key shared too.
Use EC2 Image Builder or Packer to bake AMIs and look up the latest through an SSM public parameter:
aws ssm get-parameter --name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64 \
--query Parameter.Value --output text