# EC2 instance launch करूया: step by step

Source: https://ravindrabagale.com/mr/cyber/part-02/ch04-amazon-ec2-launch-and-connect-to-your-linux/4-3-launching-an-instance-step-by-step.html
Language: mr (Marathi with English technical terms)

AWS Management Console मध्ये login करा. या lab साठी region Asia Pacific (Mumbai), ap-south-1 निवडा. Launch करण्यापूर्वी तुमच्या account ची credits/free-tier eligibility आणि अंदाजे charges तपासा. खालील names examples म्हणून वापरले आहेत.

EC2 उघडा: वरच्या search मध्ये EC2 शोधा → EC2 Dashboard → Launch instance.

Name and tags: नाव web-server-1 द्या. यातून Name=web-server-1 tag तयार होतो.

AMI निवडा: Application and OS Images मध्ये Amazon Linux 2023 (user ec2-user) किंवा Ubuntu Server 24.04/22.04 LTS (user ubuntu) निवडा. CentOS Stream 9 वापरत असाल तर trusted publisher आणि AMI च्या documentation मधला username तपासा; source उदाहरणात ec2-user, जुन्या CentOS images मध्ये centos आहे. Graviton निवडलेलं नसेल तर या lab साठी 64-bit (x86) architecture ठेवा.

Instance type: छोटा compatible type निवडा—उदा. t3.micro. Console मधली current eligibility/price पाहा.

Key pair: Create new key pair → नाव mykey → RSA किंवा ED25519 → OpenSSH साठी .pem, PuTTY साठी .ppk → Create. Private key एकदाच download होते; सुरक्षित ठेवा.

Network settings: Edit करा. Default VPC, गरजेनुसार subnet/AZ निवडा. या public lab साठी Auto-assign public IP = Enable. नवीन security group web-sg तयार करून खालील inbound rules द्या.

 | Type
 | Protocol
 | Port
 | Source
 | Why

 | SSH
 | TCP
 | 22
 | My IP (e.g. 198.51.100.7/32)
 | त्या source IP वरूनच SSH connection; key सुद्धा आवश्यक

 | HTTP
 | TCP
 | 80
 | Anywhere-IPv4 0.0.0.0/0
 | Website

 | HTTPS
 | TCP
 | 443
 | Anywhere-IPv4 0.0.0.0/0
 | TLS असलेली website

SSH source My IP म्हणजे तुमच्या सध्याच्या public IP ची /32 entry. ती login ची स्वतंत्र हमी नसून network-level restriction आहे; योग्य key सुद्धा लागते. Public website साठीच HTTP/HTTPS सर्व IPv4 sources कडून allow केले आहेत.

Storage: AMI साठी योग्य root volume निवडा. Source example 8 GiB gp3 आहे. Actual default size आणि plan मधली storage allowance तपासा; ठराविक GiB आपोआप free असल्याचं गृहीत धरू नका.

Advanced details: हवं असल्यास Amazon Linux 2023 साठी खालील User data script द्या. पहिल्या boot वर Nginx install/start करण्याचं हे example आहे.

#!/bin/bash
yum install -y nginx
echo "<h1>Hello from $(hostname -f)</h1>" > /usr/share/nginx/html/index.html
service nginx start
systemctl enable nginx

Launch: Summary पुन्हा वाचा → Launch instance → View all instances. State Running आणि आवश्यक status checks पास होईपर्यंत थांबा. Public IPv4 copy करा. Console मध्ये checks चा count बदलू शकतो; फक्त एका जुन्या count वर अवलंबून राहू नका.

Test: User data वापरलं असेल तर browser मध्ये http://<PUBLIC_IP> उघडा. या टप्प्यावर TLS configure केलेलं नसल्याने HTTP वापरतो.

Timeout आला तर काय तपासाल?

Security group मध्ये inbound TCP 80 allow आहे का?

चुकून https:// वापरलं का?

Web server चालू आणि योग्य interface वर listen करतोय का?

Subnet route table मध्ये Internet Gateway कडे योग्य route आहे का?

Instance ला public IP आहे का?

Security group नीट ठेवा

SSH फक्त trusted source साठी ठेवा. Database किंवा admin ports साठी 0.0.0.0/0 देऊ नका. Security groups stateful असतात—allowed connection च्या reply traffic ला state च्या आधारे परवानगी मिळते.

Lab

Charges तपासल्यानंतर एक Amazon Linux 2023 आणि एक Ubuntu 24.04 instance web-sg सोबत तयार करा. User data script फक्त Amazon Linux instance ला द्या. त्याचा HTTP page तपासा. Lab संपल्यावर पुढच्या lifecycle lesson प्रमाणे resources review करा.

रवींद्र बागले यांची tip

घरचं किंवा class मधलं public IP बदललं तर SSH rule मधलं My IP update करा. “IP बदलतो म्हणून SSH सर्व internet साठी उघडा ठेवू” हा shortcut घेऊ नका.
