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
After a stop, the public IP changes – many students keep the old IP in DNS or a bookmark and then say "the site has disappeared". If you need a fixed IP, use an Elastic IP (Part 6). And always read the difference between Terminate and Stop twice before you click.
Ravindra Bagale's Tip – मराठी
Stop केल्यावर public IP बदलतो – बरेच students DNS किंवा bookmark मध्ये जुना IP ठेवतात आणि "site गायब झाली" म्हणतात. Fixed IP हवा असेल तर Elastic IP वापरा (Part 6). आणि Terminate आणि Stop मधला फरक नेहमी दोन वेळा वाचा, मग click करा.
Ravindra Bagale's Tip – हिंदी
Stop करने के बाद public IP बदल जाता है – बहुत से students DNS या bookmark में पुराना IP रखते हैं और कहते हैं "site ग़ायब हो गई". Fixed IP चाहिए तो Elastic IP इस्तेमाल करो (Part 6). और Terminate और Stop का फ़र्क हमेशा दो बार पढ़ो, फिर click करो.
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!