Amazon EC2 Operations: Instance Lifecycle, Status Checks, Auto Recovery, Placement Groups, AMIs and Troubleshooting

AWS SysOps Associate 55 min min read Updated: Nov 17, 2026 Intermediate
Amazon EC2 Operations: Instance Lifecycle, Status Checks, Auto Recovery, Placement Groups, AMIs and Troubleshooting
Intermediate Topic 1 of 4

Instance Lifecycle

State / actionWhat happensBilling and data
pending → runningLaunchingCompute billed per second once running (Linux, minimum 60 s)
StopShuts down OS. Instance can start later on a possibly different hostNo compute charge. EBS volumes keep data and are billed. Instance store data is lost. Public IPv4 changes (unless Elastic IP). Private IP is kept
RebootOS restart on the same hostSame host, same IPs, instance store kept
HibernateSaves RAM to the encrypted root EBS volume, then stops. Resumes with processes intactNeeds an encrypted root volume large enough for RAM and supported instance types/AMIs
TerminateDeletes the instanceRoot EBS volume deleted by default (DeleteOnTermination). Additional volumes kept by default. Termination protection blocks accidental terminate
Retire (AWS event)Host hardware is failingStop and start (EBS-backed) to move to a healthy host before the date
bash aws ec2 stop-instances --instance-ids i-0abc aws ec2 start-instances --instance-ids i-0abc aws ec2 modify-instance-attribute --instance-id i-0abc --disable-api-termination # termination protection aws ec2 modify-instance-attribute --instance-id i-0abc --instance-type "{\"Value\": \"m6i.large\"}" # resize: instance must be stopped aws ec2 describe-instance-status --instance-ids i-0abc --include-all-instances
Resize steps To change the instance type: stop → modify → start. The new type must be compatible with the AMI (architecture, virtualization, ENA and NVMe drivers). EBS data is kept. Expect a short outage.

Status Checks

CheckDetectsTypical fix
System status checkProblems with the AWS side: host hardware, power, network, hypervisorStop and start the instance (moves it to new hardware) or use auto recovery. Reboot does not move it
Instance status checkProblems with your instance: bad OS config, exhausted memory, corrupted file system, wrong kernel/network configReboot or fix the OS (use Systems Manager or detach the volume and repair it from another instance)
Attached EBS status checkEBS volume impairedReplace or restore the volume from a snapshot

Metrics: StatusCheckFailed, StatusCheckFailed_System, StatusCheckFailed_Instance (0 = pass, 1 = fail) in AWS/EC2, every minute.

Auto Recovery

A CloudWatch alarm on **StatusCheckFailed_System can run the recover action. AWS moves the instance to new hardware with the same instance id, private IP, Elastic IP and metadata. It does not work for instance-store instances. Many newer instances have simplified automatic recovery** on by default.

bash aws cloudwatch put-metric-alarm --alarm-name recover-web1 --namespace AWS/EC2 --metric-name StatusCheckFailed_System \ --dimensions Name=InstanceId,Value=i-0abc --statistic Maximum --period 60 --evaluation-periods 2 --threshold 1 \ --comparison-operator GreaterThanOrEqualToThreshold --alarm-actions arn:aws:automate:ap-south-1:ec2:recover arn:aws:sns:ap-south-1:111111111111:ops
  • Other alarm actions: ec2:stop, ec2:terminate, ec2:reboot
  • For fleets prefer Auto Scaling with ELB health checks, so unhealthy instances are replaced automatically

Instance Types and Sizing

FamilyUse
t3/t4g (burstable)Low average CPU with bursts. Uses CPU credits. Watch CPUCreditBalance. Unlimited mode avoids throttling but can add cost
m general purposeBalanced
c compute optimizedBatch, web servers, encoding
r, x memory optimizedDatabases, in-memory caches
i, d storage optimizedHigh local IOPS, data warehouses
g, p, inf, trn acceleratedGPU, ML
Suffix g (m7g), a (AMD), i (Intel), n (network), d (local NVMe)Variants. Graviton (arm64) gives good price-performance but needs arm64 builds

Purchasing Options

