Amazon Elastic Compute Cloud (EC2)
Basics of EC2
Demo Create AMI from AWS Console
Learn how to create a reusable Amazon Machine Image (AMI) from an existing EC2 instance. An AMI captures a point-in-time snapshot of an instance—including its attached EBS volumes—for future launches or backups.
Step 1: Select Your EC2 Instance
- Open the EC2 console at https://console.aws.amazon.com/ec2.
- In the Instances pane, choose the target instance.
- Click Actions → Image and templates → Create image.
Step 2: Configure AMI Settings
On the Create Image dialog:
- Image name: Enter a unique, descriptive name (e.g.,
prod-webserver-ami-2024-05-01
). - No reboot: Check this to avoid instance reboot during image creation.
- Volumes: Confirm which EBS volumes to include. Exclude transient volumes (e.g., log volumes) if you don’t need them.
Note
Skipping the reboot option may lead to file system inconsistencies. Use it only when uptime is critical.
Step 3: Tag Your AMI
Adding tags simplifies automation and cleanup. Include at least these:
Tag Key | Example Value | Purpose |
---|---|---|
Name | Demo | Human-readable identifier |
InstanceName | demo-web-01 | Link back to original EC2 instance |
Once tags are set, click Create image. AWS will snapshot each volume, then register the new AMI.
Step 4: Monitor Snapshot Creation
- In the left menu, select Snapshots.
- Locate the snapshot(s) with Status: pending.
Step 5: Monitor AMI Registration
- Go to Images → AMIs in the EC2 console.
- Find your AMI (Status: pending).
After a few minutes, both the snapshot and AMI statuses will switch to available.
Step 6: View Snapshot Details
Once complete, click on the snapshot ID to review its metadata, size, and status.
Step 7: Launch a New Instance from Your AMI
- In the AMIs list, select your custom AMI.
- Click Launch instance.
- Under Application and OS Images (Amazon Machine Image), switch to My AMIs and pick yours.
- Continue with the standard launch workflow (instance type, networking, storage, etc.).
Step 8: Deregister (Delete) the AMI
To remove an AMI:
- Go to Images → AMIs, select the AMI.
- Choose Actions → Deregister AMI.
- Confirm the deregistration.
Warning
Deregistering an AMI does not delete its associated snapshots. Manually delete any orphaned snapshots to prevent unexpected storage charges.
Cleanup Recommendations
- Implement consistent tagging conventions for automated cleanup via AWS CLI scripts.
- Schedule periodic audits to deregister unused AMIs and delete leftover snapshots.
References
Watch Video
Watch video content
Practice Lab
Practice lab