Welcome back to Day 3 of our AWS Basics to Pro series! 🌟
Yesterday, we explored the foundation of AWS infrastructure:
✅ AWS Regions
✅ Availability Zones
✅ Local Zones
✅ How to create an AWS account and Free Tier benefits
What’s on today’s agenda?
Today, we’re diving deeper into one of the most popular AWS services: Amazon EC2 (Elastic Compute Cloud).
We’ll cover:
1️⃣ What is EC2? - Understanding the concept of virtual servers in the cloud.
2️⃣ Why use EC2? - Benefits and use cases of EC2.
3️⃣ Creating Your First EC2 Instance - A step-by-step guide to launch your own server.
4️⃣ Access EC2 Instance From Windows Machine - Learn how to connect to your EC2 instance using
What is EC2 Instance?
Amazon EC2 (Elastic Compute Cloud) ek scalable computing service hai, jo AWS par aapko virtual servers (instances) provide karti hai. Aap in virtual machines ko apne applications aur workloads ko run karne ke liye use kar sakte hain. EC2 instances ko aap scale kar sakte hain, matlab jab zarurat ho toh instances ko add ya remove kar sakte hain.
Why Create an EC2 Instance?
Scalability: Aap EC2 instances ko easily scale kar sakte hain, jaise ki instance types ko change karke (small to large).
Cost-effective: Pay-as-you-go pricing model ke saath, aap sirf jo compute power use karte hain, uske liye hi pay karte hain.
Flexibility: Different operating systems, like Windows, Linux, and even custom AMIs (Amazon Machine Images) ko run kar sakte hain.
Security: EC2 instances aapke security groups aur virtual private cloud (VPC) ke under hote hain, jo security kaafi improve karte hain.
How to Create Your First EC2 Instance?
Step 1: Log in to AWS Console
Step 2: Go to EC2 Dashboard
- Console mein login karne ke baad, EC2 ko search karke EC2 dashboard par jayein.
Step 3: Launch Instance
- EC2 dashboard par, Launch Instance button par click karein, jo aapko new EC2 instance create karne ka option dega.
Step 4: Choose an Amazon Machine Image (AMI)
EC2 instance create karte waqt, aapko ek Amazon Machine Image (AMI) choose karna padta hai. Yeh ek pre-configured template hota hai jo operating system aur software packages ko define karta hai.
- For example, aap Amazon Linux 2, Ubuntu, ya Windows Server choose kar sakte hain.
Step 5: Choose Instance Type
Aapko instance type choose karna hota hai, jisme CPU, memory, aur networking capacity ka selection hota hai.
- t2.micro (Free Tier) instance sabse common hota hai agar aap beginner hain.
Step 6: Configure Instance Details
Is step mein aap instance ki configuration set karte hain, jaise ki number of instances, network settings, IAM role (if needed), etc.
- Default VPC select karke aapko networking configure karna hoga.
Step 7: Add Storage
- EC2 instance ko storage add karna hota hai. By default, ek 8GB root volume hota hai, lekin aap isse increase kar sakte hain agar zarurat ho.
Step 8: Configure Security Group
Security groups ek type ka firewall hote hain jo EC2 instances ko protect karte hain. Aapko inbound aur outbound traffic rules set karne hote hain.
- For example, SSH (port 22) open karna agar aap Linux instance use kar rahe hain, ya RDP (port 3389) for Windows.
Step 9: Review and Launch
Sab configurations ko review karne ke baad, Launch button par click karein.
Aapko ek key pair download karna hoga, jo instance ko securely access karne mein madad karega.
Step 10: Connect to Your EC2 Instance
- Instance successfully launch hone ke baad, aap apne EC2 instance ko connect kar sakte hain. Agar aap Linux instance use kar rahe hain, toh SSH ke through connect kar sakte hain, aur Windows instance ke liye RDP (Remote Desktop Protocol) use hota hai.
This are page you will get after following those step
How to Access EC2 Instance from Windows Using Git Bash?
Step 1: Install Git Bash on Windows
- Sabse pehle, agar aapke paas Git Bash installed nahi hai, toh aap Git Bash ko Git official website se download karke install kar sakte hain.
Step 2: Download the EC2 Key Pair
Jab aap EC2 instance create kar rahe hote hain, toh aapko key pair (a
.pem
file) download karni hoti hai.Yeh key pair aapko SSH ke through EC2 instance ko securely access karne ke liye use hoti hai.
Agar aapne key pair nahi banaya, toh EC2 Dashboard se naya key pair generate kar sakte hain.
Step 3: Convert PEM to PPK (if required)
Windows machine par Git Bash ke through
.pem
file se connect hone ke liye, PuTTY (SSH client) ki zarurat padti hai.PuTTY
.ppk
file format ko support karta hai, toh aapko.pem
file ko.ppk
format mein convert karna hoga.PuTTYgen tool se is conversion ko aap easily kar sakte hain:
PuTTYgen open karen.
Load option se apni
.pem
file ko select karein.Uske baad, Save private key par click karke
.ppk
format mein save kar lein.
Step 4: Open Git Bash
- Windows mein Git Bash ko open karein.
Step 5: Set Permissions for the Key Pair
Git Bash mein, aapko key pair ko secure karna hoga.
chmod
command ko use karke key pair ko read-only permissions de sakte hain, lekin Windows par yeh direct command nahi chalti. Isliye, Windows mein aap simply key pair file ka location ya path correct kar ke proceed kar sakte hain.
Step 6: Connect to EC2 Instance Using SSH
Git Bash mein, aap SSH command use kar ke EC2 instance se connect ho sakte hain. Command format yeh hoga:
ssh -i /path/to/your/keypair.pem ec2-user@your-ec2-public-dns
/path/to/your/keypair.pem
ko apne download ki hui key file ke path se replace karein.ec2-user
(Linux instance ke liye) yaubuntu
(Ubuntu instance ke liye) default username hota hai.your-ec2-public-dns
ko apne EC2 instance ke public DNS name se replace karein.
Step 7: Confirm Connection
Jab aap command execute karenge, toh Git Bash aap se connection ke liye confirm karega. Type yes aur press Enter.
Agar sab kuch thik hota hai, toh aap apne EC2 instance par successfully login kar jayenge.
Step 8: You Are Connected!
- Ab aap apne EC2 instance ko Git Bash ke through access kar sakte hain, aur apne server par commands execute kar sakte hain.
Conclusion
Aaj humne EC2 ko samjha aur apna pehla EC2 instance create kiya AWS par. Fir, Git Bash ki madad se, humne apne Windows machine se EC2 instance ko securely SSH ke through access kiya. Is process se hum apne remote instance ko easily manage kar sakte hain, bina kisi problem ke.
Aaj ke liye itna hi, kal hum aur naye topics ke saath continue karenge! 😊