EC2 AMI basics

Topic: Cloud aws core

Summary

An AMI is a template for an EC2 instance. Use a public AMI (Amazon Linux, Ubuntu) or create your own from an instance for consistent deployments. AMI IDs are region-specific. Use this when launching instances or building a custom AMI.

Intent: How-to

Quick answer

  • Choose an AMI when launching an instance. Use the latest Amazon Linux or Ubuntu from AWS or Canonical. Pin AMI ID in automation for reproducibility. AMI IDs differ by region.
  • Create custom AMI: launch from base AMI, install and configure, then Create Image from the instance. New instances from that AMI start with that config. Deregister old AMIs to avoid cost from old snapshots.
  • Copy AMI to another region for DR. Or build from script each time instead of copying for immutable deployments.

Prerequisites

Steps

  1. Choose AMI

    In Launch Instance pick AMI from Quick Start or search. Note AMI ID. For automation use describe-images to get latest by name or use a fixed ID. Region-specific.

  2. Create custom AMI

    Launch from base AMI; install app and config; remove keys and history. EC2 Actions -> Image and templates -> Create image. New instances use this AMI.

  3. Manage AMIs

    Deregister old AMI and delete snapshots when superseded. Tag AMIs with version or date. Use in launch templates or automation.

Summary

Use public or custom AMIs to launch instances; create a custom AMI from a configured instance for repeatable deployments. Use this when choosing or building AMIs.

Prerequisites

Steps

Step 1: Choose AMI

Select a trusted base AMI; note region and ID; pin in automation.

Step 2: Create custom AMI

Configure an instance; create an image; use for future launches.

Step 3: Manage AMIs

Deregister and delete old AMI snapshots; tag for versioning.

Verification

  • Instances launch from the intended AMI; custom AMI produces expected config.

Troubleshooting

AMI not in region — Copy AMI to the region or use a different base. Boot fails — Check kernel and init; avoid instance-specific config in the AMI.

Next steps

Continue to