Chapter 14: EC2 Operations — Elastic IP, AMI, Snapshots and Vertical Scaling
Practice Questions and Lab Exercises
- Why does the public IP of an instance change after stop/start? How does an Elastic IP fix it?
- What is the default Elastic IP limit per region? Are idle Elastic IPs free?
- List the parts of an AMI. Differentiate AWS, Marketplace, Community and own AMIs.
- Explain the pros and cons of the "No reboot" option.
- Why must you delete snapshots after deregistering an AMI?
- What is a golden AMI? Why do companies use it?
- Compare scale up and scale out with an example.
- Lab: Allocate an EIP, associate it with
web-1, stop/start the instance and confirm the IP stays the same. Then buildweb-2, re-associate the EIP to it, and finally release the EIP. - Lab: Create an AMI of your working web server, launch a new instance from it and confirm the website loads without any installation. Copy the AMI to
ap-south-2, then deregister both copies and delete their snapshots. - Lab: Take a snapshot of your root volume, delete a file from the website, restore it by creating and mounting a volume from the snapshot.
- Lab: Create a DLM policy that takes a daily snapshot of volumes tagged
Backup=dailyand keeps 7. - Lab: Change your instance from
t3.microtot3.small, verify withnproc,free -handlscpu, then change it back.
Quick Revision
- Elastic IP: static public IPv4 owned by your account; allocate → associate → (re-associate for server replacement) → disassociate → release. Default limit 5 per region; all public IPv4 is charged hourly, even idle.
- AMI: root snapshot(s) + block device mapping + launch permissions. Create from instance (reboot = consistent), launch copies, copy across regions, share by account ID, deregister and delete snapshots. Golden AMI = standard hardened image.
- Snapshots: incremental, stored in S3 (managed), regional. Create volume from snapshot in any AZ → attach → mount (
ro,nouuidfor XFS copy) → restore. Copy across regions, make AMIs, automate with DLM, delete old ones. - Vertical scaling: stop → Change instance type → start → verify (
nproc,free -h,lscpu). Public IP changes (unless EIP), instance store lost, EBS and private IP stay. Watch architecture, ENA/NVMe drivers, AZ availability, free tier. For web tiers prefer horizontal scaling (ASG + ELB).