4. Amazon EC2: Launch and Connect to Your Linux Server
4.7 Instance Lifecycle: Stop, Reboot, Terminate
Ha table data javun deil ki bill yet rahil he tharavto – don vela vacha.
pending ──► running ──► stopping ──► stopped ──► (start) ──► pending
│ ▲
reboot │ │
▼ │
running ──► shutting-down ──► terminated (gone for ever)
| Action | What happens | Public IP | EBS root volume | Billing |
|---|---|---|---|---|
| Reboot | OS restarts on same host | Kept | Kept | Continues |
| Stop | Instance shut down; may move to new host on start | Released (new one on start); EIP kept | Kept | Instance charges stop; EBS & EIP still charged |
| Hibernate | RAM saved to EBS, then stop | Same as stop | Kept | Same as stop |
| Terminate | Instance deleted permanently | Released | Deleted if Delete on termination = yes (default for root) | All instance charges stop |
Terminate is permanent
Terminated instances cannot be recovered. Enable Termination protection (Actions → Instance settings → Change termination protection) for important servers, and take an EBS snapshot or AMI before experimenting.
Why this matters for security
Forgotten running instances are both a cost risk and a security risk – unpatched, unmonitored servers are easy targets. After every lab, stop or terminate what you don't need and release unused Elastic IPs.
Ravindra Bagale's Tip
Stop kelyavar public IP badalto – khup students DNS kiwa bookmark madhe juna IP thevtat aani "site gayab zali" mhantat. Fixed IP pahije tar Elastic IP vapra (Part 6). Aani Terminate aani Stop madhla farak nehmi don vela vacha, mag click kara.
Practice task
Stop your Ubuntu instance, start it again and note the old and new public IP. Then enable termination protection on the Amazon Linux instance.
Thodkyaat sangaycha tar
- EC2 = virtual server; you choose AMI (OS), instance type (size), key pair (login) and security group (firewall).
- Security group: 22 from My IP only, 80/443 from anywhere; never open database ports to the internet.
chmod 400 mykey.pem; usersec2-user(Amazon Linux) andubuntu(Ubuntu).- Windows: PowerShell OpenSSH (+
icacls), PuTTY (.ppk), or MobaXterm. - IMDSv2 protects instance metadata; stop changes the public IP; terminate is permanent.
Samjla ka? Tumcha server ready aahe – aata tya var Linux commands shikuya. Aata pudhe jaauya!