Chapter 5: Amazon EC2 (Elastic Compute Cloud)
5.1 Why EC2? Cloud vs on-premises
Friends, let's first understand why we need EC2 at all. Imagine your college wants to host a result portal. The old on-premises way means: buy servers (₹2–5 lakh each), a UPS, air-conditioning, network switches and a server room, employ an admin, wait a few weeks for delivery – and still, on result day, when lakhs of students log in at the same time, the site crashes.
मित्रांनो, आधी EC2 का लागतो ते समजून घेऊया. समजा तुमच्या कॉलेजला रिझल्ट पोर्टल होस्ट करायचं आहे. जुनी on-premises पद्धत म्हणजे: सर्व्हर्स विकत घ्यायचे (प्रत्येकी ₹2–5 लाख), UPS, AC, नेटवर्क स्विचेस, सर्व्हर रूम, ॲडमिनला कामावर ठेवायचं, डिलिव्हरीसाठी काही आठवडे थांबायचं – आणि तरी रिझल्टच्या दिवशी लाखो स्टुडंट्स एकाच वेळी लॉगिन झाले की साइट क्रॅश होते.
दोस्तों, पहले समझते हैं कि EC2 की ज़रूरत क्यों पड़ती है. मान लो आपके कॉलेज को रिज़ल्ट पोर्टल होस्ट करना है. पुराना on-premises तरीका मतलब: सर्वर्स खरीदो (हर एक ₹2–5 लाख), UPS, AC, नेटवर्क स्विच, सर्वर रूम, एक एडमिन को काम पर रखो, डिलीवरी के लिए कुछ हफ़्ते रुको – और फिर भी रिज़ल्ट वाले दिन लाखों स्टूडेंट्स एक साथ लॉगिन करें तो साइट क्रैश हो जाती है.
With cloud computing, you rent compute power over the internet and pay only for what you use.
| Point | On-premises | AWS EC2 (cloud) |
|---|---|---|
| Upfront cost | High capital expense (CapEx) | Zero upfront; pay-as-you-go (OpEx) |
| Time to get a server | Weeks | Minutes |
| Scaling | Buy more hardware; slow | Launch more / bigger instances in minutes; Auto Scaling |
| Maintenance | You handle hardware, power, cooling | AWS handles physical infrastructure |
| Availability | One building; single point of failure | Multiple Availability Zones and Regions |
| Global reach | Hard | Deploy in any AWS Region worldwide |
| Security | Fully your responsibility | Shared responsibility: AWS secures the cloud, you secure what is in the cloud |
Now think about our Mauli Dairy. Before Diwali, online orders for pedhe and shrikhand go up a lot, and afterwards they come down again. If they buy their own server, they pay for a big server all year while the rush lasts only a few days. On EC2 they can start bigger or more instances during the rush and reduce them when the rush is over – you pay only for what you use. That is the real benefit of the cloud.
आता आपल्या Mauli Dairy चा विचार करा. दिवाळीच्या आधी पेढे आणि श्रीखंडच्या ऑनलाइन ऑर्डर्स खूप वाढतात, आणि नंतर परत कमी होतात. स्वतःचा सर्व्हर घेतला तर वर्षभर मोठ्या सर्व्हरचे पैसे भरा, गर्दी फक्त काही दिवस. EC2 वर गर्दीच्या वेळी मोठे किंवा जास्त इन्स्टन्स चालू करायचे, आणि गर्दी संपली की कमी करायचे – जेवढं वापरलं तेवढेच पैसे. हेच क्लाउडचे खरे फायदे आहेत.
अब अपनी Mauli Dairy के बारे में सोचो. दिवाली से पहले पेढ़े और श्रीखंड के ऑनलाइन ऑर्डर बहुत बढ़ जाते हैं, और बाद में फिर कम हो जाते हैं. अपना सर्वर खरीदा तो साल भर बड़े सर्वर के पैसे भरो, जबकि भीड़ सिर्फ़ कुछ दिन की है. EC2 पर भीड़ के समय बड़े या ज़्यादा इंस्टेंस चालू करो, और भीड़ खत्म होते ही कम कर दो – जितना इस्तेमाल किया उतने ही पैसे. यही क्लाउड का असली फ़ायदा है.
Cloud service models: IaaS (you manage OS and above — EC2), PaaS (you manage only code — Elastic Beanstalk), SaaS (you just use the software — Gmail). EC2 is IaaS.
Shared responsibility model
AWS is responsible for the data centres, hardware, hypervisor and global network. You are responsible for the guest OS (updates, patches), security group rules, users and keys, applications and data. A hacked EC2 because of an open port 22 with a weak password is your responsibility.
Ravindra Bagale's Tip
Many students think that once they take a server on the cloud, security is entirely AWS's job. Don't make this mistake! Remember shared responsibility: AWS looks after the data centre and hardware, but OS updates, security group rules, keys and data are all your responsibility. If you leave port 22 open to everyone and the server gets hacked, the fault is yours, not AWS's.
Ravindra Bagale's Tip – मराठी
बरेच students ना वाटतं की cloud वर server घेतला म्हणजे security पूर्ण AWS ची जबाबदारी. इथे चूक करू नका! Shared responsibility लक्षात ठेवा: data centre आणि hardware AWS सांभाळतो, पण OS updates, security group rules, keys आणि data हे सगळं तुमची जबाबदारी आहे. Port 22 सगळ्यांसाठी उघडा ठेवून server hack झाला तर दोष तुमचा, AWS चा नाही.
Ravindra Bagale's Tip – हिंदी
बहुत से students सोचते हैं कि cloud पर server ले लिया तो security पूरी तरह AWS की ज़िम्मेदारी है. यह गलती मत करना! Shared responsibility याद रखो: data centre और hardware AWS संभालता है, लेकिन OS updates, security group rules, keys और data सब आपकी ज़िम्मेदारी है. Port 22 सबके लिए खुला छोड़ा और server hack हो गया, तो गलती आपकी है, AWS की नहीं.
Practice task
Mauli Dairy, Pune sathi ek chhota table banva: on-premises server vs EC2 – upfront cost, server milayla lagnara vel, scaling aani maintenance. Pratyek row samor ek line liha ki Mauli Dairy sathi kay better aahe aani ka.
Got it? The cloud means a rented server – you pay only for what you use. Now let's move on to the key concepts of EC2.
समजलं का? क्लाउड म्हणजे भाड्याने घेतलेला सर्व्हर – जेवढं वापरलं तेवढेच पैसे. आता पुढे जाऊया EC2 च्या की कन्सेप्ट्सकडे.
समझ आया? क्लाउड मतलब किराए पर लिया हुआ सर्वर – जितना इस्तेमाल किया उतने ही पैसे. अब आगे चलते हैं EC2 के की कॉन्सेप्ट्स की ओर.
Quick revision cards
Revise this lesson in two minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens its lesson.

More cards: Ravi Sir's Cards.