OptionNotes
On-DemandNo commitment, per-second billing
Savings Plans (Compute / EC2 Instance)1 or 3 year spend commitment. Compute Savings Plans also cover Fargate and Lambda and are flexible across families and Regions
Reserved InstancesCommit to instance attributes. Standard or Convertible. Zonal RIs reserve capacity in an AZ
SpotSpare capacity at deep discounts. 2-minute interruption notice (EventBridge and instance metadata). Use for stateless, fault-tolerant work
Dedicated Hosts / InstancesSingle-tenant, for licensing or compliance
On-Demand Capacity ReservationsReserve capacity in an AZ without a term commitment. Combine with Savings Plans for the discount

Placement Groups

TypeBehaviorUse
ClusterPacked in one AZ on close hardware for low latency and high throughputHPC, tightly coupled. Higher risk: one hardware fault can hit many
SpreadEach instance on separate hardware (max 7 per AZ per group)A few critical instances that must not fail together
PartitionGroups of instances on separate racks (up to 7 partitions per AZ)Large distributed systems like Hadoop, Cassandra, Kafka
  • Launch instances of the same type together to avoid InsufficientInstanceCapacity in cluster groups
  • You can move an instance into a group by stopping it first

AMIs

  • An AMI = root volume snapshot + launch permissions + block device mapping. It is Regional
  • Create from an instance (create-image), which snapshots attached volumes. Copy to another Region (and re-encrypt with a different KMS key). Share with accounts or make public (avoid). Deregister an AMI, then delete its snapshots separately
  • Keep a golden AMI with patches and agents (SSM agent, CloudWatch agent). Automate with EC2 Image Builder
  • Use SSM Parameter Store public parameters to get the latest Amazon Linux AMI id: /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64
bash aws ec2 create-image --instance-id i-0abc --name "web-golden-2026-11-17" --no-reboot aws ec2 copy-image --source-region ap-south-1 --source-image-id ami-0abc --name web-golden --region ap-southeast-1 --encrypted aws ec2 modify-image-attribute --image-id ami-0abc --launch-permission "Add=[{UserId=222222222222}]" aws ec2 deregister-image --image-id ami-0old

Networking Attributes

ItemNotes
Elastic IPStatic public IPv4 you own until released. Charged when not attached (and public IPv4 addresses are charged in general now). Re-map to another instance for quick failover
ENI (elastic network interface)Virtual NIC with private IPs, security groups, MAC. Can be moved between instances in the same AZ (a secondary ENI keeps an IP for failover or licensing)
Enhanced networking (ENA)High bandwidth, low latency on supported types
Source/destination checkDisable on NAT or firewall instances so they can forward traffic

User Data and Metadata

  • User data runs at first boot (cloud-init). Logs in /var/log/cloud-init-output.log
  • Instance metadata at 169.254.169.254. Use IMDSv2 (token required). Enforce with --metadata-options HttpTokens=required or an SCP

Connection Troubleshooting

SymptomCheck
SSH timeoutSecurity group port 22 from your IP, NACL (both directions), route to Internet Gateway, public IP, instance running. Better: use Session Manager
Permission denied (publickey)Wrong key pair or user (ec2-user, ubuntu, admin), key file permissions chmod 400
Connection refusedService not listening on that port
RDP failurePort 3389 allowed, correct password, Windows firewall
Session Manager does not connectSSM Agent running, instance profile with AmazonSSMManagedInstanceCore, network path to SSM endpoints (internet, NAT or VPC endpoints ssm, ssmmessages, ec2messages)
Instance launch fails InsufficientInstanceCapacityTry another AZ or type, wait, or use a capacity reservation
InstanceLimitExceeded / VcpuLimitExceededRequest a quota increase
Instance terminates immediatelyEncrypted volume with KMS key access problem, EBS limit reached, snapshot missing
Cannot reach instance after changing configUse the EC2 serial console or detach the root volume, attach to a rescue instance and fix files

Practice Tasks

  1. Launch an instance, stop and start it, and note which IP changes
  2. Create a status check alarm with the recover action
  3. Create an AMI, copy it to another Region and launch from it
  4. Change the instance type of a stopped instance
  5. Connect with Session Manager and then close port 22 completely

Conclusion

Know the EC2 lifecycle (stop vs terminate vs hibernate), the difference between system status checks (AWS side: stop/start or recover) and instance status checks (your OS: reboot or fix), set recovery alarms or use Auto Scaling health replacement, pick the right purchase option and placement group, manage AMIs per Region, and use Session Manager and the troubleshooting table when connections fail.

Quick Summary: lifecycle; status checks; auto recovery; types; purchasing; placement groups; AMIs; networking; metadata; troubleshooting.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators